Skip to content

Commit

Permalink
Add bookmark macros from hyperref
Browse files Browse the repository at this point in the history
  • Loading branch information
torik42 committed Mar 26, 2024
1 parent 83b694f commit 007130e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Work in progress
- added macros \\addtolength, \\newlength, \\setlength, \\settodepth, \\settoheight, \\settowidth
- package amsmath: added environments aligned, multline and multlined (PR [#251](../../pull/251), issue [#197](../../issues/197))
- package cleveref: added macros \\labelcref and \\labelcpageref
- package hyperref: added macros \\pdfbookmark, \\currentpdfbookmark, \\subpdfbookmark, \\belowpdfbookmark
- document classes KOMA-Script:
- move macro definitions into helper package koma-script (PR [#228](../../pull/228))
- add macros \\extratitle, \\subtitle and \\subject (PR [#228](../../pull/228))
Expand Down
4 changes: 4 additions & 0 deletions list-of-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,12 @@ tests: [tests/test\_packages/test\_hyperref.py](tests/test_packages/test_hyperre

**Macros**

\\belowpdfbookmark
\\currentpdfbookmark
\\href,
\\pdfbookmark
\\ref\*,
\\subpdfbookmark
\\texorpdfstring,
\\url

Expand Down
5 changes: 5 additions & 0 deletions tests/test_packages/test_hyperref.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ def get_plain(latex):
(r'\texorpdfstring XY', 'X'),
(r'\url XY', 'XY'),
(r'X \ref*{eq1} Y', 'X 0 Y'),
(r'A\pdfbookmark{text}{name}B', 'AB\n\n\ntext\n'),
(r'A\pdfbookmark[2]{text}{name}B', 'AB\n\n\ntext\n'),
(r'A\currentpdfbookmark{text}{name}B', 'AB\n\n\ntext\n'),
(r'A\subpdfbookmark{text}{name}B', 'AB\n\n\ntext\n'),
(r'A\belowpdfbookmark{text}{name}B', 'AB\n\n\ntext\n'),

]

Expand Down
4 changes: 4 additions & 0 deletions yalafi/packages/hyperref.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def init_module(parser, options, position):
macros_python = [

Macro(parms, '\\ref', args='*A', repl='0'),
Macro(parms, '\\pdfbookmark', args='OAA', extract='#2'),
Macro(parms, '\\currentpdfbookmark', args='AA', extract='#1'),
Macro(parms, '\\belowpdfbookmark', args='AA', extract='#1'),
Macro(parms, '\\subpdfbookmark', args='AA', extract='#1'),

]

Expand Down

0 comments on commit 007130e

Please sign in to comment.