Modify ↓
#12638 closed defect (fixed)
format_to_html generates invalid HTML for definition list
Reported by: | Ryan J Ollos | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.2.1 |
Component: | wiki system | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Fix invalid xhtml being generated for definition list after paragraph. |
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Discussed in th:#12056, I found that the HTML generated by format_to_html
is incorrect:
>>> from trac.test import EnvironmentStub, MockRequest >>> from trac.wiki.formatter import format_to_html >>> from trac.web.chrome import web_context >>> env = EnvironmentStub() >>> req = MockRequest(env) >>> context = web_context(req) >>> markup = """[main] Tagging system for Trac. ... ... Associating resources with tags is easy, faceted content classification. ... ... Available components are marked according to their relevance as follows: ... `[main]`:: provide core with a generic tagging engine as well as support ... for common realms 'ticket' (TracTickets) and 'wiki' (TracWiki). ... `[opt]`:: add more features to improve user experience and maintenance ... `[extra]`:: enable advanced features for specific use cases ... Make sure to understand their purpose before deactivating `[main]` or ... activating `[extra]` components. ... """ >>> format_to_html(env, context, markup) <Markup u'<p>\n[main] Tagging system for Trac.\n</p>\n<p>\nAssociating resources with tags is easy, faceted content classification.\n</p>\n<p>\nAvailable components are marked according to their relevance as follows:\n<dl class="wiki"><dt><code>[main]</code></dt><dd>provide core with a generic tagging engine as well as support\nfor common realms \'ticket\' (<a class="missing wiki" href="/trac.cgi/wiki/TracTickets" rel="nofollow">TracTickets?</a>) and \'wiki\' (<a class="missing wiki" href="/trac.cgi/wiki/TracWiki" rel="nofollow">TracWiki?</a>).\n</dd><dt><code>[opt]</code></dt><dd>add more features to improve user experience and maintenance\n</dd><dt><code>[extra]</code></dt><dd>enable advanced features for specific use cases\n</dd></dl>\nMake sure to understand their purpose before deactivating <code>[main]</code> or\nactivating <code>[extra]</code> components.\n</p>\n'>
Here's the output formatted by selectively decoding newlines to emphasize the issue:
<p>\n[main] Tagging system for Trac.\n</p>\n<p>Associating resources with tags is easy, faceted content classification.\n</p>\n <p> Available components are marked according to their relevance as follows: <dl class="wiki"><dt><code>[main]</code></dt><dd>provide core with a generic tagging engine as well as support\nfor common realms \'ticket\' (<a class="missing wiki" href="/trac.cgi/wiki/TracTickets" rel="nofollow">TracTickets?</a>) and \'wiki\' (<a class="missing wiki" href="/trac.cgi/wiki/TracWiki" rel="nofollow">TracWiki?</a>).\n</dd><dt><code>[opt]</code></dt><dd>add more features to improve user experience and maintenance\n</dd><dt><code>[extra]</code></dt><dd>enable advanced features for specific use cases\n</dd> </dl> Make sure to understand their purpose before deactivating <code>[main]</code> or activating <code>[extra]</code> components. </p>
The dl
is wrapped in p
.
Chrome and Firefox seem to handle the scenario okay by removing the p
that wraps the dl
:
<p> Available components are marked according to their relevance as follows: </p><dl class="wiki"><dt><tt>[main]</tt></dt><dd>provide core with a generic tagging engine as well as support for common realms 'ticket' (<a class="wiki" href="/proj-1.0/wiki/TracTickets">TracTickets</a>) and 'wiki' (<a class="wiki" href="/proj-1.0/wiki/TracWiki">TracWiki</a>). </dd><dt><tt>[opt]</tt></dt><dd>add more features to improve user experience and maintenance </dd><dt><tt>[extra]</tt></dt><dd>enable advanced features for specific use cases </dd></dl> Make sure to understand their purpose before deactivating <tt>[main]</tt> or activating <tt>[extra]</tt> components. <p></p>
Attachments (0)
Change History (7)
comment:1 by , 8 years ago
Component: | general → wiki system |
---|---|
Description: | modified (diff) |
comment:2 by , 8 years ago
comment:5 by , 8 years ago
Milestone: | next-stable-1.2.x → 1.2.1 |
---|---|
Owner: | set to |
Release Notes: | modified (diff) |
Status: | new → assigned |
comment:6 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:7 by , 8 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.
Similar issue occurs when definition list is at last line.
Invalid xml would be generated.
</p>
is between<dd>
and</dd>
.