Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made some modifications to the syntax of \code blocks

  • Loading branch information...
commit 34036512bcc5d30784b37abd3e5a78efdfdcda81 1 parent 929517d
@mattball authored
Showing with 51 additions and 50 deletions.
  1. +3 −5 css/common.css
  2. +12 −15 object.xslt
  3. +36 −30 object2html.xslt
View
8 css/common.css
@@ -122,7 +122,7 @@ table#metadata ul.inheritance li:last-of-type:after {
}
code {
- font-family: Monaco, 'Courier New', Courier, monospace;
+ font-family: Menlo, Monaco, 'Courier New', Courier, monospace;
font-size: 1.1em;
color: #333;
}
@@ -242,10 +242,8 @@ ul.methods li span.tooltipRegion:hover span.tooltip {
padding: 0;
}
-.programlisting {
- font-family: Monaco, Courier, monospace;
- font-size: 1.4em;
- color: rgb(102, 102, 102);
+code pre {
+ color: rgb(80, 80, 80);
line-height: 180%;
background-color: rgb(241, 245, 249);
border-color: rgb(199, 207, 213);
View
27 object.xslt
@@ -373,28 +373,25 @@
</xsl:if>
</xsl:template>
- <!-- Copy most of programlisting through unchanged -->
+ <!-- Copy most of programlisting through -->
<xsl:template match="programlisting">
- <programlisting>
+ <codeblock>
<xsl:apply-templates />
- </programlisting>
+ </codeblock>
</xsl:template>
-
- <!-- Remove 'ref' elements, but copy their content -->
- <xsl:template match="programlisting//ref">
- <xsl:apply-templates />
+
+ <xsl:template match="programlisting/codeline">
+ <xsl:apply-templates /><xsl:text>
+</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="programlisting//sp">
+ <xsl:text> </xsl:text>
</xsl:template>
<!-- Copy through other children of programlisting -->
<xsl:template match="programlisting//*">
- <xsl:copy>
- <xsl:apply-templates select="@*" />
<xsl:apply-templates />
- </xsl:copy>
- </xsl:template>
-
- <!-- Copy attributes by default -->
- <xsl:template match="@*">
- <xsl:copy />
</xsl:template>
+
</xsl:stylesheet>
View
66 object2html.xslt
@@ -442,6 +442,21 @@
</span>
</xsl:template>
+ <!-- Don't put the <code> tag for links inside a prototype -->
+ <xsl:template match="prototype//ref">
+ <xsl:choose>
+ <xsl:when test="/object/name != child::node()[1]">
+ <a>
+ <xsl:attribute name="href"><xsl:value-of select="@id"/>.html</xsl:attribute>
+ <xsl:apply-templates/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
<xsl:template match="parameters">
<h5>Parameters</h5>
<dl class="parameterList">
@@ -538,37 +553,28 @@
</code>
</xsl:template>
- <!-- Block for a programlisting -->
- <xsl:template match="programlisting">
- <div class="programlisting">
- <xsl:apply-templates />
- </div>
+ <!-- Block for a codeblock -->
+ <xsl:template match="codeblock">
+ <code>
+ <pre>
+ <xsl:apply-templates />
+ </pre>
+ </code>
</xsl:template>
-
- <!-- Render each line as a div -->
- <xsl:template match="codeline">
- <div class="codeline">
- <xsl:apply-templates />
- </div>
- </xsl:template>
-
- <!-- Print a literal space -->
- <xsl:template match="sp">
- <xsl:text> </xsl:text>
- </xsl:template>
-
- <!-- Copy the highlight class to a span -->
- <xsl:template match="highlight">
- <span>
- <xsl:attribute name="class">
- <xsl:value-of select="@class" />
- </xsl:attribute>
- <xsl:apply-templates />
- </span>
+
+ <!-- Don't put the <code> tag for links inside a codeblock -->
+ <xsl:template match="codeblock//ref">
+ <xsl:choose>
+ <xsl:when test="/object/name != child::node()[1]">
+ <a>
+ <xsl:attribute name="href"><xsl:value-of select="@id"/>.html</xsl:attribute>
+ <xsl:apply-templates/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
- <!-- Remove ref elements that are descendants of a codeline element -->
- <xsl:template match="codeline//ref">
- <xsl:apply-templates />
- </xsl:template>
</xsl:stylesheet>
Please sign in to comment.
Something went wrong with that request. Please try again.