r698 - in branches/jrst-docutils-jython/jrst/src/main: java/org/nuiton/jrst/legacy resources/xsl
Author: jpages Date: 2012-06-06 18:06:54 +0200 (Wed, 06 Jun 2012) New Revision: 698 Url: http://nuiton.org/repositories/revision/jrst/698 Log: Correction d'un probl?\195?\168me avec le parseur JRST et les subtitles. Correction des titres en dessous des subsections dans la feuille de style xsl rst2xdoc Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/legacy/JRSTLexer.java branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/legacy/JRSTReader.java branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xdoc.xsl Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/legacy/JRSTLexer.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/legacy/JRSTLexer.java 2012-06-06 12:31:17 UTC (rev 697) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/legacy/JRSTLexer.java 2012-06-06 16:06:54 UTC (rev 698) @@ -210,7 +210,7 @@ static final public String CHAR = "char"; static final public String ID = "id"; - + static final public String CLASSIFIERS = "classifiers"; static final public String DELIMITER = "delimiter"; Modified: branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/legacy/JRSTReader.java =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/legacy/JRSTReader.java 2012-06-06 12:31:17 UTC (rev 697) +++ branches/jrst-docutils-jython/jrst/src/main/java/org/nuiton/jrst/legacy/JRSTReader.java 2012-06-06 16:06:54 UTC (rev 698) @@ -400,7 +400,7 @@ protected static final String FOOTNOTES = "footnotes"; protected static final String ID = "id"; - + protected static final String INCLUDE = "include"; protected static final String LEVEL = "level"; @@ -808,8 +808,11 @@ skipBlankLine(lexer); // les commentaires - List<Element> comments = lexer.peekAllComment(); + List<Element> comments = lexer.peekAllComment(); + // skip blank line + skipBlankLine(lexer); + // le titre du doc item = lexer.peekTitle(); if (itemEquals(TITLE, item)) { @@ -1947,7 +1950,7 @@ copyLevel(item, result); copyLevel(item, title); title.addAttribute(ATTR_INLINE, TRUE).setText(item.getText().trim()); - result.addAttribute(ID, item.getText().replaceAll("\\W+", " ") + result.addAttribute(ATTR_IDS, item.getText().replaceAll("\\W+", " ") .trim().toLowerCase().replaceAll("\\W+", "-")); result.addAttribute(NAME, item.getText().toLowerCase().trim()); eTitle.add(title); Modified: branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xdoc.xsl =================================================================== --- branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xdoc.xsl 2012-06-06 12:31:17 UTC (rev 697) +++ branches/jrst-docutils-jython/jrst/src/main/resources/xsl/rst2xdoc.xsl 2012-06-06 16:06:54 UTC (rev 698) @@ -47,24 +47,24 @@ <xsl:template match="section"> <a name="{@ids}" id="{@ids}"></a> - <!--renommer names par name--> <xsl:choose> <xsl:when test="count(ancestor::section) = 0"> - <xsl:apply-templates/> - <!--xsl:element name="subsection"> + <xsl:element name="subsection"> <xsl:if test="@names"> - <xsl:attribute name="name"><xsl:value-of select="@names"/></xsl:attribute> + <xsl:attribute name="name"><xsl:value-of select="title"/></xsl:attribute> </xsl:if> <xsl:if test="@name"> - <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> + <xsl:attribute name="name"><xsl:value-of select="title"/></xsl:attribute> </xsl:if> <xsl:apply-templates/> - </xsl:element--> + </xsl:element> </xsl:when> - <xsl:when test="count(ancestor::section) = 1"> - <!--remplacer la balise section par subsection--> - <!--xsl:element name="h{count(ancestor::section) + 2}"> - </xsl:element--> + <xsl:when test="count(ancestor::section) >= 1"> + <!--There are only 2 levels of section/subsection, so after we use + <h4>, <h5>, etc... for titles--> + <xsl:element name="h{count(ancestor::section) + 3}"> + <xsl:value-of select="title"/> + </xsl:element> <xsl:apply-templates/> </xsl:when> </xsl:choose> @@ -73,24 +73,12 @@ <xsl:template match="title"> <xsl:choose> <xsl:when test="count(ancestor::section) >= 1"> - <!--remplacer la balise section par subsection--> - <xsl:element name="h{count(ancestor::section) + 2}"> - <xsl:apply-templates/> - </xsl:element> + <!-- If there is a subsection, don't display the title twice + ( so we must do nothing) --> </xsl:when> </xsl:choose> </xsl:template> - <!--xsl:template match="reference"> - <xsl:if test="@refid"> - <a href="{@refuri}#{@refid}" id="{@ids}"><xsl:apply-templates/></a> - </xsl:if> - <xsl:if test="not(@refid)"> - <a href="{@refuri}" id="{@refuri}"><xsl:apply-templates/></a> - </xsl:if> - </xsl:template--> - - <!-- #286 : Régression sur la génération des méta-données TODO peut etre que les xsl de xhtml et xdoc devrait être indépendante --> <xsl:template match="docinfo">
participants (1)
-
jpages@users.nuiton.org