Skip to content

Commit 907d064

Browse files
Update build_preprint.yml
1 parent 9573968 commit 907d064

1 file changed

Lines changed: 32 additions & 6 deletions

File tree

.github/workflows/build_preprint.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,36 @@ jobs:
1616
- name: Cache apt packages
1717
uses: awalsh128/cache-apt-pkgs-action@latest
1818
with:
19-
packages: pandoc texlive texlive-latex-extra texlive-fonts-recommended texlive-xetex zip
19+
packages: pandoc texlive texlive-latex-extra texlive-fonts-recommended texlive-xetex zip python3-yaml
2020
version: 1.0
2121

22-
- name: Create preprint watermark header
22+
- name: Extract author names from JOSS frontmatter
23+
run: |
24+
python3 - << 'EOF'
25+
import yaml
26+
27+
with open('paper/paper.md', 'r') as f:
28+
content = f.read()
29+
30+
# YAML frontmatter is between the first two '---' delimiters
31+
parts = content.split('---\n')
32+
frontmatter = yaml.safe_load(parts[1])
33+
34+
authors = frontmatter.get('authors', [])
35+
author_names = [a['name'] for a in authors]
36+
37+
metadata = {'author': author_names}
38+
39+
with open('/tmp/pandoc_meta.yaml', 'w') as f:
40+
yaml.dump(metadata, f, allow_unicode=True)
41+
42+
print("Authors found:", author_names)
43+
EOF
44+
45+
- name: Create LaTeX header (preprint watermark + URL fix)
2346
run: |
2447
cat > /tmp/preprint-header.tex << 'EOF'
48+
\usepackage{xurl}
2549
\usepackage{fancyhdr}
2650
\usepackage{xcolor}
2751
\pagestyle{fancy}
@@ -35,22 +59,24 @@ jobs:
3559
run: |
3660
cd paper
3761
38-
# 1. Generate preprint PDF with watermark header
62+
# 1. Generate preprint PDF
3963
pandoc paper.md -o paper.pdf \
4064
--standalone \
4165
--citeproc \
4266
--pdf-engine=xelatex \
67+
--metadata-file=/tmp/pandoc_meta.yaml \
4368
--include-in-header=/tmp/preprint-header.tex
4469
4570
# 2. Generate LaTeX source for preprint submission
46-
# --citeproc embeds bibliography directly into the .tex file
4771
pandoc paper.md -o paper.tex \
4872
--standalone \
4973
--citeproc \
50-
--pdf-engine=xelatex
74+
--pdf-engine=xelatex \
75+
--metadata-file=/tmp/pandoc_meta.yaml \
76+
--include-in-header=/tmp/preprint-header.tex
5177
5278
# 3. Create preprint submission ZIP
53-
# Add any figures here, e.g.: figures/fig1.png
79+
# Add figures here if needed, e.g.: figures/fig1.png
5480
zip preprint_submission.zip paper.tex
5581
5682
- name: Upload Preprint PDF Artifact

0 commit comments

Comments
 (0)