Skip to content

Commit 529ecc0

Browse files
committed
updated latexgit versions
1 parent 57be8a4 commit 529ecc0

File tree

6 files changed

+96
-17
lines changed

6 files changed

+96
-17
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
scheme: full
1616
run: |
17-
apk add rust cargo gcc linux-headers musl-dev py3-pip python3 python3-dev
17+
apk add cargo gcc linux-headers musl-dev py3-pip python3 python3-dev rust
1818
./make.sh
1919
# deploy to github pages
2020
- name: deploy documentation

make.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ rm "book.pdf" || true
2020
rm -rf "$currentDir/website" || true
2121

2222
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We setup a virtual environment in a temp directory."
23-
tempDir="$(mktemp -d)"
24-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Got temp dir '$tempDir', now creating environment in it."
25-
python3 -m venv --system-site-packages "$tempDir"
26-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Activating virtual environment in '$tempDir'."
27-
. "$tempDir/bin/activate"
28-
export PYTHON_INTERPRETER="$tempDir/bin/python3"
23+
venvDir="$(mktemp -d)"
24+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Got temp dir '$venvDir', now creating environment in it."
25+
python3 -m venv --system-site-packages "$venvDir"
26+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Activating virtual environment in '$venvDir'."
27+
. "$venvDir/bin/activate"
28+
export PYTHON_INTERPRETER="$venvDir/bin/python3"
2929
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Setting python interpreter to '$PYTHON_INTERPRETER'."
30-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We install all required Python packages from requirements.txt to virtual environment in '$tempDir'."
30+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We install all required Python packages from requirements.txt to virtual environment in '$venvDir'."
3131
pip install --no-input --timeout 360 --retries 100 -r requirements.txt
3232
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Finished installing the requirements, now printing all installed packages."
3333
pip freeze
@@ -42,6 +42,6 @@ echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We now execute the website building script
4242
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Deactivating virtual environment."
4343
deactivate
4444
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Deleting virtual environment."
45-
rm -rf "$tempDir"
45+
rm -rf "$venvDir"
4646

4747
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We have finished the book building process."

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# You can find it at https://thomasweise.github.io/latexgit_py,
77
# https://github.com/thomasWeise/latexgit_py, or at
88
# https://pypi.org/project/latexgit.
9-
latexgit == 0.8.13
9+
latexgit == 0.8.14
1010

1111
# minify_html is needed to minify html output.
1212
minify_html == 0.15.0
@@ -15,4 +15,4 @@ minify_html == 0.15.0
1515
markdown == 3.6
1616

1717
# for converting files to HTML
18-
Pygments == 2.16.1
18+
Pygments == 2.18.0

scripts/filterPdf.sh

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ fileOut="$2"
1414

1515
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We will filter '$fileIn' to '$fileOut using ghostscript."
1616

17+
tempFileA="$(mktemp --suffix=.pdf)"
18+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We will first filter '$fileIn' to '$tempFileA' using ghostscript."
19+
1720
gs -dAntiAliasColorImages=true \
1821
-dAntiAliasGrayImages=true \
1922
-dAntiAliasMonoImages=true \
@@ -54,8 +57,58 @@ gs -dAntiAliasColorImages=true \
5457
-dSubsetFonts=true \
5558
-dUNROLLFORMS \
5659
-sDEVICE=pdfwrite \
57-
-sOutputFile="$fileOut" "$fileIn" \
60+
-sOutputFile="$tempFileA" "$fileIn" \
5861
-c "<</NeverEmbed [ ]>> setdistillerparams" \
5962
-q
6063

64+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We now filter '$tempFileA' to '$fileOut' using ghostscript."
65+
66+
gs -dAntiAliasColorImages=true \
67+
-dAntiAliasGrayImages=true \
68+
-dAntiAliasMonoImages=true \
69+
-dAutoFilterColorImages=false \
70+
-dAutoFilterGrayImages=false \
71+
-dAutoRotatePages=/None \
72+
-dBATCH \
73+
-dCannotEmbedFontPolicy=/Error \
74+
-dColorConversionStrategy=/LeaveColorUnchanged \
75+
-dColorImageFilter=/FlateEncode \
76+
-dCompressFonts=true \
77+
-dCompressStreams=true \
78+
-dDetectDuplicateImages=true \
79+
-dDownsampleColorImages=false \
80+
-dDownsampleGrayImages=false \
81+
-dDownsampleMonoImages=false \
82+
-dEmbedAllFonts=true \
83+
-dFastWebView=false \
84+
-dGrayImageFilter=/FlateEncode \
85+
-dHaveTransparency=true \
86+
-dMaxBitmap=2147483647 \
87+
-dNOPAUSE \
88+
-dOptimize=true \
89+
-dPassThroughJPEGImages=true \
90+
-dPassThroughJPXImages=true \
91+
-dPDFSTOPONERROR=true \
92+
-dPDFSTOPONWARNING=true \
93+
-dPreserveCopyPage=false \
94+
-dPreserveEPSInfo=false \
95+
-dPreserveHalftoneInfo=false \
96+
-dPreserveOPIComments=false \
97+
-dPreserveOverprintSettings=false \
98+
-dPreserveSeparation=false \
99+
-dPreserveDeviceN=false \
100+
-dPrinted=false \
101+
-dQUIET \
102+
-dSAFER \
103+
-dSubsetFonts=true \
104+
-dUNROLLFORMS \
105+
-sDEVICE=pdfwrite \
106+
-sOutputFile="$fileOut" "$tempFileA" \
107+
-c "<</NeverEmbed [ ]>> setdistillerparams" \
108+
-q
109+
110+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Now deleing '$tempFileA'."
111+
112+
rm "$tempFileA"
113+
61114
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Successfully finished filtering '$fileIn' to '$fileOut using ghostscript."

styles/latexgit.sty

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
%%
77
%% latexgit.dtx (with options: `package')
88
%% This is a generated file.
9-
%%
10-
%% Copyright (C) 2023 by Thomas Weise <http://iao.hfuu.edu.cn/5>
11-
%%
9+
%%
10+
%% Copyright (C) 2023--24 by Thomas Weise <http://iao.hfuu.edu.cn/5>
11+
%%
1212
%% This file may be distributed and/or modified under the conditions of the
1313
%% GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007.
1414
%% The license can be found at
@@ -19,7 +19,7 @@
1919
%% This work is author-maintained, i.e., it can only be maintained by
2020
%% Thomas Weise.
2121
\NeedsTeXFormat{LaTeX2e}[1999/12/01]%
22-
\ProvidesPackage{latexgit}[2023/12/05 0.8.1 A version with slightly improved documentation.]%
22+
\ProvidesPackage{latexgit}[2024/08/02 0.8.4 Improved Build Process.]%
2323
%%
2424
%%
2525
%%
@@ -35,6 +35,7 @@
3535

3636
\end{filecontents*}
3737
\protected\gdef\@latexgit@gitFile#1#2#3{}%
38+
\protected\gdef\@latexgit@process#1#2#3{}%
3839
%%
3940
%% Define a query to load and post-process a file from a |git| repository.
4041
%% #1 is the repository URL
@@ -61,6 +62,31 @@
6162
\xdef\gitUrl{http://example.com}%
6263
\fi% If we get here, the |\gitUrl| holds a valid URL.
6364
}%
65+
%%
66+
%% Define a query to execute a command, optionally in a |git| repository.
67+
%% #1 is the repository URL, or empty if no repository is needed
68+
%% #2 is the path to a directory inside the repository or empty
69+
%% #3 is a command to be executed
70+
\protected\gdef\gitExec#1#2#3{%
71+
\edef\@latexgit@pA{#1}% fully expand the repository URL
72+
\edef\@latexgit@pB{#2}% fully expand the path into the repository
73+
\edef\@latexgit@pC{#3}% fully expand the (optional) shell command
74+
\immediate\write\@mainaux{%
75+
\noexpand\@latexgit@process{\@latexgit@pA}{\@latexgit@pB}{\@latexgit@pC}}%
76+
\advance\@latexgit@counter by 1\relax%
77+
\edef\@latexgit@pathCmd{@latexgit@path\alphalph{\the\@latexgit@counter}}%
78+
\expandafter\ifcsname\@latexgit@pathCmd\endcsname\relax%
79+
\xdef\gitFile{\csname\@latexgit@pathCmd\endcsname}%
80+
\else%
81+
\xdef\gitFile{\@latexgit@dummyPath}%
82+
\fi% If we get here, the |\gitFile| command holds a valid path.
83+
\edef\@latexgit@urlCmd{@latexgit@url\alphalph{\the\@latexgit@counter}}%
84+
\expandafter\ifcsname\@latexgit@urlCmd\endcsname\relax%
85+
\xdef\gitUrl{\csname\@latexgit@urlCmd\endcsname}%
86+
\else%
87+
\xdef\gitUrl{}%
88+
\fi% If we get here, the |\gitUrl| holds a valid URL or is empty.
89+
}%
6490
\endinput
6591
%%
6692
%% End of file `latexgit.sty'.

text/main/basics/simpleDataTypesAndOperations/str/str.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
The quotation marks are only used to delimit the strings, i.e., to tell \python\ where the string begins or ends.
2222
They are not themselves part of the string.
2323

24-
\bestPractice{strDoubleQuote}{When defining a string literal, the double-quotation mark variant~(\pythonil{"..."}\pythonIdx{\textquotedbl}) is usually preferred over the single-quotation mark variant~(\pythonil{'...'}\pythonIdx{\textquotesingle}).}
24+
\bestPractice{strDoubleQuote}{When defining a string literal, the double-quotation mark variant~(\pythonil{"..."}\pythonIdx{\textquotedbl}) may be preferred over the single-quotation mark variant~(\pythonil{'...'}\pythonIdx{\textquotesingle}); see also~\cref{bp:longstrDoubleQuote}.}
2525

2626
One basic operation is string concatenation\pythonIdx{str!concatenation}\pythonIdx{str!+}\pythonIdx{+}:
2727
\pythonil{"Hello" + ' ' + "World"}\pythonIdx{\textquotedbl}\pythonIdx{\textquotesingle} concatenates the three strings \pythonil{"Hello"}, \pythonil{" "}, and \pythonil{"World"}.

0 commit comments

Comments
 (0)