Merge lp:~benji/launchpadlib/fix-nested-p-tags into lp:launchpadlib

Proposed by Benji York
Status: Merged
Approved by: Benji York
Approved revision: 104
Merge reported by: Benji York
Merged at revision: not available
Proposed branch: lp:~benji/launchpadlib/fix-nested-p-tags
Merge into: lp:launchpadlib
Diff against target: 53 lines (+20/-4)
3 files modified
src/launchpadlib/NEWS.txt (+5/-0)
src/launchpadlib/__init__.py (+1/-1)
src/launchpadlib/wadl-to-refhtml.xsl (+14/-3)
To merge this branch: bzr merge lp:~benji/launchpadlib/fix-nested-p-tags
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
j.c.sackett (community) code* Approve
Review via email: mp+42489@code.launchpad.net

Description of the change

The HTML generated by the XSLT did not validate because it contained
nested <p> tags (bug 426858). That was because the contents of
<wadl:doc> nodes were unconditionally wrapped in a <p>.

This branch adds a conditional to the <wadl:doc> template so that
<wadl:doc> nodes with <p> child nodes are instead wrapped in a <div>.

Why a <div> instead of no containing tag at all? For some reason the
output stage of the XSLT processor generates overly-compact HTML (no
inter-tag whitespace) if there isn't a block-level tag containing the
children of the <wadl:doc> node. I wish I knew exactly why that was.

The generated HTML validates and when rendered is virtually identical to
the original (there are a few subtle white-space differences).

To post a comment you must log in.
102. By Benji York

add NEWS.txt entry

103. By Benji York

bump bug fix version

104. By Benji York

tweak comment

Revision history for this message
j.c.sackett (jcsackett) wrote :

Looks good. I wish there were some sort of test set for all of this, but perhaps that will come when we move some of this to LP, as you mentioned.

review: Approve (code*)
Revision history for this message
Curtis Hovey (sinzui) wrote :

This looks good to land.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/launchpadlib/NEWS.txt'
2--- src/launchpadlib/NEWS.txt 2010-11-15 18:34:06 +0000
3+++ src/launchpadlib/NEWS.txt 2010-12-02 15:03:43 +0000
4@@ -2,6 +2,11 @@
5 NEWS for launchpadlib
6 =====================
7
8+1.8.1 (unreleased)
9+==================
10+
11+- The HTML generated by wadl-to-refhtml.xsl now validates.
12+
13 1.8.0 (2010-11-15)
14 ==================
15
16
17=== modified file 'src/launchpadlib/__init__.py'
18--- src/launchpadlib/__init__.py 2010-11-15 18:34:06 +0000
19+++ src/launchpadlib/__init__.py 2010-12-02 15:03:43 +0000
20@@ -14,4 +14,4 @@
21 # You should have received a copy of the GNU Lesser General Public License
22 # along with launchpadlib. If not, see <http://www.gnu.org/licenses/>.
23
24-__version__ = '1.8.0'
25+__version__ = '1.8.1'
26
27=== modified file 'src/launchpadlib/wadl-to-refhtml.xsl'
28--- src/launchpadlib/wadl-to-refhtml.xsl 2010-07-12 15:06:17 +0000
29+++ src/launchpadlib/wadl-to-refhtml.xsl 2010-12-02 15:03:43 +0000
30@@ -978,9 +978,20 @@
31 <!-- skip WADL elements -->
32 <xsl:choose>
33 <xsl:when test="node()[1]=text() and $inline=0">
34- <p>
35- <xsl:apply-templates select="node()" mode="copy"/>
36- </p>
37+ <!-- If the wadl:doc contains <p> tags wrap it in a <div>,
38+ otherwise wrap it in a <p> tag. -->
39+ <xsl:choose>
40+ <xsl:when test="./html:p">
41+ <div>
42+ <xsl:apply-templates select="node()" mode="copy"/>
43+ </div>
44+ </xsl:when>
45+ <xsl:otherwise>
46+ <p>
47+ <xsl:apply-templates select="node()" mode="copy"/>
48+ </p>
49+ </xsl:otherwise>
50+ </xsl:choose>
51 </xsl:when>
52 <xsl:otherwise>
53 <xsl:apply-templates select="node()" mode="copy"/>

Subscribers

People subscribed via source and target branches