->appendTextChild( 'canonical_url',
"${canonical_url}exim-html-current/doc/html/spec_html/" . ( $type eq 'spec' ? 'index' : 'filter' ) . ".html" );
+ ## Add a url for the latest version of this document
+ if( $version ne $opt{latest} ){
+ $xml->documentElement()
+ ->appendTextChild( 'current_url',
+ "../../../../exim-html-current/doc/html/spec_html/" . ( $type eq 'spec' ? 'index' : 'filter' ) . ".html" );
+ }
+
## Fixup the XML
xref_fixup( $xml, $prepend_chapter );
$prepend_chapter, $counter
)
);
+ if( $version ne $opt{latest} ){
+ $chapter->appendTextChild(
+ 'current_url',
+ sprintf(
+ '../../../../exim-html-current/doc/html/spec_html/%sch%02d.html',
+ $prepend_chapter, $counter
+ )
+ );
+ }
}
## Create an XML document from the chapter
<!-- Chapter Wrapper -->
<div id="chapter" class="chapter{@class}">
+ <xsl:if test="current_url">
+ <p id="old_version_warning">
+ <span class="closebar"><a href="#" title="Close">X</a></span>
+ <strong>WARNING:</strong>
+ <xsl:text> This documentation is for an old version of Exim (</xsl:text>
+ <a href="{current_url}">latest</a>
+ <xsl:text>)</xsl:text>
+ </p>
+ </xsl:if>
+
<!-- Chapter Title -->
<h2 id="{@id}" class="{@class}">
<xsl:value-of select="concat('Chapter ',chapter_id,' - ',title)"/>
</xsl:template>
<!-- Ignore -->
- <xsl:template match="chapter_id|prev_url|next_url|canonical_url"/>
+ <xsl:template match="chapter_id|prev_url|next_url|canonical_url|current_url"/>
</xsl:stylesheet>
<!-- CONTENT -->
<xsl:template match="/book">
+ <xsl:if test="current_url">
+ <p id="old_version_warning">
+ <strong>WARNING:</strong>
+ <xsl:text> This documentation is for an old version of Exim (</xsl:text>
+ <a href="{current_url}">latest</a>
+ <xsl:text>)</xsl:text>
+ </p>
+ </xsl:if>
<div id="info">
<xsl:apply-templates select="bookinfo"/>
</div>
<div id="options" class="hidden">
<img src="{$docroot}/doc/plus-12x12.png" width="12" height="12" class="expand"/>
<img src="{$docroot}/doc/minus-12x12.png" width="12" height="12" class="collapse"/>
- <xsl:text>Expand/Collapse all Chapters</xsl:text>
+ <xsl:text>Expand/Collapse all Chapters</xsl:text>
</div>
<div id="index">
<ul id="chapters">
+#old_version_warning {
+ text-align: center;
+ padding: 0.1em;
+ margin: 0;
+ font-size: 1.4em;
+}
+
+body.with-js #old_version_warning {
+ display: none;
+ text-align: left;
+ position: fixed;
+ top: 20%;
+ left: 30%;
+ width: 40%;
+ background-color: #fff;
+ border: 1px solid #000;
+ padding: 1em;
+ z-index: 10000;
+}
+
+#old_version_warning span.closebar {
+ float: right;
+ position: relative;
+ right: -0.5em;
+ top: -0.5em;
+}
+
+#old_version_warning span.closebar a {
+ text-decoration: none;
+}
+
+body.no-js #old_version_warning span.closebar {
+ display: none;
+}
+
.previous_page, .next_page {
font-size: 1.2em;
}
+// Warnings about reading old version of documentation
+(function ($) {
+ if( $.grep( document.cookie.split(/\s*;\s*/), function(a){return a === 'old_version_warning_removed=true' ? true : false }).length === 0 ){
+ $('#old_version_warning')
+ .show()
+ .find('span.closebar a')
+ .click(function(e){
+ $('#old_version_warning').remove();
+ document.cookie="old_version_warning_removed=true";
+ e.preventDefault();
+ });
+ }
+})(jQuery);
+
// Sidebar table of contents
(function ($) {
+#old_version_warning {
+ text-align: center;
+ padding: 0.1em;
+ margin: 0;
+ font-size: 1.4em;
+}
+
#options {
padding: 1em 0 0 2em;
}
<xsl:copy-of select="$html.head.append"/>
</head>
- <body>
+ <body class="no-js">
+ <!-- Changed body classname from "no-js" to "with-js" for styling purposes -->
+
+ <script type="text/javascript"><![CDATA[document.body.className=(' '+document.body.className+' ').replace('no-js','with-js');]]></script>
<!-- Header -->