github: shadowy octopus with the head of a robot, emblazoned with the Dreamwidth swirl (Default)
github ([personal profile] github) wrote in [site community profile] changelog2015-03-26 12:03 pm

[dreamwidth/dw-free] b57b1a: Fix HTML tags being mismatched after doing LJ::htm...

Branch: refs/heads/develop
Home: https://github.com/dreamwidth/dw-free
Commit: b57b1a7229239e57abe81c786ffbf58d80b50132
https://github.com/dreamwidth/dw-free/commit/b57b1a7229239e57abe81c786ffbf58d80b50132
Author: Afuna <fu@dreamwidth.org>
Date: 2015-03-18 (Wed, 18 Mar 2015)

Changed paths:
M cgi-bin/LJ/TextUtil.pm
M t/htmltrim.t

Log Message:
-----------
Fix HTML tags being mismatched after doing LJ::html_trim

Primary problem was that in some cases closing tags are optional (such
as with tr/td) and so if you had input such as the first given test
case:

test


You'd get:

test
[</tr></table>]

Note the unnecessary added ending tags in the bracket.

This patch changes html_trim so we only pop / append the ending tag
in-text when it matches the last opened tag in the stack.

Then we close all open tags in the stack at the end.

It also adds a couple test cases that demonstrate the behavior of
htmltrim when HTML tags are mismatched.


Commit: 4319b8ba379d89a15309c69c2509c282a4e0ca73
https://github.com/dreamwidth/dw-free/commit/4319b8ba379d89a15309c69c2509c282a4e0ca73
Author: Mark Smith <mark@qq.is>
Date: 2015-03-26 (Thu, 26 Mar 2015)

Changed paths:
M cgi-bin/LJ/TextUtil.pm
M t/htmltrim.t

Log Message:
-----------
Merge pull request #1307 from afuna/html-trim

fix HTML tags being mismatched after doing LJ::html_trim


Compare: https://github.com/dreamwidth/dw-free/compare/58c315f2da5b...4319b8ba379d