Skip to content
Closed
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
6 changes: 3 additions & 3 deletions lib/LaTeXML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ sub convert {
$serialized = Encode::encode('UTF-8', $serialized); }
} else { # fragment case
$serialized = $result->toString(1, 1);
} }
} }
elsif ($$opts{format} =~ /^html/) {
if (ref($result) =~ /^LaTeXML::(Post::)?Document$/) {
$serialized = $result->getDocument->toStringHTML; }
Expand Down Expand Up @@ -666,8 +666,8 @@ sub convert_post {
sub check_TOC {
my ($self, $document) = @_;
if (!$document->findnode('//ltx:TOC[@lists="toc"]')) {
my @s = (qw(ltx:part ltx:chapter ltx:section ltx:subsection ltx:subsubsection
ltx:paragraph ltx:subparagraph ltx:appendix ltx:index ltx:bibliography));
my @s = (qw(ltx:abstract ltx:part ltx:chapter ltx:section ltx:subsection ltx:subsubsection
ltx:paragraph ltx:subparagraph ltx:appendix ltx:index ltx:acknowledgements ltx:bibliography));
$document->prependNodes($document->getDocumentElement,
['ltx:TOC', { lists => 'toc', scope => 'global',
select => join(' | ', @s), class => 'ltx_nodisplay' }]); }
Expand Down
17 changes: 14 additions & 3 deletions lib/LaTeXML/Engine/latex_constructs.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,17 @@ DefConstructorI('\tableofcontents', undef,
push(@s, (qw(ltx:appendix ltx:index ltx:bibliography))) if @s;
(select => join(' | ', @s),
name => DigestText(T_CS('\contentsname'))); });
# Ensure we add the TOC-relevant attributes to the relevant elements.
Tag('ltx:abstract', afterOpen => sub {
my ($document, $node, $thing) = @_;
$document->setAttribute($node, inlist => 'toc');
GenerateID($document, $node, $thing, 'abstract');
return; });
Tag('ltx:acknowledgements', autoClose => 1, afterOpen => sub {
my ($document, $node, $thing) = @_;
$document->setAttribute($node, inlist => 'toc');
GenerateID($document, $node, $thing, 'acknowledgements');
return; });

#DefMacroI('\listfigurename', undef, 'List of Figures');
DefConstructorI('\listoffigures', undef,
Expand Down Expand Up @@ -4071,8 +4082,9 @@ DefConstructorI('\endthebibliography', undef, sub {
locked => 1);
Let('\saved@endthebibliography', '\endthebibliography');
# auto close the bibliography and contained biblist.
Tag('ltx:biblist', autoClose => 1);
Tag('ltx:bibliography', autoClose => 1);
Tag('ltx:biblist', autoClose => 1);
Tag('ltx:bibliography', autoClose => 1,
afterOpen => sub { $_[1]->setAttribute('inlist', 'toc'); });

# Since SOME people seem to write bibliographies w/o \bibitem,
# just blank lines between apparent entries,
Expand Down Expand Up @@ -6008,4 +6020,3 @@ EOL

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1;

5 changes: 1 addition & 4 deletions lib/LaTeXML/Package/JHEP.cls.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ DefMacro('\keywords{}', '\@add@frontmatter{ltx:keywords}{#1}');
DefConstructor('\acknowledgments', "<ltx:acknowledgements name='#name'>",
properties => sub { (name => Digest(T_CS('\acknowlname'))); });
DefConstructor('\endacknowledgments', "</ltx:acknowledgements>");
Tag("ltx:acknowledgements", autoClose => 1);

#======================================================================
DefPrimitiveI('\hash', undef, '#');
Expand Down Expand Up @@ -133,7 +132,7 @@ DefEnvironment('{floatingtable}[]',
DefConstructor('\href Semiverbatim Semiverbatim',
"<ltx:ref href='#href'>#2</ltx:ref>",
enterHorizontal => 1,
properties => sub { (href => ComposeURL((LookupValue('BASE_URL') || ''), $_[1])); });
properties => sub { (href => ComposeURL((LookupValue('BASE_URL') || ''), $_[1])); });

DefMacro('\JHEPspecialurl Semiverbatim', ''); # ???
DefMacro('\base Semiverbatim', '');
Expand Down Expand Up @@ -310,5 +309,3 @@ DefMacro('\acknowlname', 'Acknowledgments');
1;

__END__


1 change: 0 additions & 1 deletion lib/LaTeXML/Package/OmniBus.cls.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ Let('\abst', '\abstract');
DefConstructor('\acknowledgments', "<ltx:acknowledgements name='#name'>",
properties => sub { (name => Digest(T_CS('\acknowledgmentsname'))); });
DefConstructor('\endacknowledgments', "</ltx:acknowledgements>");
Tag("ltx:acknowledgements", autoClose => 1);

DefMacro('\acknowledgmentsname', 'Acknowledgements');
Let('\acknowledgements', '\acknowledgments');
Expand Down
2 changes: 1 addition & 1 deletion lib/LaTeXML/Package/aa_support.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ DefConstructor('\endacknowledgements', "</ltx:acknowledgements>");
DefConstructor('\acknowledgement', "<ltx:acknowledgements name='#name'>",
properties => sub { (name => Digest(T_CS('\acknowledgmentsname'))); });
DefConstructor('\endacknowledgement', "</ltx:acknowledgements>");
Tag("ltx:acknowledgements", autoClose => 1);

DefMacro('\acknowledgmentsname', 'Acknowledgements');
DefMacro('\ackname', 'Acknowledgements');

Expand Down
1 change: 0 additions & 1 deletion lib/LaTeXML/Package/aas_support.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ DefEnvironment('{interactive}{}{}', '#body');
# 2.9 Acknowledgements

# acts like \section{Acknowledgements}, rather than container.
Tag("ltx:acknowledgements", autoClose => 1);
DefConstructor('\acknowledgements', "<ltx:acknowledgements>");
Let('\acknowledgments', '\acknowledgements');

Expand Down
5 changes: 2 additions & 3 deletions lib/LaTeXML/Package/elsart_support_core.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ DefMacro('\runtitle{}', Tokens());
DefMacro('\subtitle{}', '\@add@frontmatter{ltx:subtitle}{#1}');

DefMacro('\ead Optional:email Semiverbatim',
'\@add@to@frontmatter{ltx:creator}{\@@@email{#1}{#2}}');
'\@add@to@frontmatter{ltx:creator}{\@@@email{#1}{#2}}');
DefConstructor('\@@@email{}{}', "^ <ltx:contact role='#1'>#2</ltx:contact>");

DefMacro('\sep', '\unskip,\space');
Expand Down Expand Up @@ -122,7 +122,6 @@ Let('\ESpagenumber', '\arabic');

DefConstructor('\ack', "<ltx:acknowledgements>");
DefConstructor('\endack', "</ltx:acknowledgements>");
Tag("ltx:acknowledgements", autoClose => 1);

#======================================================================
# 6 Keywords
Expand All @@ -147,7 +146,7 @@ DefMacro('\UK', '\@keyword@cut\@UK');

DefMacro('\@keyword XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme=keywords]{#1}');
DefMacro('\@PACS XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme=PACS]{#1}');
DefMacro('\@MSC {} XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme={#1 MSC}]{#2}');
DefMacro('\@MSC {} XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme={#1 MSC}]{#2}');
DefMacro('\@JEL XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme=JEL]{#1}');
DefMacro('\@UK XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme=UK]{#1}');
DefConstructor('\@keyword@cut', '');
Expand Down
1 change: 0 additions & 1 deletion lib/LaTeXML/Package/iopart_support.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ DefMacro('\endrefs', '\end{thebibliography}');

DefConstructor('\ack', "<ltx:acknowledgements>"); # name?
DefConstructor('\ackn', "<ltx:acknowledgements>");
Tag("ltx:acknowledgements", autoClose => 1);

#======================================================================
# Abbreviations
Expand Down
1 change: 0 additions & 1 deletion lib/LaTeXML/Package/jheppub.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ DefMacro('\acknowledgmentsname', 'Acknowledgements');
DefConstructor('\acknowledgments', "<ltx:acknowledgements name='#name'>",
properties => sub { (name => Digest(T_CS('\acknowledgmentsname'))); });
DefConstructor('\endacknowledgments', "</ltx:acknowledgements>");
Tag("ltx:acknowledgements", autoClose => 1);

DefConditional('\ifaffil', undef);
DefConditional('\ifnotoc', undef);
Expand Down
1 change: 0 additions & 1 deletion lib/LaTeXML/Package/llncs.cls.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ DefConstructor('\acknowledgements', "<ltx:acknowledgements name='#name'>",
DefMacro('\acknowledgement', '\acknowledgements');
DefConstructor('\endacknowledgements', "</ltx:acknowledgements>");
DefConstructor('\endacknowledgement', "</ltx:acknowledgements>");
Tag("ltx:acknowledgements", autoClose => 1);

DefConstructor('\url Semiverbatim', "<ltx:ref href='#1'>#1</ltx:ref>");

Expand Down
7 changes: 3 additions & 4 deletions lib/LaTeXML/Package/revtex4_support.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ DefConstructor('\endacknowledgments', "</ltx:acknowledgements>");
DefMacro('\acknowledgmentsname', 'Acknowledgements');
Let('\acknowledgements', '\acknowledgments');
Let('\endacknowledgements', '\endacknowledgments');
Tag("ltx:acknowledgements", autoClose => 1);

# Extra stuff
DefMacro('\thesection', '\Roman{section}'); # Apparently the desired style.
Expand Down Expand Up @@ -134,7 +133,7 @@ DefConstructor('\endnotemark[]',
"<ltx:note role='endnotemark' mark='#mark' xml:id='#id'>"
. "#tags"
. "</ltx:note>",
mode => 'restricted_horizontal', enterHorizontal => 1,
mode => 'restricted_horizontal', enterHorizontal => 1,
properties => sub {
($_[1]
? (mark => $_[1])
Expand Down Expand Up @@ -162,10 +161,10 @@ DefConstructor('\text{}', "<ltx:text _noautoclose='true'>#1</ltx:text>",
mode => 'restricted_horizontal', locked => 1);

# RevTeX3 (obsolete in RevTeX4)
DefConstructor('\bm{}', '#1', bounded => 1, requireMath => 1, font => { forcebold => 1 });
DefConstructor('\bm{}', '#1', bounded => 1, requireMath => 1, font => { forcebold => 1 });
DefConstructor('\bbox{}', '#1',
bounded => 1, requireMath => 1, font => { forcebold => 1 },
locked => 1);
locked => 1);
DefConstructor('\pmb{}', '#1', bounded => 1, requireMath => 1,
font => { forcebold => 1, family => 'blackboard',
series => 'medium', shape => 'upright' });
Expand Down
3 changes: 1 addition & 2 deletions lib/LaTeXML/Package/sv_support.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ DefConstructor('\acknowledgements', "<ltx:acknowledgements name='#name'>",
DefMacro('\acknowledgement', '\acknowledgements');
DefConstructor('\endacknowledgements', "</ltx:acknowledgements>");
DefConstructor('\endacknowledgement', "</ltx:acknowledgements>");
Tag("ltx:acknowledgements", autoClose => 1);

DefMacro('\noteaddname', 'Note added in proof');
DefMacro('\notename', 'Note');
Expand Down Expand Up @@ -232,7 +231,7 @@ DefMacro('\qed', '\ltx@qed');
DefConstructor('\ltx@qed',
"?#isMath(<ltx:XMTok role='PUNCT'>\x{220E}</ltx:XMTok>)(\x{220E})",
enterHorizontal => 1,
reversion => '\qed');
reversion => '\qed');
Let('\smartqed', '\qed');
Let('\squareforqed', '\qed');

Expand Down
20 changes: 10 additions & 10 deletions lib/LaTeXML/Post/CrossRef.pm
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ sub fill_in_relations {
$doc->addNavigation($child_rel => $child_id); }
else { # Else, consider it as some sort of sidebar.
$doc->addNavigation('sidebar' => $child_id); } }
} }
} }
return; }

sub findPreviousPage {
Expand Down Expand Up @@ -200,10 +200,10 @@ sub getChildPages {
# To make it more extensible, it really should be integrated into the database?
# Eg. "sectional" things might mark their entries specially?
my $normaltoctypes = { map { ($_ => 1) } # CONSTANT
qw (ltx:document ltx:part ltx:chapter
qw (ltx:document ltx:abstract ltx:part ltx:chapter
ltx:section ltx:subsection ltx:subsubsection
ltx:paragraph ltx:subparagraph
ltx:index ltx:bibliography ltx:glossary ltx:appendix) };
ltx:index ltx:bibliography ltx:glossary ltx:acknowledgements ltx:appendix) };

sub fill_in_tocs {
my ($self, $doc) = @_;
Expand Down Expand Up @@ -346,7 +346,7 @@ sub fill_in_refs {
if (!$ref->textContent) {
$doc->addNodes($ref, $label); # Just to reassure (?) readers.
$ref->setAttribute(broken => 1); }
} } }
} } }

if ($id) {
$n++;
Expand All @@ -365,7 +365,7 @@ sub fill_in_refs {
$doc->addNodes($ref, $self->generateRef($doc, $id, $show, $is_nameref)); }
if (my $entry = $$self{db}->lookup("ID:$id")) {
$ref->setAttribute(stub => 1) if $entry->getValue('stub'); }
} }
} }
Debug("Filled in $n refs") if $LaTeXML::DEBUG{crossref};
return; }

Expand All @@ -384,7 +384,7 @@ sub fill_in_RDFa_refs {
$ref->setAttribute($key . 'idref' => $id); }
else {
$self->note_missing('warn', "Target for $key Label", $label);
} } }
} } }
if ($id) {
$n++;
if (!$ref->getAttribute($key)) {
Expand All @@ -393,7 +393,7 @@ sub fill_in_RDFa_refs {
$ref->setAttribute($key => $url); } }
else {
$ref->setAttribute($key => '#' . $id); } }
} } }
} } }
set_RDFa_prefixes($doc->getDocument, {}); # what prefixes??
Debug("Filled in $n RDFa refs") if $LaTeXML::DEBUG{crossref};
return; }
Expand Down Expand Up @@ -424,7 +424,7 @@ sub fill_in_mathlinks {
$sym->setAttribute(href => $self->generateURL($doc, $id));
if (my $tag = $entry->getValue('tag:short') || $entry->getValue('description')) {
$sym->setAttribute(title => getTextContent($doc, $tag)); }
} } }
} } }
Debug("Filled in $n math links") if $LaTeXML::DEBUG{crossref};
return; }

Expand Down Expand Up @@ -559,7 +559,7 @@ sub make_bibcite {
$self->note_missing('warn', 'Entry for citation', $key);
push(@data, { key => $key, refnum => [$key], title => [$key], year => [],
attr => { idref => $key, title => $key, class => "ltx_missing_citation" } });
} }
} }
my $checkdups = ($show =~ /author/i) && ($show =~ /(year|number)/i);
my @refs = ();
my $saveshow = $show;
Expand Down Expand Up @@ -939,7 +939,7 @@ sub copy_resources {
if (my $src = pathname_find($url, paths => $paths)) { # AND if file exists there.
my $dst = $doc->checkDestination($url);
pathname_copy($src, $dst);
} } }
} } }
return; }

# ================================================================================
Expand Down
54 changes: 42 additions & 12 deletions lib/LaTeXML/Post/Scan.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ sub new {
my $self = $class->SUPER::new(%options);
$$self{db} = $options{db};
$$self{handlers} = {};
$self->registerHandler('ltx:document' => \&section_handler);
$self->registerHandler('ltx:part' => \&section_handler);
$self->registerHandler('ltx:chapter' => \&section_handler);
$self->registerHandler('ltx:section' => \&section_handler);
$self->registerHandler('ltx:appendix' => \&section_handler);
$self->registerHandler('ltx:subsection' => \&section_handler);
$self->registerHandler('ltx:subsubsection' => \&section_handler);
$self->registerHandler('ltx:paragraph' => \&section_handler);
$self->registerHandler('ltx:subparagraph' => \&section_handler);
$self->registerHandler('ltx:bibliography' => \&section_handler);
$self->registerHandler('ltx:index' => \&section_handler);
$self->registerHandler('ltx:glossary' => \&section_handler);
$self->registerHandler('ltx:document' => \&section_handler);
$self->registerHandler('ltx:abstract' => \&abstract_handler);
$self->registerHandler('ltx:part' => \&section_handler);
$self->registerHandler('ltx:chapter' => \&section_handler);
$self->registerHandler('ltx:section' => \&section_handler);
$self->registerHandler('ltx:appendix' => \&section_handler);
$self->registerHandler('ltx:subsection' => \&section_handler);
$self->registerHandler('ltx:subsubsection' => \&section_handler);
$self->registerHandler('ltx:paragraph' => \&section_handler);
$self->registerHandler('ltx:subparagraph' => \&section_handler);
$self->registerHandler('ltx:bibliography' => \&section_handler);
$self->registerHandler('ltx:index' => \&section_handler);
$self->registerHandler('ltx:glossary' => \&section_handler);
$self->registerHandler('ltx:acknowledgements' => \&ack_handler);

$self->registerHandler('ltx:table' => \&captioned_handler);
$self->registerHandler('ltx:figure' => \&captioned_handler);
Expand Down Expand Up @@ -295,6 +297,34 @@ sub section_handler {
$self->scanChildren($doc, $node, $id || $parent_id);
return; }

sub abstract_handler {
my ($self, $doc, $node, $tag, $parent_id) = @_;
my $id = $node->getAttribute('xml:id');
if ($id) {
my $name = $node->getAttribute('name') || "Abstract";
$$self{db}->register("ID:$id",
$self->addCommon($doc, $node, $tag, $parent_id),
primary => 1,
title => $name,
toctitle => $name,
children => []);
$self->addAsChild($id, $parent_id); }
return; }

sub ack_handler {
my ($self, $doc, $node, $tag, $parent_id) = @_;
my $id = $node->getAttribute('xml:id');
if ($id) {
my $name = $node->getAttribute('name') || "Acknowledgements";
$$self{db}->register("ID:$id",
$self->addCommon($doc, $node, $tag, $parent_id),
primary => 1,
title => $name,
toctitle => $name,
children => []);
$self->addAsChild($id, $parent_id); }
return; }

sub captioned_handler {
my ($self, $doc, $node, $tag, $parent_id) = @_;
my $id = $node->getAttribute('xml:id');
Expand Down
4 changes: 2 additions & 2 deletions lib/LaTeXML/resources/RelaxNG/LaTeXML-structure.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ abstract =
element abstract { abstract_attributes, abstract_model }

## Attributes for \elementref{abstract}.
abstract_attributes = Common.attributes, FrontMatter.attributes
abstract_attributes = Common.attributes, FrontMatter.attributes, Labelled.attributes

## Content model for \elementref{abstract}.
abstract_model = Block.model
Expand All @@ -520,7 +520,7 @@ acknowledgements =
element acknowledgements { acknowledgements_attributes, acknowledgements_model }

## Attributes for \elementref{acknowledgements}.
acknowledgements_attributes = Common.attributes, FrontMatter.attributes
acknowledgements_attributes = Common.attributes, FrontMatter.attributes, Labelled.attributes

## Content model for \elementref{acknowledgements}.
acknowledgements_model = Inline.model
Expand Down
2 changes: 2 additions & 0 deletions lib/LaTeXML/resources/RelaxNG/LaTeXML-structure.rng
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ Commonly useful values are specified, but is open-ended to support extension.</a
<a:documentation>Attributes for \elementref{abstract}.</a:documentation>
<ref name="Common.attributes"/>
<ref name="FrontMatter.attributes"/>
<ref name="Labelled.attributes"/>
</define>
<define name="abstract_model">
<a:documentation>Content model for \elementref{abstract}.</a:documentation>
Expand All @@ -953,6 +954,7 @@ Commonly useful values are specified, but is open-ended to support extension.</a
<a:documentation>Attributes for \elementref{acknowledgements}.</a:documentation>
<ref name="Common.attributes"/>
<ref name="FrontMatter.attributes"/>
<ref name="Labelled.attributes"/>
</define>
<define name="acknowledgements_model">
<a:documentation>Content model for \elementref{acknowledgements}.</a:documentation>
Expand Down
Loading
Loading