Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions lib/LaTeXML/Package/acmart.cls.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,18 @@ DefMacro('\subtitle{}', '\@add@frontmatter{ltx:subtitle}{#1}');
DefMacro('\keywords{}', '\@add@frontmatter{ltx:keywords}{#1}');
DefMacro('\terms{}', '\@add@frontmatter{ltx:keywords}{#1}');

# Accessible figure descriptions
NewCounter('acmlabel');
DefConstructor('\Description[]{}', '^^<ltx:note xml:id="#id" class="ltx_nodisplay">#1</ltx:note>',
properties => sub { ('width' => Dimension(0), 'height' => Dimension(0), RefStepCounter('acmlabel')) },
beforeConstruct => sub {
my ($document, $whatsit) = @_;
# TODO: Is there something useful to do with the short description in our schema?
my $figure = $document->getElement;
$document->setAttribute($figure, 'aria:labelledby', $whatsit->getProperty('id'));
return; });
# Accessible figures: \Description[alternate text]{long descriptions}
DefConstructor('\Description[]{}', sub {
my ($document, $alt, $desc) = @_;
# Could this apply to other than figure?
if (my $savenode = $document->floatToElement('ltx:figure')) {
$document->insertElement('ltx:alternate-text', $alt) if defined $alt;
$document->insertElement('ltx:long-description', $desc) if defined $desc;
$document->setNode($savenode); }
else {
Warn('expected','figure',$document, "No figure was found for the \\Description"); }
return; },
sizer => 0);

# Use multiple style, repeating \author, \orcid, \affiliation, \email as needed.
DefConstructor('\@@@affiliation{}', "^ <ltx:contact role='affiliation'>#1</ltx:contact>");
Expand Down
5 changes: 4 additions & 1 deletion lib/LaTeXML/resources/CSS/LaTeXML.css
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ span.ltx_framed { display:inline-block; text-indent:0; } /* avoid padding/
.ltx_missing { color:red;}
.ltx_nounicode { color:red; }
.ltx_nodisplay { display:none; }
.ltx_alternate-text,
.ltx_long-description
{ display:none; }
/*======================================================================
SVG (pgf/tikz & xy) basics
*/
Expand Down Expand Up @@ -604,4 +607,4 @@ cite { font-style: normal; }
[style*="--ltx-stroke-color:"] {
stroke: var(--fn-stroke-color-to-dark-mode);
}
}
}
33 changes: 32 additions & 1 deletion lib/LaTeXML/resources/RelaxNG/LaTeXML-meta.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ default namespace = "http://dlmf.nist.gov/LaTeXML"

## Meta elements are generally hidden;
## they can appear in both inline and block contexts.
Meta.class |= note | declare | indexmark | glossarydefinition | rdf | resource | navigation
Meta.class |= note | declare | indexmark | glossarydefinition
| rdf | resource | navigation
| alternate-text | long-description

#======================================================================

Expand Down Expand Up @@ -172,6 +174,35 @@ rdf_attributes =
## Content model for \elementref{rdf}
rdf_model = Flow.model

#======================================================================
# Descriptions & Accessibilty

alternate-text =
## A container for alternative or replacement text for another element (the parent);
## This would typically be used when the parent cannot or should not be rendered;
## for example, spoken by screen readers as a replacement for images.
element alternate-text { alternate-text_attributes, alternate-text_model }

## Attributes for \elementref{alternate-text}
alternate-text_attributes = empty

## Content for \elementref{alternate-text}
alternate-text_model = Flow.model

long-description =
## A container for a detailed description of another element (the parent);
## This would typically be used to describe the actual contents of
## a figure or image, as distinct from a caption which may only describe its
## source or purpose.
element long-description { long-description_attributes, long-description_model }

## Attributes for \elementref{long-description}
long-description_attributes = empty

## Content for \elementref{long-description}
long-description_model = Flow.model


#======================================================================
# Document-level (or sub-document level) Meta objects

Expand Down
41 changes: 41 additions & 0 deletions lib/LaTeXML/resources/RelaxNG/LaTeXML-meta.rng
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ they can appear in both inline and block contexts.</a:documentation>
<ref name="rdf"/>
<ref name="resource"/>
<ref name="navigation"/>
<ref name="alternate-text"/>
<ref name="long-description"/>
</choice>
</define>
<!-- ====================================================================== -->
Expand Down Expand Up @@ -252,6 +254,45 @@ used to crossreference.</a:documentation>
<a:documentation>Content model for \elementref{rdf}</a:documentation>
<ref name="Flow.model"/>
</define>
<!--
======================================================================
Descriptions & Accessibilty
-->
<define name="alternate-text">
<element name="alternate-text">
<a:documentation>A container for alternative or replacement text for another element (the parent);
This would typically be used when the parent cannot or should not be rendered;
for example, spoken by screen readers as a replacement for images.</a:documentation>
<ref name="alternate-text_attributes"/>
<ref name="alternate-text_model"/>
</element>
</define>
<define name="alternate-text_attributes">
<a:documentation>Attributes for \elementref{alternate-text}</a:documentation>
<empty/>
</define>
<define name="alternate-text_model">
<a:documentation>Content for \elementref{alternate-text}</a:documentation>
<ref name="Flow.model"/>
</define>
<define name="long-description">
<element name="long-description">
<a:documentation>A container for a detailed description of another element (the parent);
This would typically be used to describe the actual contents of
a figure or image, as distinct from a caption which may only describe its
source or purpose.</a:documentation>
<ref name="long-description_attributes"/>
<ref name="long-description_model"/>
</element>
</define>
<define name="long-description_attributes">
<a:documentation>Attributes for \elementref{long-description}</a:documentation>
<empty/>
</define>
<define name="long-description_model">
<a:documentation>Content for \elementref{long-description}</a:documentation>
<ref name="Flow.model"/>
</define>
<!--
======================================================================
Document-level (or sub-document level) Meta objects
Expand Down
2 changes: 1 addition & 1 deletion lib/LaTeXML/resources/RelaxNG/LaTeXML-misc.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ graphics_attributes =


## Content model for \elementref{graphics}.
graphics_model = empty
graphics_model = (Meta.class)*

#======================================================================
svgForeign.attributes =
Expand Down
4 changes: 3 additions & 1 deletion lib/LaTeXML/resources/RelaxNG/LaTeXML-misc.rng
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ to be used in processing the graphic.</a:documentation>
</define>
<define name="graphics_model">
<a:documentation>Content model for \elementref{graphics}.</a:documentation>
<empty/>
<zeroOrMore>
<ref name="Meta.class"/>
</zeroOrMore>
</define>
<!-- ====================================================================== -->
<define name="svgForeign.attributes">
Expand Down
Loading
Loading