diff --git a/HISTORY.md b/HISTORY.md index a6f8434..ffca2a1 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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)) diff --git a/list-of-macros.md b/list-of-macros.md index a639437..a3dce92 100644 --- a/list-of-macros.md +++ b/list-of-macros.md @@ -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 diff --git a/tests/test_packages/test_hyperref.py b/tests/test_packages/test_hyperref.py index 97dcbe4..e184032 100644 --- a/tests/test_packages/test_hyperref.py +++ b/tests/test_packages/test_hyperref.py @@ -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'), ] diff --git a/yalafi/packages/hyperref.py b/yalafi/packages/hyperref.py index a23d329..777d042 100644 --- a/yalafi/packages/hyperref.py +++ b/yalafi/packages/hyperref.py @@ -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'), ]