Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation of the man page should be done in two phases #484

Closed
eric-brechemier opened this issue Jan 31, 2017 · 3 comments
Closed

Generation of the man page should be done in two phases #484

eric-brechemier opened this issue Jan 31, 2017 · 3 comments

Comments

@eric-brechemier
Copy link
Contributor

Currently, the XSLT stylesheet tidy1.xsl.in mixes two responsibilities: transforming the XML options structures to the man page structure (grammatical level) and formatting of text using troff commands (lexical level).

The transformation should be done in two phases:

  1. convert options XML to 'man XML' (custom XML tags that represent the structure of a man page)
  2. convert 'man XML' to man text format

For example:

Before

<xsl:template name="seealso">
  <xsl:if test="seealso">
    <xsl:text>
</xsl:text>
See also: <xsl:text />
    <xsl:for-each select="seealso">
      <xsl:text />\fB--<xsl:value-of select="." />\fR<xsl:text />
      <xsl:if test="position() != last()">
        <xsl:text>, </xsl:text>
      </xsl:if>
    </xsl:for-each>
  </xsl:if>
</xsl:template>

After

Phase 1

<xsl:template name="seealso">
  <xsl:if test="seealso">
    <br />
    <span>See also: </span>
    <xsl:for-each select="seealso">
      <bold><xsl:value-of select="." /></bold>
      <xsl:if test="position() != last()">
        <span>, </span>
      </xsl:if>
    </xsl:for-each>
  </xsl:if>
</xsl:template>

Phase 2

<xsl:template match="br">
  <xsl:text>&#xA;</xsl:text>
</xsl:template>

<xsl:template match="span">
  <xsl:value-of select="." />
</xsl:template>

<xsl:template match="bold">
  <bold><xsl:value-of select="." /></bold>
</xsl:template>
@balthisar
Copy link
Member

A PR would be welcome!

@eric-brechemier
Copy link
Contributor Author

@balthisar that's the plan ;)

@balthisar
Copy link
Member

Since we're awaiting a PR, and there's no actual bug or support request here, I'll clear this from the stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants