Skip to content

Commit

Permalink
Added glsxtrfull from glossaries-extra
Browse files Browse the repository at this point in the history
Implementation via glsxtrshort and glsxtrlong.
Commit includes test coverage.
  • Loading branch information
JulianGoeltz committed Nov 16, 2022
1 parent d581e21 commit d85f320
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
6 changes: 6 additions & 0 deletions list-of-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ With `docdef=true`, all glossary entries have to be defined inside of
**Macros**

\\newabbreviation
\\Glsxtrfull
\\glsxtrfull
\\Glsxtrlong
\\glsxtrlong
\\Glsxtrshort
\\glsxtrshort


## Package graphicx
Expand Down
6 changes: 6 additions & 0 deletions tests/test_packages/test_glossaries_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ def test_macros_latex_glossaries(latex, plain_expected):
data_test_macros_latex = [

(r'\newabbreviation{pp}{ppm}{parts per million}', 'Parts per million.'),
(r'\glsxtrshort{pp}', 'ppm'),
(r'\Glsxtrshort{pp}', 'Ppm'),
(r'\glsxtrlong{pp}', 'parts per million'),
(r'\Glsxtrlong{pp}', 'Parts per million'),
(r'\glsxtrfull{pp}', 'ppm (parts per million)'),
(r'\Glsxtrfull{pp}', 'Ppm (Parts per million)'),

]

Expand Down
14 changes: 13 additions & 1 deletion yalafi/packages/glossaries_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,30 @@
#

from yalafi.defs import Macro, InitModule
from yalafi.packages.glossaries import h_gls, cap_first

require_packages = ['glossaries']

def init_module(parser, options, position):
parms = parser.parms

macros_latex = ''
macros_latex = r"""
\newcommand{\glsxtrfull}[1]{\glsxtrshort{#1} (\glsxtrlong{#1})}
\newcommand{\Glsxtrfull}[1]{\Glsxtrshort{#1} (\Glsxtrlong{#1})}
"""

macros_python = [

Macro(parms, '\\newabbreviation', args='AAA',
repl=r'\newacronym{#1}{#2}{#3}'),
Macro(parms, '\\glsxtrshort', args='OA', repl=h_gls('short', [])),
Macro(parms, '\\Glsxtrshort', args='OA',
repl=h_gls('short', [cap_first])),
Macro(parms, '\\glsxtrlong', args='OA', repl=h_gls('long', [])),
Macro(parms, '\\Glsxtrlong', args='OA',
repl=h_gls('long', [cap_first])),

]

Expand Down

0 comments on commit d85f320

Please sign in to comment.