Skip to content

Commit

Permalink
Generated techniques cleanup and automation improvements
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 113531a
Author: Michael Cooper <cooper@w3.org>
Date:   Tue Sep 4 14:16:15 2018 -0400

    incorporate includes into understanding and techniques index

commit e9b8f46
Author: Michael Cooper <cooper@w3.org>
Date:   Tue Sep 4 13:40:08 2018 -0400

    take understanding and techniques index out of respec

commit d46b1fe
Author: Michael Cooper <cooper@w3.org>
Date:   Thu Aug 30 22:33:08 2018 -0400

    start to support different URIs for links based on build context

commit d31599a
Author: Michael Cooper <cooper@w3.org>
Date:   Thu Aug 30 20:45:51 2018 -0400

    split output dir of techniques and understanding

commit 959d469
Author: Michael Cooper <cooper@w3.org>
Date:   Thu Aug 30 19:10:34 2018 -0400

    Improved technique link detection and standardization

commit 08006fd
Author: Michael Cooper <cooper@w3.org>
Date:   Thu Aug 30 09:48:46 2018 -0400

    update stock applicability statements and outdated technology disclaimer
  • Loading branch information
Michael Cooper committed Sep 5, 2018
1 parent 3713af0 commit eb01cb2
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 34 deletions.
54 changes: 41 additions & 13 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<makeurl file="${basedir}/guidelines/" property="base.guidelines"/>
<xslt in="${inputdir.guidelines}/index.html" out="${inputdir.guidelines}/index-flat.html" style="xslt/flatten-document.xslt">
<factory name="${xslt.factory}"/>
<param name="base" expression="${base.guidelines}"/>
<param name="base.dir" expression="${base.guidelines}"/>
</xslt>
</target>

Expand Down Expand Up @@ -115,18 +115,29 @@
<target name="techniques" depends="techniques-list, techniques-association">
<makeurl file="${basedir}/techniques/" property="base.techniques"/>
<makeurl file="${basedir}/techniques/technique-associations.xml" property="associations.file"/>
<mkdir dir="${basedir}/output/"/>
<makeurl file="${basedir}/output/" property="output.dir"/>
<mkdir dir="${basedir}/output/techniques/"/>
<local name="output.dir"/>
<makeurl file="${basedir}/output/techniques/" property="output.dir"/>
<echo message="Outputting Techniques to ${output.dir}"/>
<xslt in="${inputdir.techniques}/techniques.xml" out="output.html" style="xslt/generate-techniques.xslt" force="true">
<factory name="${xslt.factory}"/>
<param name="techniques.dir" expression="${base.techniques}"/>
<param name="associations.file" expression="${associations.file}"/>
<param name="output.dir" expression="${output.dir}"/>
<param name="loc.guidelines" expression="https://www.w3.org/TR/WCAG21/" if="publication"/>
<param name="loc.understanding" expression="https://www.w3.org/WAI/WCAG21/Understanding/" if="publication"/>
<param name="loc.techniques" expression="https://www.w3.org/WAI/WCAG21/Techniques/" if="publication"/>
<param name="loc.guidelines" expression="https://w3c.github.io/wcag/guidelines/" if="editors"/>
<param name="loc.understanding" expression="https://w3c.github.io/wcag/understanding/" if="editors"/>
<param name="loc.techniques" expression="https://w3c.github.io/wcag/techniques/" if="editors"/>
</xslt>
<copy file="techniques/techniques.css" todir="output/"/>
<copy file="css/slicenav.css" todir="output/"/>
<copy todir="output/">
<xslt in="${inputdir.techniques}/index.html" out="${basedir}/output/techniques/" style="xslt/flatten-document.xslt">
<factory name="${xslt.factory}"/>
<param name="base.dir" expression="${base.techniques}"/>
</xslt>
<copy file="techniques/techniques.css" todir="output/techniques/"/>
<copy file="css/slicenav.css" todir="output/techniques/"/>
<copy todir="output/techniques/">
<fileset dir="techniques" includes="**/img/*"/>
</copy>
</target>
Expand All @@ -138,19 +149,30 @@
</target>

<!-- Understanding -->
<target name="understanding" depends="guidelines-xml" description="Generate formatted Understanding docs">
<target name="understanding" depends="guidelines-xml, techniques-list" description="Generate formatted Understanding docs">
<makeurl file="${basedir}/understanding/" property="base.understanding"/>
<mkdir dir="${basedir}/output/"/>
<makeurl file="${basedir}/output/" property="output.dir"/>
<mkdir dir="${basedir}/output/understanding/"/>
<local name="output.dir"/>
<makeurl file="${basedir}/output/understanding/" property="output.dir"/>
<echo message="Outputting Understanding to ${output.dir}"/>
<xslt in="${inputdir.guidelines}/wcag.xml" out="output.html" style="xslt/generate-understanding.xslt" force="true">
<factory name="${xslt.factory}"/>
<param name="base.dir" expression="${base.understanding}"/>
<param name="output.dir" expression="${output.dir}"/>
<param name="loc.guidelines" expression="https://www.w3.org/TR/WCAG21/" if="publication"/>
<param name="loc.understanding" expression="https://www.w3.org/WAI/WCAG21/Understanding/" if="publication"/>
<param name="loc.techniques" expression="https://www.w3.org/WAI/WCAG21/Techniques/" if="publication"/>
<param name="loc.guidelines" expression="https://w3c.github.io/wcag/guidelines/" if="editors"/>
<param name="loc.understanding" expression="https://w3c.github.io/wcag/understanding/" if="editors"/>
<param name="loc.techniques" expression="https://w3c.github.io/wcag/techniques/" if="editors"/>
</xslt>
<xslt in="${inputdir.understanding}/index.html" out="${basedir}/output/understanding//index.html" style="xslt/flatten-document.xslt">
<factory name="${xslt.factory}"/>
<param name="base.dir" expression="${base.understanding}"/>
</xslt>
<copy file="understanding/understanding.css" todir="output/"/>
<copy file="css/slicenav.css" todir="output/"/>
<copy todir="output/img/">
<copy file="understanding/understanding.css" todir="output/understanding/"/>
<copy file="css/slicenav.css" todir="output/understanding/"/>
<copy todir="output/understanding/img/">
<fileset dir="understanding/21/img"/>
</copy>
</target>
Expand All @@ -162,7 +184,13 @@
</target>

<!-- Publish -->
<target name="publish" description="Publish resources to w3c">
<target name="publish-w3c" description="Publish resources to w3c">
<property name="publication" value="true"/>
<antcall target="techniques"/>
<antcall target="understanding"/>
<copy todir="../../../smartcvs/WWW/WAI/WCAG21/">
<fileset dir="output"/>
</copy>
<copy todir="../../../smartcvs/WWW/WAI/WCAG21/working-examples/">
<fileset dir="working-examples/"/>
<globmapper from="*index.html" to="*Overview.html"/>
Expand Down
47 changes: 47 additions & 0 deletions xslt/base.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
exclude-result-prefixes="xs"
version="2.0">

<xsl:param name="loc.guidelines">/guidelines/</xsl:param>
<xsl:param name="loc.understanding">/understanding/</xsl:param>
<xsl:param name="loc.techniques">/techniques/</xsl:param>

<xsl:param name="techniques.file">../techniques/techniques.xml</xsl:param>
<xsl:variable name="techniques.doc" select="document($techniques.file)"/>

<xsl:function name="wcag:isheading" as="xs:boolean">
<xsl:param name="el"/>
<xsl:choose>
Expand Down Expand Up @@ -33,6 +40,46 @@
</xsl:analyze-string>
</xsl:function>

<xsl:function name="wcag:is-technique-link" as="xs:boolean">
<xsl:param name="link"/>
<xsl:choose>
<xsl:when test="$link/@class and index-of(('aria', 'client-side-script', 'css', 'failure', 'failures', 'flash', 'general', 'html', 'pdf', 'server-side-script', 'silverlight', 'smil', 'text', 'technqiues'), $link/@class)"><xsl:value-of select="true()"/></xsl:when>
<xsl:when test="starts-with($link/@href, 'https://www.w3.org/WAI/WCAG21/Techniques/')"><xsl:value-of select="true()"/></xsl:when>
<xsl:when test="starts-with($link/@href, 'https://w3c.github.io/techniques/')"><xsl:value-of select="true()"/></xsl:when>
<xsl:when test="starts-with($link/@href, 'https://rawgit.com/w3c/wcag/') and contains($link/@href, '/techniques/')"><xsl:value-of select="true()"/></xsl:when>
<xsl:when test="starts-with($link/@href, '../') and contains($link/@href, '/techniques/')"><xsl:value-of select="true()"/></xsl:when>
<xsl:otherwise><xsl:value-of select="false()"/></xsl:otherwise>
</xsl:choose>
</xsl:function>

<xsl:template match="html:a[wcag:is-technique-link(.)]">
<xsl:variable name="technique-id" select="replace(@href, '^.*/([\w\d]*)$', '$1')"/>
<xsl:choose>
<xsl:when test="$technique-id">
<xsl:variable name="technique" select="$techniques.doc//technique[@id = $technique-id]"/>
<xsl:copy>
<xsl:apply-templates select="@*[not(name() = 'href')]"/>
<xsl:attribute name="href">
<xsl:value-of select="$loc.techniques"/>
<xsl:value-of select="$technique/parent::technology/@name"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="$technique-id"/>
</xsl:attribute>
<xsl:value-of select="$technique-id"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="$technique/title"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:text>IN DEVELOPMENT: </xsl:text>
<xsl:apply-templates/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="html:p[@class = 'note'] | html:div[@class = 'note']">
<div class="note">
<div role="heading" class="note-title marker" aria-level="{count(ancestor::html:section) + 2}">Note</div>
Expand Down
16 changes: 3 additions & 13 deletions xslt/generate-techniques.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
<xsl:param name="output.dir">output/</xsl:param>
<xsl:param name="associations.file">technique-assocations.xml</xsl:param>
<xsl:param name="guidelines.meta.file">../guidelines/wcag.xml</xsl:param>
<xsl:param name="loc.guidelines">https://www.w3.org/TR/WCAG21/</xsl:param>
<xsl:param name="loc.understanding">https://www.w3.org/WAI/WCAG21/Understanding/</xsl:param>
<xsl:param name="loc.techniques">https://www.w3.org/WAI/WCAG21/Techniques/</xsl:param>

<xsl:variable name="associations.doc" select="document($associations.file)"/>
<xsl:variable name="guidelines.meta.doc" select="document($guidelines.meta.file)"/>
Expand Down Expand Up @@ -259,7 +256,7 @@
<p>Content implemented in <a href="https://www.w3.org/TR/SMIL/">Synchronized Multimedia Integration Language (SMIL)</a>.</p>
</xsl:when>
<xsl:when test="$technology = 'text'">
<p>Content implemented in plain text without use of a structure technology.</p>
<p>Content implemented in plain text, including Markdown and similar formats, without use of a structure technology.</p>
</xsl:when>
</xsl:choose>
</xsl:otherwise>
Expand All @@ -270,13 +267,13 @@
<xsl:when test="$technology = 'flash'">
<div class="note">
<div role="heading" class="note-title marker" aria-level="3">Note</div>
<p>Accessibility of Flash is no longer supported by Adobe. Authors are advised to implement content using another technology.</p>
<p>Adobe has plans to stop updating and distributing the Flash Player at the end of 2020, and encourages authors interested in creating accessible web content to use HTML.</p>
</div>
</xsl:when>
<xsl:when test="$technology = 'silverlight'">
<div class="note">
<div role="heading" class="note-title marker" aria-level="3">Note</div>
<p>Accessibility of Silverlight is no longer supported by Microsoft. Authors are advised to implement content using another technology.</p>
<p>Microsoft has stopped updating and distributing Silverlight, and authors are encouraged to use HTML for accessible web content.</p>
</div>
</xsl:when>
</xsl:choose>
Expand Down Expand Up @@ -448,13 +445,6 @@
</xsl:element>
</xsl:template>

<xsl:template match="html:a[not(node()) and starts-with(@href, 'https://www.w3.org/WAI/WCAG21/Techniques/')]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:value-of select="replace(@href, '^.*/([\w\d]*)$', '$1')"/>
</xsl:copy>
</xsl:template>

<xsl:template match="html:a[not(@href)]">
<xsl:param name="meta" tunnel="yes"/>
<xsl:variable name="dfn" select="lower-case(.)"/>
Expand Down
8 changes: 0 additions & 8 deletions xslt/generate-understanding.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<xsl:param name="base.dir">understanding/</xsl:param>
<xsl:param name="output.dir">output/</xsl:param>
<xsl:param name="loc.guidelines">https://www.w3.org/TR/WCAG21/</xsl:param>

<xsl:template name="name">
<xsl:param name="meta" tunnel="yes"/>
Expand Down Expand Up @@ -357,13 +356,6 @@
</xsl:element>
</xsl:template>

<xsl:template match="html:a[not(node()) and starts-with(@href, 'https://www.w3.org/WAI/WCAG21/Techniques/')]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:value-of select="replace(@href, '^.*/([\w\d]*)$', '$1')"/>
</xsl:copy>
</xsl:template>

<xsl:template match="html:a[not(@href)]">
<xsl:param name="meta" tunnel="yes"/>
<xsl:variable name="dfn" select="lower-case(.)"/>
Expand Down

0 comments on commit eb01cb2

Please sign in to comment.