Skip to content

Commit 9b53583

Browse files
authored
Detect babel language files from newer error format (#476)
1 parent d6e2c0d commit 9b53583

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
^TinyTeX.*\.zip$
77
^\.github$
88
^cran-comments\.md$
9+
^\.vscode$

.github/workflows/required-latex-pkgs.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ on:
33
branches: [main]
44
paths-ignore:
55
- '.github/workflows/build.yaml'
6-
pull_request:
7-
branches: [main]
8-
paths-ignore:
9-
- '.github/workflows/build.yaml'
106

117
name: check required LateX packages
128

@@ -41,7 +37,7 @@ jobs:
4137
run: Rscript tools/test-packages.R
4238

4339
- name: Create Pull Request
44-
uses: peter-evans/create-pull-request@v5
40+
uses: peter-evans/create-pull-request@v7
4541
with:
4642
title: Update the list of LaTeX packages
4743
body: New results by running `tools/test-packages.R`.

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"[r]": {
3+
"editor.formatOnSave": false,
4+
}
5+
}

R/latex.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,10 @@ regex_errors = function() {
590590
# L3 programming layer mismatch (#424)
591591
'^File: ([^ ]+) \\d{4,}-\\d{2}-\\d{2} .*$'
592592
),
593+
babel = c(
594+
# babel language definition files
595+
".*! Package babel Error: Unknown option [`']([^'`]+)'.*"
596+
),
593597
style = c(
594598
# missing .sty or commands
595599
".* Loading '([^']+)' aborted!",
@@ -619,6 +623,8 @@ detect_files = function(text) {
619623
if (p == r$l3backend) return(
620624
if (length(grep('^! Undefined control sequence', text)) > 0) tail(v, 1)
621625
)
626+
# babel language definition files
627+
if (p %in% r$babel) return(paste0(v, '.ldf'))
622628
# these are some known filenames
623629
for (i in c('epstopdf', grep('[.]', names(r), value = TRUE))) {
624630
if (p %in% r[[i]]) return(i)

tests/test-cran/test-latex.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ assert('detect_files() can detect filenames from LaTeX log', {
1212
(detect_files("! LaTeX Error: File `framed.sty' not found.") %==% 'framed.sty')
1313
(detect_files("/usr/local/bin/mktexpk: line 123: mf: command not found") %==% 'mf')
1414
(detect_files("or the language definition file ngerman.ldf was not found") %==% 'ngerman.ldf')
15+
(detect_files("! Package babel Error: Unknown option 'english'.") %==% 'english.ldf')
1516
(detect_files("!pdfTeX error: pdflatex (file 8r.enc): cannot open encoding file for reading") %==% '8r.enc')
1617
(detect_files("! CTeX fontset `fandol' is unavailable in current mode") %==% 'fandol')
1718
(detect_files('Package widetext error: Install the flushend package which is a part of sttools') %==% 'flushend.sty')

0 commit comments

Comments
 (0)