Skip to content

Commit 9ae9c9d

Browse files
authored
Merge pull request #3 from dginev/navtoc-abstract-and-references-arxiv
[preview] navigational table-of-contents (abstract, aknowledgement, references), again
2 parents 92c2631 + a95224f commit 9ae9c9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+142
-108
lines changed

lib/LaTeXML.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ sub convert {
366366
$serialized = Encode::encode('UTF-8', $serialized); }
367367
} else { # fragment case
368368
$serialized = $result->toString(1, 1);
369-
} }
369+
} }
370370
elsif ($$opts{format} =~ /^html/) {
371371
if (ref($result) =~ /^LaTeXML::(Post::)?Document$/) {
372372
$serialized = $result->getDocument->toStringHTML; }
@@ -666,8 +666,8 @@ sub convert_post {
666666
sub check_TOC {
667667
my ($self, $document) = @_;
668668
if (!$document->findnode('//ltx:TOC[@lists="toc"]')) {
669-
my @s = (qw(ltx:part ltx:chapter ltx:section ltx:subsection ltx:subsubsection
670-
ltx:paragraph ltx:subparagraph ltx:appendix ltx:index ltx:bibliography));
669+
my @s = (qw(ltx:abstract ltx:part ltx:chapter ltx:section ltx:subsection ltx:subsubsection
670+
ltx:paragraph ltx:subparagraph ltx:appendix ltx:index ltx:acknowledgements ltx:bibliography));
671671
$document->prependNodes($document->getDocumentElement,
672672
['ltx:TOC', { lists => 'toc', scope => 'global',
673673
select => join(' | ', @s), class => 'ltx_nodisplay' }]); }

lib/LaTeXML/Engine/latex_constructs.pool.ltxml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,17 @@ DefConstructorI('\tableofcontents', undef,
725725
push(@s, (qw(ltx:appendix ltx:index ltx:bibliography))) if @s;
726726
(select => join(' | ', @s),
727727
name => DigestText(T_CS('\contentsname'))); });
728+
# Ensure we add the TOC-relevant attributes to the relevant elements.
729+
Tag('ltx:abstract', afterOpen => sub {
730+
my ($document, $node, $thing) = @_;
731+
$document->setAttribute($node, inlist => 'toc');
732+
GenerateID($document, $node, $thing, 'abstract');
733+
return; });
734+
Tag('ltx:acknowledgements', autoClose => 1, afterOpen => sub {
735+
my ($document, $node, $thing) = @_;
736+
$document->setAttribute($node, inlist => 'toc');
737+
GenerateID($document, $node, $thing, 'acknowledgements');
738+
return; });
728739

729740
#DefMacroI('\listfigurename', undef, 'List of Figures');
730741
DefConstructorI('\listoffigures', undef,
@@ -4085,8 +4096,9 @@ DefConstructorI('\endthebibliography', undef, sub {
40854096
locked => 1);
40864097
Let('\saved@endthebibliography', '\endthebibliography');
40874098
# auto close the bibliography and contained biblist.
4088-
Tag('ltx:biblist', autoClose => 1);
4089-
Tag('ltx:bibliography', autoClose => 1);
4099+
Tag('ltx:biblist', autoClose => 1);
4100+
Tag('ltx:bibliography', autoClose => 1,
4101+
afterOpen => sub { $_[1]->setAttribute('inlist', 'toc'); });
40904102

40914103
# Since SOME people seem to write bibliographies w/o \bibitem,
40924104
# just blank lines between apparent entries,

lib/LaTeXML/Package/JHEP.cls.ltxml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ DefMacro('\keywords{}', '\@add@frontmatter{ltx:keywords}{#1}');
6161
DefConstructor('\acknowledgments', "<ltx:acknowledgements name='#name'>",
6262
properties => sub { (name => Digest(T_CS('\acknowlname'))); });
6363
DefConstructor('\endacknowledgments', "</ltx:acknowledgements>");
64-
Tag("ltx:acknowledgements", autoClose => 1);
6564

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

138137
DefMacro('\JHEPspecialurl Semiverbatim', ''); # ???
139138
DefMacro('\base Semiverbatim', '');
@@ -310,5 +309,3 @@ DefMacro('\acknowlname', 'Acknowledgments');
310309
1;
311310

312311
__END__
313-
314-

lib/LaTeXML/Package/OmniBus.cls.ltxml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ Let('\abst', '\abstract');
226226
DefConstructor('\acknowledgments', "<ltx:acknowledgements name='#name'>",
227227
properties => sub { (name => Digest(T_CS('\acknowledgmentsname'))); });
228228
DefConstructor('\endacknowledgments', "</ltx:acknowledgements>");
229-
Tag("ltx:acknowledgements", autoClose => 1);
230229

231230
DefMacro('\acknowledgmentsname', 'Acknowledgements');
232231
Let('\acknowledgements', '\acknowledgments');

lib/LaTeXML/Package/aa_support.sty.ltxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ DefConstructor('\endacknowledgements', "</ltx:acknowledgements>");
135135
DefConstructor('\acknowledgement', "<ltx:acknowledgements name='#name'>",
136136
properties => sub { (name => Digest(T_CS('\acknowledgmentsname'))); });
137137
DefConstructor('\endacknowledgement', "</ltx:acknowledgements>");
138-
Tag("ltx:acknowledgements", autoClose => 1);
138+
139139
DefMacro('\acknowledgmentsname', 'Acknowledgements');
140140
DefMacro('\ackname', 'Acknowledgements');
141141

lib/LaTeXML/Package/aas_support.sty.ltxml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ DefEnvironment('{interactive}{}{}', '#body');
226226
# 2.9 Acknowledgements
227227

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

lib/LaTeXML/Package/elsart_support_core.sty.ltxml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ DefMacro('\runtitle{}', Tokens());
6363
DefMacro('\subtitle{}', '\@add@frontmatter{ltx:subtitle}{#1}');
6464

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

6969
DefMacro('\sep', '\unskip,\space');
@@ -122,7 +122,6 @@ Let('\ESpagenumber', '\arabic');
122122

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

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

148147
DefMacro('\@keyword XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme=keywords]{#1}');
149148
DefMacro('\@PACS XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme=PACS]{#1}');
150-
DefMacro('\@MSC {} XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme={#1 MSC}]{#2}');
149+
DefMacro('\@MSC {} XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme={#1 MSC}]{#2}');
151150
DefMacro('\@JEL XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme=JEL]{#1}');
152151
DefMacro('\@UK XUntil:\@keyword@cut', '\@add@frontmatter{ltx:classification}[scheme=UK]{#1}');
153152
DefConstructor('\@keyword@cut', '');

lib/LaTeXML/Package/iopart_support.sty.ltxml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ DefMacro('\endrefs', '\end{thebibliography}');
248248

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

253252
#======================================================================
254253
# Abbreviations

lib/LaTeXML/Package/jheppub.sty.ltxml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ DefMacro('\acknowledgmentsname', 'Acknowledgements');
5757
DefConstructor('\acknowledgments', "<ltx:acknowledgements name='#name'>",
5858
properties => sub { (name => Digest(T_CS('\acknowledgmentsname'))); });
5959
DefConstructor('\endacknowledgments', "</ltx:acknowledgements>");
60-
Tag("ltx:acknowledgements", autoClose => 1);
6160

6261
DefConditional('\ifaffil', undef);
6362
DefConditional('\ifnotoc', undef);

lib/LaTeXML/Package/llncs.cls.ltxml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ DefConstructor('\acknowledgements', "<ltx:acknowledgements name='#name'>",
5353
DefMacro('\acknowledgement', '\acknowledgements');
5454
DefConstructor('\endacknowledgements', "</ltx:acknowledgements>");
5555
DefConstructor('\endacknowledgement', "</ltx:acknowledgements>");
56-
Tag("ltx:acknowledgements", autoClose => 1);
5756

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

0 commit comments

Comments
 (0)