Skip to content

Commit 2ef36bb

Browse files
committed
extended regex for glossaries
1 parent 31978c3 commit 2ef36bb

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/latex_dependency_scanner/scanner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737

3838
REGEX_TEX = re.compile(
3939
r"\\(?P<type>usepackage|RequirePackage|include|addbibresource|bibliography|putbib|"
40-
r"includegraphics|input|(sub)?import|lstinputlisting)"
40+
r"includegraphics|input|(sub)?import|lstinputlisting|glsxtrresourcefile|GlsXtrLoadResources)"
4141
r"(<[^<>]*>)?"
4242
r"(\[[^\[\]]*\])?"
43-
r"({(?P<relative_to>[^{}]*)})?{(?P<file>[^{}]*)}",
43+
r"({(?P<relative_to>[^{}]*)})?(\[[^\[\]]*src=)?{(?P<file>[^{}]*)}",
4444
re.M,
4545
)
4646
"""re.Pattern: The regular expression pattern to extract included files from a LaTeX

tests/test_regex.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
"\\addbibresource{bibfile}",
5858
{"type": "addbibresource", "file": "bibfile", "relative_to": None},
5959
),
60+
(
61+
"\\glsxtrresourcefile{glsfile}",
62+
{"type": "glsxtrresourcefile", "file": "glsfile", "relative_to": None},
63+
),
64+
(
65+
"\\GlsXtrLoadResources[src={glsfile}]",
66+
{"type": "GlsXtrLoadResources", "file": "glsfile", "relative_to": None},
67+
),
6068
],
6169
)
6270
def test_regex_tex(text, expected):

0 commit comments

Comments
 (0)