The Foundry CSS loader now supports alternative stylesheets

git-svn-id: https://svn.libreccm.org/ccm/trunk@3624 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2015-09-17 11:03:07 +00:00
parent cd0fab5723
commit 3267ae2c30
1 changed files with 49 additions and 8 deletions

View File

@ -107,6 +107,7 @@
select="foundry:get-attribute-value(current(), 'origin', '')"/> select="foundry:get-attribute-value(current(), 'origin', '')"/>
<xsl:with-param name="less" select="foundry:boolean(./@less)"/> <xsl:with-param name="less" select="foundry:boolean(./@less)"/>
<xsl:with-param name="less-onthefly" select="$less-onthefly"/> <xsl:with-param name="less-onthefly" select="$less-onthefly"/>
<xsl:with-param name="alternate" select="foundry:boolean(./@alternate)"/>
</xsl:call-template> </xsl:call-template>
</xsl:for-each> </xsl:for-each>
</xsl:when> </xsl:when>
@ -119,6 +120,7 @@
select="foundry:get-attribute-value(current(), 'origin', '')"/> select="foundry:get-attribute-value(current(), 'origin', '')"/>
<xsl:with-param name="less" select="foundry:boolean(./@less)"/> <xsl:with-param name="less" select="foundry:boolean(./@less)"/>
<xsl:with-param name="less-onthefly" select="$less-onthefly"/> <xsl:with-param name="less-onthefly" select="$less-onthefly"/>
<xsl:with-param name="alternate" select="foundry:boolean(./@alternate)"/>
</xsl:call-template> </xsl:call-template>
</xsl:for-each> </xsl:for-each>
</xsl:when> </xsl:when>
@ -131,6 +133,8 @@
select="foundry:get-attribute-value(current(), 'origin', '')"/> select="foundry:get-attribute-value(current(), 'origin', '')"/>
<xsl:with-param name="less" select="foundry:boolean(./@less)"/> <xsl:with-param name="less" select="foundry:boolean(./@less)"/>
<xsl:with-param name="less-onthefly" select="$less-onthefly"/> <xsl:with-param name="less-onthefly" select="$less-onthefly"/>
<xsl:with-param name="alternate" select="foundry:boolean(./@alternate)"/>
<xsl:with-param name="title" select="./@title"/>
</xsl:call-template> </xsl:call-template>
</xsl:for-each> </xsl:for-each>
</xsl:otherwise> </xsl:otherwise>
@ -256,33 +260,51 @@
<xsl:param name="origin" select="''"/> <xsl:param name="origin" select="''"/>
<xsl:param name="less" as="xs:boolean" select="false()"/> <xsl:param name="less" as="xs:boolean" select="false()"/>
<xsl:param name="less-onthefly" as="xs:boolean" select="false()"/> <xsl:param name="less-onthefly" as="xs:boolean" select="false()"/>
<xsl:param name="alternate" as="xs:boolean" select="false()"/>
<xsl:param name="title" select="''"/>
<xsl:choose> <xsl:choose>
<xsl:when test="contains($filename, '/')"> <xsl:when test="contains($filename, '/')">
<xsl:choose> <xsl:choose>
<xsl:when test="string-length($media) &gt; 0"> <xsl:when test="string-length($media) &gt; 0">
<link rel="{foundry:gen-style-rel-value($less, $less-onthefly)}" <link rel="{foundry:gen-style-rel-value($less,
$less-onthefly,
$alternate)}"
type="text/css" type="text/css"
href="{foundry:gen-path(foundry:gen-style-filename($less, href="{foundry:gen-path(foundry:gen-style-filename($less,
$less-onthefly, $less-onthefly,
$filename), $filename),
$origin)}" $origin)}"
media="{$media}"/> media="{$media}">
<xsl:if test="$alternate">
<xsl:attribute name="title"
select="foundry:get-static-text('', $title)"/>
</xsl:if>
</link>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<link rel="{foundry:gen-style-rel-value($less, $less-onthefly)}" <link rel="{foundry:gen-style-rel-value($less,
$less-onthefly,
$alternate)}"
type="text/css" type="text/css"
href="{foundry:gen-path(foundry:gen-style-filename($less, href="{foundry:gen-path(foundry:gen-style-filename($less,
$less-onthefly, $less-onthefly,
$filename), $filename),
$origin)}"/> $origin)}">
<xsl:if test="$alternate">
<xsl:attribute name="title"
select="foundry:get-static-text('', $title)"/>
</xsl:if>
</link>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:choose> <xsl:choose>
<xsl:when test="string-length($media) &gt; 0"> <xsl:when test="string-length($media) &gt; 0">
<link rel="{foundry:gen-style-rel-value($less, $less-onthefly)}" <link rel="{foundry:gen-style-rel-value($less,
$less-onthefly,
$alternate)}"
type="text/css" type="text/css"
href="{foundry:gen-path(concat('styles/', href="{foundry:gen-path(concat('styles/',
$media, $media,
@ -291,16 +313,28 @@
$less-onthefly, $less-onthefly,
$filename)), $filename)),
$origin)}" $origin)}"
media="{$media}" /> media="{$media}" >
<xsl:if test="$alternate">
<xsl:attribute name="title"
select="foundry:get-static-text('', $title)"/>
</xsl:if>
</link>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<link rel="{foundry:gen-style-rel-value($less, $less-onthefly)}" <link rel="{foundry:gen-style-rel-value($less,
$less-onthefly,
$alternate)}"
type="text/css" type="text/css"
href="{foundry:gen-path(concat('styles/', href="{foundry:gen-path(concat('styles/',
foundry:gen-style-filename($less, foundry:gen-style-filename($less,
$less-onthefly, $less-onthefly,
$filename)), $filename)),
$origin)}" /> $origin)}" >
<xsl:if test="$alternate">
<xsl:attribute name="title"
select="foundry:get-static-text('', $title)"/>
</xsl:if>
</link>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:otherwise> </xsl:otherwise>
@ -310,11 +344,18 @@
<xsl:function name="foundry:gen-style-rel-value"> <xsl:function name="foundry:gen-style-rel-value">
<xsl:param name="less" as="xs:boolean"/> <xsl:param name="less" as="xs:boolean"/>
<xsl:param name="less-onthefly" as="xs:boolean"/> <xsl:param name="less-onthefly" as="xs:boolean"/>
<xsl:param name="alternate" as="xs:boolean"/>
<xsl:choose> <xsl:choose>
<xsl:when test="$less and $less-onthefly and foundry:debug-enabled() and $alternate">
<xsl:value-of select="'alternate stylesheet/less'"/>
</xsl:when>
<xsl:when test="$less and $less-onthefly and foundry:debug-enabled()"> <xsl:when test="$less and $less-onthefly and foundry:debug-enabled()">
<xsl:value-of select="'stylesheet/less'"/> <xsl:value-of select="'stylesheet/less'"/>
</xsl:when> </xsl:when>
<xsl:when test="$alternate">
<xsl:value-of select="'alternate stylesheet'"/>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="'stylesheet'"/> <xsl:value-of select="'stylesheet'"/>
</xsl:otherwise> </xsl:otherwise>