my %opt = parse_arguments();
## Generate the pages
+my %cache; # General cache object
do_doc( 'spec', $_ ) foreach @{ $opt{spec} || [] };
do_doc( 'filter', $_ ) foreach @{ $opt{filter} || [] };
do_web() if exists $opt{web};
## Add the current version of Exim to the XML
$xml->documentElement()->appendTextChild( 'current_version', $opt{latest} );
+ ## Add the old versions of Exim to the XML
+ $xml->documentElement()->appendTextChild( 'old_versions', $_ ) foreach old_docs_versions();
+
## Parse the ".xsl" file as XML
my $xsl = XML::LibXML->new()->parse_file($xsl_path) or die $!;
close $out;
}
+## Look in the docroot for old versions of the documentation
+sub old_docs_versions {
+ if( !exists $cache{old_docs_versions} ){
+ my @versions;
+ foreach( glob("$opt{docroot}/exim-html-*") ){
+ push @versions, $1 if /-(\d+(?:\.\d+)?)$/ && $1 < $opt{latest} && -d $_;
+ }
+ $cache{old_docs_versions} = [reverse sort {$a<=>$b} @versions];
+ }
+ return @{$cache{old_docs_versions}};
+}
+
## error_help
sub error_help {
my $msg = shift;
--- /dev/null
+body.no-js p.manual_info select {
+ display: none;
+}
--- /dev/null
+(function($){
+ $('p.manual_info select').each(function(){
+ $(this).change(function(e){
+ if( $(this).val().match(/^[0-9\.]+$/) ){
+ var href = $(this).parent().find('a').attr('href').replace('-current/','-'+$(this).val()+'/');
+ document.location.href=href;
+ }
+ });
+ });
+})(jQuery);
<!-- Title -->
<xsl:variable name="html.head.title" select="'Documentation for Exim'"/>
- <!-- Canonical -->
- <xsl:variable name="html.head.append">
- <link rel="canonical" href="http://www.exim.org/docs.html"/>
- </xsl:variable>
+
+ <xsl:variable name="html.head.append">
+
+ <!-- Canonical -->
+ <link rel="canonical" href="http://www.exim.org/docs.html"/>
+
+ <!-- CSS -->
+ <link rel="stylesheet" type="text/css" href="docs.css"/>
+ </xsl:variable>
+
+ <!-- JavaScript -->
+ <xsl:variable name="html.body.append">
+ <script type="text/javascript" src="docs.js"/>
+ </xsl:variable>
<!-- CONTENT -->
<xsl:template name="content">
<xsl:text> - The master documentation for Exim containing all required detail to install, configure and use Exim. </xsl:text>
<span class="changed">Changes to the documentation (normally reflecting changes to the functionality of Exim) are shown on a green background like this segment.</span>
+ <br/><select name="spec_old_version">
+ <option value="">View Older Versions</option>
+ <xsl:for-each select="/content/old_versions">
+ <option value="{text()}"><xsl:value-of select="text()"/></option>
+ </xsl:for-each>
+ </select>
</p>
<p class="manual_info">
<xsl:text> </xsl:text>
<a href="{$docroot}/exim-pdf-current/doc/filter.pdf">(PDF)</a>
<xsl:text> - Additional information on the Exim filter language.</xsl:text>
+ <br/><select name="filter_old_version">
+ <option value="">View Older Versions</option>
+ <xsl:for-each select="/content/old_versions">
+ <option value="{text()}"><xsl:value-of select="text()"/></option>
+ </xsl:for-each>
+ </select>
</p>
<!-- HOWTOs -->