Merge lp:~kfogel/launchpadlib/426323-apidoc-html-title-attrs into lp:launchpadlib

Proposed by Karl Fogel
Status: Merged
Merged at revision: not available
Proposed branch: lp:~kfogel/launchpadlib/426323-apidoc-html-title-attrs
Merge into: lp:launchpadlib
Diff against target: 84 lines
1 file modified
src/launchpadlib/wadl-to-refhtml.xsl (+9/-9)
To merge this branch: bzr merge lp:~kfogel/launchpadlib/426323-apidoc-html-title-attrs
Reviewer Review Type Date Requested Status
Barry Warsaw code Needs Fixing
Review via email: mp+12442@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Karl Fogel (kfogel) wrote :

This resolves bug #426323.

I tested it by using Markus Korn's script from http://paste.ubuntu.com/267586/ (note that the last few lines of that paste are not the script, but rather instructions for using it). Basically, just do this:

0. cd 426323-apidoc-html-attrs ## Be at the top of the branch
1. ## Get the script, save it as get-wadl.py. ##
2. python get-wadl.py
3. Do the authn dance with Launchpad in your browser. Read-only access is all you need to grant the script.
4. xsltproc -o apidoc.html src/launchpadlib/wadl-to-refhtml.xsl lpapi.wadl
5. ## Point your browser at apidoc.html, hover over stuff to see the titletips appear. ##

That's it!

I also performed this optional step 6:

6. Hope for the recently-committed fix for https://bugzilla.mozilla.org/show_bug.cgi?id=395668 to appear in my browser soon, so titletips don't drop away after five seconds.

Revision history for this message
Barry Warsaw (barry) wrote :

This looks good as it is, but I wondered on irc whether it's possible to test this in the launchpadlib tree. Does launchpadlib already test its wadl? If so, then adding a test for this shouldn't be difficult. If it's not, then we won't worry about it for this branch.

Please try to find Leonard or Francis to find out.

review: Needs Fixing (code)
Revision history for this message
Leonard Richardson (leonardr) wrote :

> This looks good as it is, but I wondered on irc whether it's possible to test
> this in the launchpadlib tree. Does launchpadlib already test its wadl? If
> so, then adding a test for this shouldn't be difficult. If it's not, then we
> won't worry about it for this branch.

There are no tests of the stylesheet in launchpadlib, or anywhere for that matter. I don't recommend making any changes in this branch.

You could write a test that runs the stylesheet on the example WADL in wadllib and then parses the result to prove various things about the translation. This could run within launchpadlib, which already depends on wadllib.

Or you could test the real generated HTML in Launchpad. We already test that the HTML is generated, but we don't look in the file.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/launchpadlib/wadl-to-refhtml.xsl'
--- src/launchpadlib/wadl-to-refhtml.xsl 2009-09-09 10:17:14 +0000
+++ src/launchpadlib/wadl-to-refhtml.xsl 2009-09-25 21:55:16 +0000
@@ -426,7 +426,7 @@
426426
427 <!-- Table of contents -->427 <!-- Table of contents -->
428 <xsl:template name="table-of-contents">428 <xsl:template name="table-of-contents">
429 <div id="toc">429 <div id="toc" title="toc">
430 <h2>Table of Contents</h2>430 <h2>Table of Contents</h2>
431 <h3>Top-level collections</h3>431 <h3>Top-level collections</h3>
432 <ul>432 <ul>
@@ -470,7 +470,7 @@
470470
471 <!-- Top level collections container -->471 <!-- Top level collections container -->
472 <xsl:template name="top-level-collections">472 <xsl:template name="top-level-collections">
473 <div id="top-level-collections">473 <div id="top-level-collections" title="top-level-collections">
474 <h2>Top-level collections</h2>474 <h2>Top-level collections</h2>
475475
476 <!--476 <!--
@@ -505,7 +505,7 @@
505505
506 <!-- Documentation for one top-level-collection -->506 <!-- Documentation for one top-level-collection -->
507 <xsl:template match="wadl:resource_type" mode="top-level-collections">507 <xsl:template match="wadl:resource_type" mode="top-level-collections">
508 <div id="{@id}" class="top-level-collection">508 <div id="{@id}" title="{@id}" class="top-level-collection">
509 <h3><xsl:call-template name="get-title-or-id"/></h3>509 <h3><xsl:call-template name="get-title-or-id"/></h3>
510 <xsl:apply-templates select="wadl:doc"/>510 <xsl:apply-templates select="wadl:doc"/>
511511
@@ -569,7 +569,7 @@
569569
570 <!-- Documentation for the standard methods on an entry -->570 <!-- Documentation for the standard methods on an entry -->
571 <xsl:template name="standard-methods">571 <xsl:template name="standard-methods">
572 <div id="{@id}-standard-methods" class="methods standard">572 <div id="{@id}-standard-methods" title="{@id}-standard-methods" class="methods standard">
573 <h4>Standard methods</h4>573 <h4>Standard methods</h4>
574 <dl>574 <dl>
575 <!-- Standard methods are the ones without a ws.op param. -->575 <!-- Standard methods are the ones without a ws.op param. -->
@@ -618,7 +618,7 @@
618 @name = 'GET'][.//wadl:param[@name = 'ws.op']]" />618 @name = 'GET'][.//wadl:param[@name = 'ws.op']]" />
619619
620 <xsl:if test="$operations">620 <xsl:if test="$operations">
621 <div id="{@id}-custom-GETs" class="methods GETs">621 <div id="{@id}-custom-GETs" title="{@id}-custom-GETs" class="methods GETs">
622 <h4>Custom GET methods</h4>622 <h4>Custom GET methods</h4>
623623
624 <xsl:apply-templates select="$operations">624 <xsl:apply-templates select="$operations">
@@ -634,7 +634,7 @@
634 @name = 'POST'][.//wadl:param[@name = 'ws.op']]" />634 @name = 'POST'][.//wadl:param[@name = 'ws.op']]" />
635635
636 <xsl:if test="$operations">636 <xsl:if test="$operations">
637 <div id="{@id}-custom-POSTs" class="methods POSTs">637 <div id="{@id}-custom-POSTs" title="{@id}-custom-POSTs" class="methods POSTs">
638 <h4>Custom POST methods</h4>638 <h4>Custom POST methods</h4>
639639
640 <xsl:apply-templates select="$operations">640 <xsl:apply-templates select="$operations">
@@ -646,7 +646,7 @@
646646
647 <!-- Container for all the entry types documentation -->647 <!-- Container for all the entry types documentation -->
648 <xsl:template name="entry-types">648 <xsl:template name="entry-types">
649 <h2 id="entry-types">Entry types</h2>649 <h2 id="entry-types" title="entry-types">Entry types</h2>
650650
651 <!-- Process all the resource_types, except the service-root ones,651 <!-- Process all the resource_types, except the service-root ones,
652 the type describing collections of that type,652 the type describing collections of that type,
@@ -670,7 +670,7 @@
670670
671 <!-- Documentation for one entry-type -->671 <!-- Documentation for one entry-type -->
672 <xsl:template match="wadl:resource_type" mode="entry-types">672 <xsl:template match="wadl:resource_type" mode="entry-types">
673 <h3 id="{@id}"><xsl:call-template name="get-title-or-id"/></h3>673 <h3 id="{@id}" title="{@id}"><xsl:call-template name="get-title-or-id"/></h3>
674 <xsl:apply-templates select="wadl:doc"/>674 <xsl:apply-templates select="wadl:doc"/>
675675
676 <xsl:call-template name="entry-uri-doc"/>676 <xsl:call-template name="entry-uri-doc"/>
@@ -814,7 +814,7 @@
814 <!-- Documentation for a custom method -->814 <!-- Documentation for a custom method -->
815 <xsl:template match="wadl:method[.//wadl:param[@name = 'ws.op']]">815 <xsl:template match="wadl:method[.//wadl:param[@name = 'ws.op']]">
816 <div class="method">816 <div class="method">
817 <h5 id="{@id}"><xsl:value-of817 <h5 id="{@id}" title="{@id}"><xsl:value-of
818 select=".//wadl:param[@name = 'ws.op']/@fixed"/></h5>818 select=".//wadl:param[@name = 'ws.op']/@fixed"/></h5>
819 <xsl:choose>819 <xsl:choose>
820 <xsl:when test="wadl:doc|wadl:request|wadl:response">820 <xsl:when test="wadl:doc|wadl:request|wadl:response">

Subscribers

People subscribed via source and target branches