Magic to use absolute URLs for pages used by an external web server.
svn path=/trunk/; revision=19503
This commit is contained in:
parent
9e202c9daf
commit
2b1e52de4d
38
fsfe.xsl
38
fsfe.xsl
@ -43,22 +43,43 @@
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
<link rel="stylesheet" media="all" href="/look/generic.css" type="text/css" />
|
||||
<link rel="stylesheet" media="print" href="/look/print.css" type="text/css" />
|
||||
<!-- For pages used on external web servers, load the CSS from absolute URL -->
|
||||
<xsl:variable name="urlprefix"><xsl:if test="/buildinfo/document/@external">https://www.fsfe.org</xsl:if></xsl:variable>
|
||||
<xsl:element name="link">
|
||||
<xsl:attribute name="rel">stylesheet</xsl:attribute>
|
||||
<xsl:attribute name="media">all</xsl:attribute>
|
||||
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/generic.css</xsl:attribute>
|
||||
<xsl:attribute name="type">text/css</xsl:attribute>
|
||||
</xsl:element>
|
||||
<xsl:element name="link">
|
||||
<xsl:attribute name="rel">stylesheet</xsl:attribute>
|
||||
<xsl:attribute name="media">print</xsl:attribute>
|
||||
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/print.css</xsl:attribute>
|
||||
<xsl:attribute name="type">text/css</xsl:attribute>
|
||||
</xsl:element>
|
||||
<xsl:if test="/buildinfo/@language='ar'">
|
||||
<link rel="stylesheet" media="all" href="/look/rtl.css" type="text/css" />
|
||||
<xsl:element name="link">
|
||||
<xsl:attribute name="rel">stylesheet</xsl:attribute>
|
||||
<xsl:attribute name="media">all</xsl:attribute>
|
||||
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/rtl.css</xsl:attribute>
|
||||
<xsl:attribute name="type">text/css</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<link rel="shortcut icon" href="/graphics/fsfe.ico" type="image/x-icon" />
|
||||
<xsl:element name="link">
|
||||
<xsl:attribute name="rel">shortcut_icon</xsl:attribute>
|
||||
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/graphics/fsfe.ico</xsl:attribute>
|
||||
<xsl:attribute name="type">image/x-icon</xsl:attribute>
|
||||
</xsl:element>
|
||||
<xsl:element name="link">
|
||||
<xsl:attribute name="rel">alternate</xsl:attribute>
|
||||
<xsl:attribute name="title">FSFE <xsl:call-template name="fsfe-gettext"><xsl:with-param name="id" select="'menu1/news'" /></xsl:call-template></xsl:attribute>
|
||||
<xsl:attribute name="href">/news/news.<xsl:value-of select="/buildinfo/@language" />.rss</xsl:attribute>
|
||||
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/news/news.<xsl:value-of select="/buildinfo/@language"/>.rss</xsl:attribute>
|
||||
<xsl:attribute name="type">application/rss+xml</xsl:attribute>
|
||||
</xsl:element>
|
||||
<xsl:element name="link">
|
||||
<xsl:attribute name="rel">alternate</xsl:attribute>
|
||||
<xsl:attribute name="title">FSFE <xsl:call-template name="fsfe-gettext"><xsl:with-param name="id" select="'menu1/events'" /></xsl:call-template></xsl:attribute>
|
||||
<xsl:attribute name="href">/events/events.<xsl:value-of select="/buildinfo/@language" />.rss</xsl:attribute>
|
||||
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/events/events.<xsl:value-of select="/buildinfo/@language"/>.rss</xsl:attribute>
|
||||
<xsl:attribute name="type">application/rss+xml</xsl:attribute>
|
||||
</xsl:element>
|
||||
<script type="text/javascript" src="/scripts/jquery.js"></script>
|
||||
@ -157,6 +178,9 @@
|
||||
<xsl:template match="body">
|
||||
<xsl:copy>
|
||||
|
||||
<!-- For pages used on external web servers, use absolute URLs -->
|
||||
<xsl:variable name="urlprefix"><xsl:if test="/buildinfo/document/@external">https://www.fsfe.org</xsl:if></xsl:variable>
|
||||
|
||||
<!-- First of all, a comment to make clear this is generated -->
|
||||
<xsl:comment>This file was generated by an XSLT script. Please do not edit.</xsl:comment>
|
||||
|
||||
@ -203,7 +227,7 @@
|
||||
<xsl:attribute name="href">/</xsl:attribute>
|
||||
<xsl:element name="img">
|
||||
<xsl:attribute name="alt">FSFE Logo</xsl:attribute>
|
||||
<xsl:attribute name="src">/graphics/logo.png</xsl:attribute>
|
||||
<xsl:attribute name="src"><xsl:value-of select="$urlprefix"/>/graphics/logo.png</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
|
@ -676,6 +676,10 @@ sub process {
|
||||
}
|
||||
# replace anchor
|
||||
$href .= $anchor;
|
||||
# For pages running on an external server, use full URL
|
||||
if ($document->getAttribute("external")) {
|
||||
$href = "http://www.fsfe.org$href";
|
||||
}
|
||||
$_->setAttribute("href", $href);
|
||||
}
|
||||
}
|
||||
@ -755,6 +759,9 @@ sub clone_document {
|
||||
my $n = $_->cloneNode(1);
|
||||
$doc->appendChild($n);
|
||||
}
|
||||
if ($sourcedoc->documentElement->getAttribute("external")) {
|
||||
$doc->setAttribute("external", "yes");
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user