File tree Expand file tree Collapse file tree 3 files changed +40
-5
lines changed
Expand file tree Collapse file tree 3 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -50,16 +50,16 @@ jobs:
5050 fonts-${{ hashFiles('scripts/download_fonts.sh') }}
5151 fonts-
5252 - uses : taiki-e/install-action@v2
53- if : steps.cache.outputs.cache-hit != 'true'
5453 with :
55- tool : ripgrep
54+ tool : ripgrep,sd
5655 - name : Install fonts
5756 shell : bash
5857 if : steps.cache.outputs.cache-hit != 'true'
5958 run : |
6059 bash scripts/download_fonts.sh
6160 - run : pnpm install
6261 - run : pnpm build
62+ - run : bash scripts/patch-htmldiff.sh
6363 - name : Setup Pages
6464 uses : actions/configure-pages@v5
6565 - name : Upload artifact
Original file line number Diff line number Diff line change 11[build ]
22command = """
33curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash && \
4- cargo-binstall typst-cli ripgrep && \
4+ cargo-binstall typst-cli ripgrep sd && \
55\
66curl -OL https://www.7-zip.org/a/7z2409-linux-x64.tar.xz && \
77tar -xvf 7z2409-linux-x64.tar.xz 7zz && ln -s 7zz 7z && \
@@ -10,9 +10,18 @@ export PATH=$PATH:$(pwd) && \
1010bash scripts/download_fonts.sh && \
1111\
1212pnpm install && \
13- pnpm build
13+ pnpm build && \
14+ \
15+ bash scripts/patch-htmldiff.sh
1416"""
15- # `cargo binstall` not works here
17+ # Remarks: `cargo-binstall` works, but `cargo binstall` not.
18+
19+
20+ [[headers ]]
21+ for = " /assets/*"
22+ [headers .values ]
23+ Access-Control-Allow-Origin = " https://services.w3.org" # Allow CORS for /htmldiff
24+
1625
1726[[plugins ]]
1827package = " netlify-plugin-cache"
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euxo pipefail
3+
4+ # Patch htmldiff
5+ #
6+ # https://services.w3.org/htmldiff is running `htmldiff` (the python script),
7+ # and it will execute `htmldiff.pl` in CLI (rather than CGI) mode.
8+ #
9+ # The commit version might be the following:
10+ # https://github.com/w3c/htmldiff-ui/blob/5eac9b073c66b24422df613a537da2ec2f97f457/htmldiff.pl
11+
12+ # Set base.
13+ # Otherwise, CSS & JS will go to services.w3.org.
14+ #
15+ # This CGI-mode feature is missing in CLI mode.
16+ # https://github.com/w3c/htmldiff-ui/blob/5eac9b073c66b24422df613a537da2ec2f97f457/htmldiff.pl#L560-L563
17+ if [[ " ${NETLIFY:- false} " == " true" ]]; then
18+ sd --fixed-strings " <head>" " <head><base href='$DEPLOY_URL /'>" dist/index.html
19+ fi
20+
21+ # Ensure at least one newline before every `</pre>`.
22+ #
23+ # This is a bug.
24+ # When `<pre>` and `</pre>` is on the same line, `splitit` should set `$preformatted` to true, but not.
25+ # https://github.com/w3c/htmldiff-ui/blob/main/htmldiff.pl#L406-L412
26+ sd --fixed-strings " </pre>" $' \n </pre>' dist/index.html
You can’t perform that action at this time.
0 commit comments