On Sat, 11 Jul 2015 at 20:22:00, Marcel Korpel wrote:
> Signed-off-by: Marcel Korpel <[email protected]>
> ---
>  web/lib/aur.inc.php | 47 ++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 38 insertions(+), 9 deletions(-)
> [...]
> +                                                                       // 
> convert links
> +                                                                       $html 
> .= '<a href="' . htmlspecialchars($matches[$k]) .
> +                                                                             
>   '">' .  htmlspecialchars($matches[$k]) . '</a>';
> [...]

Wow, nine levels of indentation. I think this parser code can be
simplified a lot. What I would do is split the comment at line breaks
and iterate over single lines (means we don't need special handling for
the "```" at the end of a comment as well).

We also should be able to replace links and inline code with simple
preg_replace() or preg_replace_callback() invocations, right?

Reply via email to