Skip to content

Commit

Permalink
allow <pre> HTML elements in Luadoc via Lua.xsd
Browse files Browse the repository at this point in the history
MDN's web docs describe the "HTML <pre> elements represents preformatted
text which is to be presented exactly as written in the HTML file."

It's handy for formatting multiline code examples in
LuaDocumentation.xml.
  • Loading branch information
quietly-turning committed Jun 25, 2020
1 parent 89229ed commit c57279f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions Docs/Luadoc/Lua.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<xs:element name="Link" type="Link" />
<!-- HTML elements we want to let through. -->
<xs:element name="code" />
<xs:element name="pre" />
<xs:element name="br" />
<xs:element name="del" />
</xs:choice>
Expand Down
18 changes: 13 additions & 5 deletions Docs/Luadoc/Lua.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
font-family: monospace;
}
.descriptionText {
text-indent: 2em;
padding-left: 2em;
margin-top: 0;
margin-bottom: 0;
}
Expand Down Expand Up @@ -169,7 +169,7 @@
var listid = 'list_' + id;
var img = document.getElementById( imgid );
var list = document.getElementById( listid );

img.setAttribute( 'src', 'open.gif' );
list.style.display = 'block';
}
Expand All @@ -184,7 +184,7 @@
var listid = 'list_' + id;
var img = document.getElementById( imgid );
var list = document.getElementById( listid );

if( img.getAttribute('src') == 'closed.gif' )
{
img.setAttribute( 'src', 'open.gif' );
Expand All @@ -200,7 +200,7 @@
<link rel="icon" type="image/vnd.microsoft.icon" href="./favicon.ico"/>
</head>
<body>
<xsl:apply-templates />
<xsl:apply-templates />\
</body>
</html>
</xsl:template>
Expand Down Expand Up @@ -648,7 +648,7 @@
<xsl:sort select="@name" />
<tr class="code">
<td>

<xsl:value-of select="@name" />
</td>
<td><xsl:value-of select="@value" /></td>
Expand All @@ -670,6 +670,14 @@
</xsl:apply-templates>
</code>
</xsl:template>
<xsl:template match="sm:pre">
<xsl:param name="curclass" />
<pre>
<xsl:apply-templates>
<xsl:with-param name="curclass" select="$curclass" />
</xsl:apply-templates>
</pre>
</xsl:template>
<xsl:template match="sm:br"><br /></xsl:template>
<xsl:template match="sm:del">
<del>
Expand Down

0 comments on commit c57279f

Please sign in to comment.