build: use lefthook for pre-commit (#5248)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
update docs update nix-shell to auto install rework custom pre-commit hooks to integrate better add dockerfile for lefthook and integrate into drone add some more hooks for formatting and linting some files Co-authored-by: Darragh Elliott <me@delliott.net> Reviewed-on: #5248 Co-authored-by: delliott <delliott@fsfe.org> Co-committed-by: delliott <delliott@fsfe.org>
This commit was merged in pull request #5248.
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:import href="../../fsfe.xsl"/>
|
||||
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<!-- Dynamic list of quotes -->
|
||||
<!-- ==================================================================== -->
|
||||
|
||||
<xsl:template match="dynamic-content">
|
||||
<!-- First block of quotes, before the first divider -->
|
||||
<xsl:call-template name="quote-block"/>
|
||||
|
||||
<!-- Now, for each divider, ... -->
|
||||
<xsl:for-each select="/buildinfo/document/set/divider">
|
||||
<!-- ... first include the divider itself ... -->
|
||||
@@ -22,12 +17,9 @@
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<!-- A divider -->
|
||||
<!-- ==================================================================== -->
|
||||
|
||||
<xsl:template match="/buildinfo/document/set/divider">
|
||||
<xsl:element name="figure">
|
||||
<xsl:element name="img">
|
||||
@@ -37,79 +29,59 @@
|
||||
<xsl:attribute name="alt">
|
||||
<xsl:value-of select="normalize-space(text)"/>
|
||||
</xsl:attribute>
|
||||
</xsl:element><!-- img -->
|
||||
|
||||
</xsl:element>
|
||||
<!-- img -->
|
||||
<xsl:element name="figcaption">
|
||||
<xsl:apply-templates select="text/node()"/>
|
||||
</xsl:element><!-- figcaption -->
|
||||
</xsl:element><!-- figure -->
|
||||
|
||||
</xsl:element>
|
||||
<!-- figcaption -->
|
||||
</xsl:element>
|
||||
<!-- figure -->
|
||||
<xsl:element name="div">
|
||||
<xsl:attribute name="class">text-center</xsl:attribute>
|
||||
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="class">btn btn-success</xsl:attribute>
|
||||
<xsl:attribute name="href">https://my.fsfe.org/support</xsl:attribute>
|
||||
<xsl:call-template name="fsfe-gettext">
|
||||
<xsl:with-param name="id" select="'support/become'" />
|
||||
<xsl:with-param name="id" select="'support/become'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:element><!-- a -->
|
||||
</xsl:element><!-- div -->
|
||||
</xsl:element>
|
||||
<!-- a -->
|
||||
</xsl:element>
|
||||
<!-- div -->
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<!-- Number of quotes to fit between two dividers -->
|
||||
<!-- ==================================================================== -->
|
||||
|
||||
<xsl:variable name="blocksize" select="
|
||||
ceiling(
|
||||
count(/buildinfo/document/set/quote)
|
||||
div
|
||||
(count(/buildinfo/document/set/divider) + 1)
|
||||
)
|
||||
"/>
|
||||
|
||||
|
||||
<xsl:variable name="blocksize" select=" ceiling( count(/buildinfo/document/set/quote) div (count(/buildinfo/document/set/divider) + 1) ) "/>
|
||||
<!-- ==================================================================== -->
|
||||
<!-- A block of quotes between two dividers -->
|
||||
<!-- ==================================================================== -->
|
||||
|
||||
<xsl:template name="quote-block">
|
||||
<!-- Block number 0 is the block before the first divider, block n is the
|
||||
block following the n-th divider -->
|
||||
<xsl:param name="number">0</xsl:param>
|
||||
|
||||
<xsl:element name="ul">
|
||||
<xsl:attribute name="class">quote-list</xsl:attribute>
|
||||
<xsl:apply-templates select="/buildinfo/document/set/quote[
|
||||
position() > $number * $blocksize
|
||||
and
|
||||
position() <= ($number + 1) * $blocksize
|
||||
]"/>
|
||||
<xsl:apply-templates select="/buildinfo/document/set/quote[ position() > $number * $blocksize and position() <= ($number + 1) * $blocksize ]"/>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- ==================================================================== -->
|
||||
<!-- A single quote -->
|
||||
<!-- ==================================================================== -->
|
||||
|
||||
<xsl:template match="/buildinfo/document/set/quote">
|
||||
|
||||
<xsl:element name="blockquote">
|
||||
<xsl:attribute name="id">
|
||||
<xsl:value-of select="@id"/>
|
||||
</xsl:attribute>
|
||||
<xsl:element name="p">
|
||||
<xsl:apply-templates select="text/node()"/>
|
||||
</xsl:element>
|
||||
<xsl:element name="p">
|
||||
<xsl:element name="cite">
|
||||
<xsl:apply-templates select="name/node()"/>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
<xsl:element name="blockquote">
|
||||
<xsl:attribute name="id">
|
||||
<xsl:value-of select="@id"/>
|
||||
</xsl:attribute>
|
||||
<xsl:element name="p">
|
||||
<xsl:apply-templates select="text/node()"/>
|
||||
</xsl:element>
|
||||
<xsl:element name="p">
|
||||
<xsl:element name="cite">
|
||||
<xsl:apply-templates select="name/node()"/>
|
||||
</xsl:element>
|
||||
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
||||
Reference in New Issue
Block a user