Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1920 from Maks3w/hotfix/docbook-to-rst
Browse files Browse the repository at this point in the history
[Doc2Rst] Add missing blankline and exclude nested block elements when wrapping paragraphs
  • Loading branch information
ezimuel committed Jul 19, 2012
2 parents 47e00c7 + a51d940 commit 1649232
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bin/doc2rst.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,17 @@ public static function removeIndent($indent)
*/
public static function wrap($text)
{
return wordwrap($text, 115 - self::$indentation);
$output = '';
foreach (explode("\n", $text) as $line) {
if (substr($line, 0, 1) != ' ') {
$output .= wordwrap($line, 115 - self::$indentation);
} else {
$output .= $line;
}
$output .= "\n";
}

return substr($output, 0, -1);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions bin/doc2rst.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@
<xsl:template match="//doc:varlistentry/doc:listitem" priority="1">
<xsl:apply-templates mode="indent"/>
</xsl:template>
<!-- varlistentry/listitem/methodsynopsys -->
<xsl:template match="//doc:varlistentry/doc:listitem/doc:methodsynopsis" priority="1">
<xsl:call-template name="methodsynopsis"/>
<xsl:text>&#xA;</xsl:text>
</xsl:template>

<!--
#################
Expand Down

0 comments on commit 1649232

Please sign in to comment.