Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(latex): use the latest docker image #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ jobs:
- name: Build the LaTeX document
uses: xu-cheng/latex-action@v3
with:
docker_image: ghcr.io/xu-cheng/texlive-full:20220801
latexmk_use_xelatex: true
latexmk_shell_escape: true
args: "-pdf -file-line-error -halt-on-error -interaction=nonstopmode -8bit"
args: "-pdf -file-line-error -halt-on-error -interaction=batchmode -8bit"
extra_system_packages: |
unzip
wget
Expand All @@ -34,9 +33,9 @@ jobs:
git
python3
py3-pygments
inkscape
libxml2
openssh
sqlite-dev
pre_compile: |
umask 0 && npm config set cache /tmp/.npm
wget -q -O notosans.zip "https://noto-website-2.storage.googleapis.com/pkgs/NotoSans-hinted.zip"
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ jobs:
- name: Build the LaTeX document
uses: xu-cheng/latex-action@v3
with:
docker_image: ghcr.io/xu-cheng/texlive-full:20220801
latexmk_use_xelatex: true
latexmk_shell_escape: true
args: "-pdf -file-line-error -halt-on-error -interaction=nonstopmode -8bit"
args: "-pdf -file-line-error -halt-on-error -interaction=batchmode -8bit"
extra_system_packages: |
unzip
wget
Expand All @@ -33,9 +32,9 @@ jobs:
git
python3
py3-pygments
inkscape
libxml2
openssh
sqlite-dev
pre_compile: |
umask 0 && npm config set cache /tmp/.npm
wget -q -O notosans.zip "https://noto-website-2.storage.googleapis.com/pkgs/NotoSans-hinted.zip"
Expand Down
21 changes: 21 additions & 0 deletions oi-wiki-export/oi-wiki-export.tex
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@
\usepackage{hyperref}
\hypersetup{colorlinks,urlcolor=.,breaklinks=true,hyperfootnotes=true,unicode}

\usepackage{xpatch}
\ExplSyntaxOn
% apply the patch only if package date is at least 2022-08-05 _and_
% earlier than 2022-08-31
% bug was introduced in v3.9.1 (2022-08-15) and fixed in dev on 2022-08-31
% see
% https://github.com/CTeX-org/ctex-kit/commit/a841dabaac7c2dccacd1858ba96f6eb38adfb335
% https://github.com/CTeX-org/ctex-kit/commit/aa5f00db05f12034845f8e5c4119971b5aae33ff
% https://github.com/CTeX-org/ctex-kit/issues/636
% TODO: Test and remove this when xeCJK v3.9.2 avaliable
\IfPackageAtLeastTF{xeCJK}{2022-08-05}{
\IfPackageAtLeastTF{xeCJK}{2022-08-31}{}{
\xpatchcmd \__xeCJK_check_for_xglue:
{\__xeCJK_if_last_glue:TF}
{\__xeCJK_if_last_glue:T}
{}{\PatchFailed}
}
}{}
\ExplSyntaxOff


% additional CJK characters for '←' and '→'
\xeCJKsetcharclass{"2190}{"2192}{1}% 1: CJK
\xeCJKsetup{xCJKecglue}
Expand Down
17 changes: 12 additions & 5 deletions remark-latex/lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,23 +296,30 @@ export default function compiler(options) {
if (existsSync(uri.replace(/\.svg$/, ".printable.svg"))) {
console.log(`[SVG] Detected printable version of ${uri}`);
if (!existsSync(dest)) {
execFileSync("inkscape", [
`--export-filename=${dest}`,
execFileSync("magick", [
uri.replace(/\.svg$/, ".printable.svg"),
"-background",
"white",
dest,
]);
}
} else if (!existsSync(dest)) {
execFileSync("inkscape", [`--export-filename=${dest}`, uri]);
execFileSync("magick", [
uri,
"-background",
"white",
dest,
]);
}
}
default: {
if (!existsSync(dest)) {
// 混合白色背景(原图可能是 PNG 透明图)
execFileSync("convert", [
execFileSync("magick", [
ext === ".gif" ? uri + "[0]" : uri,
"-background",
"white",
"-flatten",
ext === ".gif" ? uri + "[0]" : uri,
dest,
]);
}
Expand Down