]> git.draconx.ca Git - homepage.git/commitdiff
cdecl99-1.3 bash-5 hotfix master
authorNick Bowler <nbowler@draconx.ca>
Wed, 17 Apr 2024 02:34:19 +0000 (22:34 -0400)
committerNick Bowler <nbowler@draconx.ca>
Wed, 17 Apr 2024 02:40:49 +0000 (22:40 -0400)
Turns out that prior to release the package was not tested on any
systems where /bin/sh is bash-5, and the configure script hits a
parser bug in this shell regarding for loops in case statements.

A workaround is to set CONFIG_SHELL environment variable to some
other shell without this bug.  But if that's not possible, this
patch can be applied to avoid the bug.

50 files changed:
.gitmodules
content/archive/cdecl99/cdecl99-1.3-bash5-fix.patch [new file with mode: 0644]
content/archive/cdecl99/cdecl99-1.3.tar.gz [new symlink]
content/archive/cdecl99/cdecl99-1.3.tar.gz.sig [new symlink]
content/archive/cdecl99/cdecl99-1.3.tar.lz [new symlink]
content/archive/cdecl99/cdecl99-1.3.tar.lz.sig [new symlink]
content/archive/rarpd-dx/rarpd-dx-1.tar.gz [new symlink]
content/archive/rarpd-dx/rarpd-dx-1.tar.gz.sig [new symlink]
content/archive/rarpd-dx/rarpd-dx-1.tar.lz [new symlink]
content/archive/rarpd-dx/rarpd-dx-1.tar.lz.sig [new symlink]
content/images/eclipse-20240408-143755.jpg [new symlink]
content/images/eclipse-20240408-143755.yaml [new file with mode: 0644]
content/images/eclipse-20240408-151623.jpg [new symlink]
content/images/eclipse-20240408-151623.yaml [new file with mode: 0644]
content/images/eclipse-20240408-152435.jpg [new symlink]
content/images/eclipse-20240408-152435.yaml [new file with mode: 0644]
content/images/eclipse-20240408-152639.jpg [new symlink]
content/images/eclipse-20240408-152639.yaml [new file with mode: 0644]
content/images/eclipse-20240408-152802.jpg [new symlink]
content/images/eclipse-20240408-152802.yaml [new file with mode: 0644]
content/images/eclipse-20240408-152846.jpg [new symlink]
content/images/eclipse-20240408-152846.yaml [new file with mode: 0644]
content/images/m48t59y-fixed.jpg [new symlink]
content/images/m48t59y-fixed.yaml [new file with mode: 0644]
content/images/m48t59y-installed.jpg [new symlink]
content/images/m48t59y-installed.yaml [new file with mode: 0644]
content/images/m48t59y-solder.jpg [new symlink]
content/images/m48t59y-solder.yaml [new file with mode: 0644]
content/images/m48t59y-terminals.jpg [new symlink]
content/images/m48t59y-terminals.yaml [new file with mode: 0644]
content/images/m48t59y.jpg [new symlink]
content/images/m48t59y.yaml [new file with mode: 0644]
content/projects.md
content/projects/cdecl99.md
content/projects/rarpd-dx.md [new file with mode: 0644]
content/projects/rrace.md [new file with mode: 0644]
content/style.scss
content/weblog/eclipse-20240408.md [new file with mode: 0644]
content/weblog/ultra60-nvram.md [new file with mode: 0644]
gitmodules/cdecl99
gitmodules/rarpd-dx [new submodule]
gitmodules/rrace [new submodule]
layouts/default.xml
layouts/default.xsl
layouts/functions.xsl
layouts/whitespace.xsl [new file with mode: 0644]
lib/compiledcontent.rb
lib/css-darkmode.rb
lib/helpers.rb
tools/weblog-update.rb

index d345e88f3f97574a85a92d3c00aaf546522f22bc..f24b460ec36277bc41598ea93e6d9ce69100bd7d 100644 (file)
@@ -4,3 +4,9 @@
 [submodule "gitmodules/cdecl99"]
        path = gitmodules/cdecl99
        url = https://git.draconx.ca/cdecl99.git
+[submodule "gitmodules/rrace"]
+       path = gitmodules/rrace
+       url = https://git.draconx.ca/rrace.git
+[submodule "gitmodules/rarpd-dx"]
+       path = gitmodules/rarpd-dx
+       url = https://git.draconx.ca/rarpd-dx.git
diff --git a/content/archive/cdecl99/cdecl99-1.3-bash5-fix.patch b/content/archive/cdecl99/cdecl99-1.3-bash5-fix.patch
new file mode 100644 (file)
index 0000000..0ffc323
--- /dev/null
@@ -0,0 +1,49 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+NotDashEscaped: You need gpg to verify this message
+
+The configure script included with the cdecl99-1.3 release fails on
+bash-5 due to a parser bug in this shell.  On affected systems, a
+message similar to the following may be seen when running configure:
+
+  ./configure: line 6631: syntax error near unexpected token `do'
+  ./configure: line 6631: `do'
+
+You can work around the problem by setting the CONFIG_SHELL environment
+variable to some other shell before running configure; otherwise you can
+apply this patch file with a command such as:
+
+  % cd cdecl99-1.3
+  % patch -p1 <cdecl99-1.3-bash5-fix.patch
+
+*** cdecl99-1.3.orig/configure
+--- cdecl99-1.3/configure
+***************
+*** 6626,6633 ****
+    $as_echo_n "(cached) " >&6
+  else
+    dx_cv_have_alignas=no
+! for _dx_alignas
+! in '_Alignas(X)' '__attribute__((__aligned__(X)))' '__declspec(align(X))'
+  do
+  if ac_fn_c_compute_int "$LINENO" "sizeof (struct { char a; char ALIGNAS_TEST(4) b; }) >= 8" "_dx_tmp"        "#include <stddef.h>
+  #define ALIGNAS_TEST(X) $_dx_alignas
+--- 6626,6632 ----
+    $as_echo_n "(cached) " >&6
+  else
+    dx_cv_have_alignas=no
+! for _dx_alignas in '_Alignas(X)' '__attribute__((__aligned__(X)))' '__declspec(align(X))'
+  do
+  if ac_fn_c_compute_int "$LINENO" "sizeof (struct { char a; char ALIGNAS_TEST(4) b; }) >= 8" "_dx_tmp"        "#include <stddef.h>
+  #define ALIGNAS_TEST(X) $_dx_alignas
+-----BEGIN PGP SIGNATURE-----
+
+iQEzBAEBCAAdFiEEJagcgrvBtB9dtMuDW0XT0YW44fYFAmYfNBUACgkQW0XT0YW4
+4famBQf9GhDZJGOvrkDB5dGWwieXqFCWXJBbATVbY8JmY5wJupke5MqvDEQJ3tBr
+A2YIcQZ67+KjA2LwWTTQhQgKkveQs1HWFdTDrHnhTm4dF4jZdlxwVK3K3kHCcref
+uW+vl/6C9YkKcVcbf8OeHT4JVgYv2h7XRKW69XIB6lchdMc6rGNeStuCHyuGKYWG
+7n3WH9bA5OBPmPAd6yUPmU4urWBHjZwxyTaFBYBO7T+9R3Q4KvvyzCfxt1JxTUPS
+SmiQC1B0gg16/N2XJzCmnBsaVXSHdsvt8UrZeIZyWipejqtb2UR1MVnVToz/83NO
+gh5tyhxXnYiQgRqd2/uRg9z+GzziDw==
+=/RXF
+-----END PGP SIGNATURE-----
diff --git a/content/archive/cdecl99/cdecl99-1.3.tar.gz b/content/archive/cdecl99/cdecl99-1.3.tar.gz
new file mode 120000 (symlink)
index 0000000..b948234
--- /dev/null
@@ -0,0 +1 @@
+../../../.git/annex/objects/v9/65/SHA512-s897087--54ab0ce2db34beaee220cbed936b009added5a51b901c2251c7767df6e63a84a8ce6f59b59ec6b00925c2845674a8d5ef02e620bd5eb8074b52cd07441c005cd/SHA512-s897087--54ab0ce2db34beaee220cbed936b009added5a51b901c2251c7767df6e63a84a8ce6f59b59ec6b00925c2845674a8d5ef02e620bd5eb8074b52cd07441c005cd
\ No newline at end of file
diff --git a/content/archive/cdecl99/cdecl99-1.3.tar.gz.sig b/content/archive/cdecl99/cdecl99-1.3.tar.gz.sig
new file mode 120000 (symlink)
index 0000000..57d10b0
--- /dev/null
@@ -0,0 +1 @@
+../../../.git/annex/objects/4v/p3/SHA512-s310--b4b196e4df43c18634ba5dcc8823cf677931ceb0bd2965713db0a078d29e979c601f190e854caed60af7d7249a60f2b39cbd86c1bcdb9b43827945aa5acd5669/SHA512-s310--b4b196e4df43c18634ba5dcc8823cf677931ceb0bd2965713db0a078d29e979c601f190e854caed60af7d7249a60f2b39cbd86c1bcdb9b43827945aa5acd5669
\ No newline at end of file
diff --git a/content/archive/cdecl99/cdecl99-1.3.tar.lz b/content/archive/cdecl99/cdecl99-1.3.tar.lz
new file mode 120000 (symlink)
index 0000000..8382932
--- /dev/null
@@ -0,0 +1 @@
+../../../.git/annex/objects/3j/wf/SHA512-s591522--11f04eeda91ef127f6e3d5ef5e2cbb135e6a1f46a138640decbe80ed687c9fd2110a94b2fd883d8d0125704b36760c89cf41aeb5005f7965721b85fb55826b6c/SHA512-s591522--11f04eeda91ef127f6e3d5ef5e2cbb135e6a1f46a138640decbe80ed687c9fd2110a94b2fd883d8d0125704b36760c89cf41aeb5005f7965721b85fb55826b6c
\ No newline at end of file
diff --git a/content/archive/cdecl99/cdecl99-1.3.tar.lz.sig b/content/archive/cdecl99/cdecl99-1.3.tar.lz.sig
new file mode 120000 (symlink)
index 0000000..fbb9bb9
--- /dev/null
@@ -0,0 +1 @@
+../../../.git/annex/objects/3k/Mp/SHA512-s310--5c1d52ff133aeaaa7be59f5ec394ecf95d29341eb491909a12412f246b1d88251e6449aab9385797d0d3bf23eb6ff8fd8eedf80dbc446c4d61f5dbf43dc45ed4/SHA512-s310--5c1d52ff133aeaaa7be59f5ec394ecf95d29341eb491909a12412f246b1d88251e6449aab9385797d0d3bf23eb6ff8fd8eedf80dbc446c4d61f5dbf43dc45ed4
\ No newline at end of file
diff --git a/content/archive/rarpd-dx/rarpd-dx-1.tar.gz b/content/archive/rarpd-dx/rarpd-dx-1.tar.gz
new file mode 120000 (symlink)
index 0000000..5ed165b
--- /dev/null
@@ -0,0 +1 @@
+../../../.git/annex/objects/fv/p8/SHA512-s105283--742eeeccb8eba6daea7294ab696cd9e2ad92e84c1b81d5512c8654c5d1df258d5584c360569fe41b73b84757f0cfea93d5da1b67de59b4b920610009068b85de/SHA512-s105283--742eeeccb8eba6daea7294ab696cd9e2ad92e84c1b81d5512c8654c5d1df258d5584c360569fe41b73b84757f0cfea93d5da1b67de59b4b920610009068b85de
\ No newline at end of file
diff --git a/content/archive/rarpd-dx/rarpd-dx-1.tar.gz.sig b/content/archive/rarpd-dx/rarpd-dx-1.tar.gz.sig
new file mode 120000 (symlink)
index 0000000..6c7a819
--- /dev/null
@@ -0,0 +1 @@
+../../../.git/annex/objects/g6/j8/SHA512-s310--b40653638706881f135868329359e00c0c55134fadebebb4572f93de79c3d2ff39f6c0af7ad5dcc16f1ed9dd3b2afdca8b9af8dbd071a6b19afabc104658feb6/SHA512-s310--b40653638706881f135868329359e00c0c55134fadebebb4572f93de79c3d2ff39f6c0af7ad5dcc16f1ed9dd3b2afdca8b9af8dbd071a6b19afabc104658feb6
\ No newline at end of file
diff --git a/content/archive/rarpd-dx/rarpd-dx-1.tar.lz b/content/archive/rarpd-dx/rarpd-dx-1.tar.lz
new file mode 120000 (symlink)
index 0000000..cbf3770
--- /dev/null
@@ -0,0 +1 @@
+../../../.git/annex/objects/65/5W/SHA512-s82601--3642314e7390074a50f080c1d3039b1db6d57895efd40a8285a2cc95f5777962282b11edfee3a17caa10fe9c4dc129729fe4b3c6c02ddb411d1b6d57186e1278/SHA512-s82601--3642314e7390074a50f080c1d3039b1db6d57895efd40a8285a2cc95f5777962282b11edfee3a17caa10fe9c4dc129729fe4b3c6c02ddb411d1b6d57186e1278
\ No newline at end of file
diff --git a/content/archive/rarpd-dx/rarpd-dx-1.tar.lz.sig b/content/archive/rarpd-dx/rarpd-dx-1.tar.lz.sig
new file mode 120000 (symlink)
index 0000000..c219a09
--- /dev/null
@@ -0,0 +1 @@
+../../../.git/annex/objects/k5/6V/SHA512-s310--530702e16b139db74862244dde8ddbb8d8618c462b935e3e9bc02fdf7e0fa58ff4d952aa444acfb524e4e4c0f2317a7c20a6cc65ec64ff2f9442b9a5753cfafe/SHA512-s310--530702e16b139db74862244dde8ddbb8d8618c462b935e3e9bc02fdf7e0fa58ff4d952aa444acfb524e4e4c0f2317a7c20a6cc65ec64ff2f9442b9a5753cfafe
\ No newline at end of file
diff --git a/content/images/eclipse-20240408-143755.jpg b/content/images/eclipse-20240408-143755.jpg
new file mode 120000 (symlink)
index 0000000..36f5d3c
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/zX/Px/SHA512-s389810--6d85094e85dbfcc4e73a7861d7992ab8d89d31f369ecc6d977ed89f646a96344dc9361374f8f08ba91f426acf9fdf53bfaad89f3f66563822cfc852b93f4cdef/SHA512-s389810--6d85094e85dbfcc4e73a7861d7992ab8d89d31f369ecc6d977ed89f646a96344dc9361374f8f08ba91f426acf9fdf53bfaad89f3f66563822cfc852b93f4cdef
\ No newline at end of file
diff --git a/content/images/eclipse-20240408-143755.yaml b/content/images/eclipse-20240408-143755.yaml
new file mode 100644 (file)
index 0000000..7eb4d34
--- /dev/null
@@ -0,0 +1,4 @@
+---
+title: 2024-04-08 Solar Eclipse near Cornwall, ON
+copyright: 2024 Nick Bowler
+license: cc-by-sa-4.0
diff --git a/content/images/eclipse-20240408-151623.jpg b/content/images/eclipse-20240408-151623.jpg
new file mode 120000 (symlink)
index 0000000..5b3949f
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/7V/zg/SHA512-s302673--ee3080ea9d00aed29a5af1d407e7dfad733a63131a907cb2d52c7b4342a552bf1b2ad9fa4bd062b96d3355162e09220c14134180091db3d3c9fca5b2f2da464a/SHA512-s302673--ee3080ea9d00aed29a5af1d407e7dfad733a63131a907cb2d52c7b4342a552bf1b2ad9fa4bd062b96d3355162e09220c14134180091db3d3c9fca5b2f2da464a
\ No newline at end of file
diff --git a/content/images/eclipse-20240408-151623.yaml b/content/images/eclipse-20240408-151623.yaml
new file mode 100644 (file)
index 0000000..7eb4d34
--- /dev/null
@@ -0,0 +1,4 @@
+---
+title: 2024-04-08 Solar Eclipse near Cornwall, ON
+copyright: 2024 Nick Bowler
+license: cc-by-sa-4.0
diff --git a/content/images/eclipse-20240408-152435.jpg b/content/images/eclipse-20240408-152435.jpg
new file mode 120000 (symlink)
index 0000000..5abb405
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/v5/gQ/SHA512-s273018--1a0d88d6b0756be9b23771154e7062da73c442e3f9f8222a6097b8c079382effe64fd7db6f0f763968d983aa9dada88be56932ebee68cbb59e01523ef483662f/SHA512-s273018--1a0d88d6b0756be9b23771154e7062da73c442e3f9f8222a6097b8c079382effe64fd7db6f0f763968d983aa9dada88be56932ebee68cbb59e01523ef483662f
\ No newline at end of file
diff --git a/content/images/eclipse-20240408-152435.yaml b/content/images/eclipse-20240408-152435.yaml
new file mode 100644 (file)
index 0000000..7eb4d34
--- /dev/null
@@ -0,0 +1,4 @@
+---
+title: 2024-04-08 Solar Eclipse near Cornwall, ON
+copyright: 2024 Nick Bowler
+license: cc-by-sa-4.0
diff --git a/content/images/eclipse-20240408-152639.jpg b/content/images/eclipse-20240408-152639.jpg
new file mode 120000 (symlink)
index 0000000..21e8d49
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/wf/58/SHA512-s348783--191e38f10a9f3d6c3e2334795e342b6ea92ba37e28502e102bf3034aae65e0c8bd9fdd8af9847e33e54059f4bcb6f6597394e1e76ff27403b4d606375735e62f/SHA512-s348783--191e38f10a9f3d6c3e2334795e342b6ea92ba37e28502e102bf3034aae65e0c8bd9fdd8af9847e33e54059f4bcb6f6597394e1e76ff27403b4d606375735e62f
\ No newline at end of file
diff --git a/content/images/eclipse-20240408-152639.yaml b/content/images/eclipse-20240408-152639.yaml
new file mode 100644 (file)
index 0000000..d162875
--- /dev/null
@@ -0,0 +1,7 @@
+---
+title: 2024-04-08 Total Solar Eclipse near Cornwall, ON
+copyright: 2024 Nick Bowler
+license: cc-by-sa-4.0
+description: |
+  The Sun's corona is visible during totality.  The red spots on the fringes
+  are likely solar prominences.
diff --git a/content/images/eclipse-20240408-152802.jpg b/content/images/eclipse-20240408-152802.jpg
new file mode 120000 (symlink)
index 0000000..1eafa28
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/34/ZV/SHA512-s520397--1fb51e2946228e45bffa5b8552ad9243a52e8ba6fb8715a3885c602d0046a84724795717b4674753bf202dceefa2bee263a853909222217405889b5258db14d8/SHA512-s520397--1fb51e2946228e45bffa5b8552ad9243a52e8ba6fb8715a3885c602d0046a84724795717b4674753bf202dceefa2bee263a853909222217405889b5258db14d8
\ No newline at end of file
diff --git a/content/images/eclipse-20240408-152802.yaml b/content/images/eclipse-20240408-152802.yaml
new file mode 100644 (file)
index 0000000..bc26d22
--- /dev/null
@@ -0,0 +1,7 @@
+---
+title: 2024-04-08 Diamond Ring near Cornwall, ON
+copyright: 2024 Nick Bowler
+license: cc-by-sa-4.0
+description: |
+  The sun's disc peeks out again at third contact producing the diamond ring
+  effect.
diff --git a/content/images/eclipse-20240408-152846.jpg b/content/images/eclipse-20240408-152846.jpg
new file mode 120000 (symlink)
index 0000000..f49afd2
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/W3/KV/SHA512-s295663--d941929c012be29bbb82e9c22b69280a64b7e9e21321cc7faf2e65088eb251deed5aa2a16b6820473fba40a1057dc72d6b3444e3b916691e8d68322b8d9e1201/SHA512-s295663--d941929c012be29bbb82e9c22b69280a64b7e9e21321cc7faf2e65088eb251deed5aa2a16b6820473fba40a1057dc72d6b3444e3b916691e8d68322b8d9e1201
\ No newline at end of file
diff --git a/content/images/eclipse-20240408-152846.yaml b/content/images/eclipse-20240408-152846.yaml
new file mode 100644 (file)
index 0000000..7eb4d34
--- /dev/null
@@ -0,0 +1,4 @@
+---
+title: 2024-04-08 Solar Eclipse near Cornwall, ON
+copyright: 2024 Nick Bowler
+license: cc-by-sa-4.0
diff --git a/content/images/m48t59y-fixed.jpg b/content/images/m48t59y-fixed.jpg
new file mode 120000 (symlink)
index 0000000..d0f066e
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/wK/GG/SHA512-s215590--23ec4d09ab8ed674c51d1fa81145f4983e207ca989ec65c3035ba49c876aa01c37df3ca458b80ab7863607ec80ec8ac950bd03e7d83ec493adc40fef80c55f8d/SHA512-s215590--23ec4d09ab8ed674c51d1fa81145f4983e207ca989ec65c3035ba49c876aa01c37df3ca458b80ab7863607ec80ec8ac950bd03e7d83ec493adc40fef80c55f8d
\ No newline at end of file
diff --git a/content/images/m48t59y-fixed.yaml b/content/images/m48t59y-fixed.yaml
new file mode 100644 (file)
index 0000000..6038682
--- /dev/null
@@ -0,0 +1,6 @@
+---
+title: M48T59Y-70PC1 With Battery Clip
+copyright: 2022 Nick Bowler
+license: cc-by-sa-4.0
+description: |
+  Finished repair of M48T59Y part with external battery clip glued on top.
diff --git a/content/images/m48t59y-installed.jpg b/content/images/m48t59y-installed.jpg
new file mode 120000 (symlink)
index 0000000..2fa0639
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/jF/WK/SHA512-s821129--859631534da810c3a29d2246edf97a8d6a61a2ac67c21e18aee2753eb96a38a2856e45278f44db7a7a0ef9bb1c1ae6b00bc32e72b9b143b5d14a8abc7e376a1d/SHA512-s821129--859631534da810c3a29d2246edf97a8d6a61a2ac67c21e18aee2753eb96a38a2856e45278f44db7a7a0ef9bb1c1ae6b00bc32e72b9b143b5d14a8abc7e376a1d
\ No newline at end of file
diff --git a/content/images/m48t59y-installed.yaml b/content/images/m48t59y-installed.yaml
new file mode 100644 (file)
index 0000000..2c74fe6
--- /dev/null
@@ -0,0 +1,6 @@
+---
+title: M48T59Y-70PC1 Repair Complete
+copyright: 2022 Nick Bowler
+license: cc-by-sa-4.0
+description: |
+  Repaired M48T59Y chip installed onto the Sun Ultra 60 motherboard.
diff --git a/content/images/m48t59y-solder.jpg b/content/images/m48t59y-solder.jpg
new file mode 120000 (symlink)
index 0000000..5d8078e
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/8M/9g/SHA512-s146926--2dd1f0b920387121d4e1f658f151417d55d65dfa27a6b397343deeebde08636236a0e123a9cfa3fdeef8204425c3f7d00a5e5dcee121126535a140a059f6fb04/SHA512-s146926--2dd1f0b920387121d4e1f658f151417d55d65dfa27a6b397343deeebde08636236a0e123a9cfa3fdeef8204425c3f7d00a5e5dcee121126535a140a059f6fb04
\ No newline at end of file
diff --git a/content/images/m48t59y-solder.yaml b/content/images/m48t59y-solder.yaml
new file mode 100644 (file)
index 0000000..dc6253b
--- /dev/null
@@ -0,0 +1,7 @@
+---
+title: M48T59Y-70PC1 Wire Leads
+copyright: 2022 Nick Bowler
+license: cc-by-sa-4.0
+description: |
+  M48T59Y with battery leads connected, after disconnecting the internal
+  battery tabs.
diff --git a/content/images/m48t59y-terminals.jpg b/content/images/m48t59y-terminals.jpg
new file mode 120000 (symlink)
index 0000000..795475d
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/98/V1/SHA512-s186948--c3277cf2aea7e159ee6203e9c7f5330f3a1c79a4d2c347c7637c19f354c7cafe2181b54fd40e84eba434a16340fb9cd3a87e76a636d45278846cb46c3d1f606e/SHA512-s186948--c3277cf2aea7e159ee6203e9c7f5330f3a1c79a4d2c347c7637c19f354c7cafe2181b54fd40e84eba434a16340fb9cd3a87e76a636d45278846cb46c3d1f606e
\ No newline at end of file
diff --git a/content/images/m48t59y-terminals.yaml b/content/images/m48t59y-terminals.yaml
new file mode 100644 (file)
index 0000000..806df38
--- /dev/null
@@ -0,0 +1,8 @@
+---
+title: M48T59Y-70PC1 Battery Terminals
+copyright: 2022 Nick Bowler
+license: cc-by-sa-4.0
+description: |
+  M48T59Y with internal battery connections exposed.  The negative connection
+  is on the left, closest to pin 14.  The positive connection is on the right,
+  closest to pin 16.
diff --git a/content/images/m48t59y.jpg b/content/images/m48t59y.jpg
new file mode 120000 (symlink)
index 0000000..40e10d3
--- /dev/null
@@ -0,0 +1 @@
+../../.git/annex/objects/5f/mJ/SHA512-s141937--ebbd8a2ad4b6d4f1c6d66d9f7ba76685c5281bff3d0fb34f7e00e3016b8422c4935aa9b87caa1c4f8ed9b1b7f727b4f2c97d49991f483317c8248f536c225620/SHA512-s141937--ebbd8a2ad4b6d4f1c6d66d9f7ba76685c5281bff3d0fb34f7e00e3016b8422c4935aa9b87caa1c4f8ed9b1b7f727b4f2c97d49991f483317c8248f536c225620
\ No newline at end of file
diff --git a/content/images/m48t59y.yaml b/content/images/m48t59y.yaml
new file mode 100644 (file)
index 0000000..7258310
--- /dev/null
@@ -0,0 +1,9 @@
+---
+title: M48T59Y-70PC1
+copyright: 2022 Nick Bowler
+license: cc-by-sa-4.0
+description: |
+  <p>The <abbr title="Non-Volatile Random Access Memory">NVRAM</abbr> module
+  used in my Sun Ultra 60 workstation.  This combines a normal memory with a
+  real-time clock and an internal lithium primary cell to maintain everything.
+  However, the internal cell is long dead so this chip is dead too.</p>
index 90413c9153cd7d64d0c037543d4938ad1e11443d..8db0c429b9203360a652e6afb12c3efdbca05782 100644 (file)
@@ -4,6 +4,9 @@ copyright: 2019 Nick Bowler
 license: cc-by-nd-4.0
 ---
 
+*[RARP]: Reverse Address Resolution Protocol
+*[ARP]: Address Resolution Protocol
+
 Most of the operations here in the workshop are tracked on our local [git
 server](//git.draconx.ca) which can be browsed online.  All the work here is
 [free as in freedom](//www.gnu.org/philosophy/free-sw) which means you are
index c083ba576368d37d7694d39eb6ede9c0993e5c3d..c2fb9f498c9221d27bc4546ce3fce57f55765fed 100644 (file)
@@ -1,9 +1,9 @@
 ---
 title: Cdecl99
-copyright: 2021-2022 Nick Bowler
+copyright: 2021-2024 Nick Bowler
 license: gpl-3 or (at your option) any later version
 module: cdecl99
-release: v1.2
+release: v1.3
 ---
 
 <%= project_readme %>
diff --git a/content/projects/rarpd-dx.md b/content/projects/rarpd-dx.md
new file mode 100644 (file)
index 0000000..9eaf368
--- /dev/null
@@ -0,0 +1,13 @@
+---
+title: RARP Daemon
+copyright: 2023 Nick Bowler
+license: gpl-2 or (at your option) any later version
+module: rarpd-dx
+release: v1
+---
+
+*[RARP]: Reverse Address Resolution Protocol
+*[ARP]: Address Resolution Protocol
+
+<%= project_readme %>
+
diff --git a/content/projects/rrace.md b/content/projects/rrace.md
new file mode 100644 (file)
index 0000000..b5a111f
--- /dev/null
@@ -0,0 +1,8 @@
+---
+title: RRace
+copyright: 2022 Nick Bowler
+license: gpl-3 or (at your option) any later version
+module: rrace
+---
+
+<%= project_readme %>
index 2708bb462e00c701f9b563fe9dec8ac94f67d9e5..17aff0ba0352f3a0ccf5ab9117e82c2c6e27e11e 100644 (file)
@@ -67,6 +67,8 @@ h1 { @include header_size(60em, 2em); }
 h2 { @include header_size(60em, 1.5em); }
 h5 { @include header_size(60em, 1em); }
 
+h1, h2 { abbr { text-decoration: none; } }
+
 @supports (display: grid) {
     .gallery {
         display: grid;
@@ -76,6 +78,16 @@ h5 { @include header_size(60em, 1em); }
 
         p.img { margin: 0.5em 0; }
     }
+
+    @media (max-width: 45em) {
+        .inline.gallery {
+            display: block;
+            p.img {
+                a { max-width: 24em; }
+                margin: 1em 0;
+            }
+        }
+    }
 }
 
 p.img {
@@ -94,12 +106,22 @@ p.img {
         border: solid 2px;
     }
 
+    a.left { margin: 0 1em 0.5em 0; float: left; clear: left; }
+    a.right { margin: 0 0 0.5em 1em; float: right; clear: right; }
+    a.left, a.right {
+        @media (max-width: 45em) { float: none; margin: 0; }
+
+        max-width: 24em;
+    }
+
     small {
         @include usecolours($color: foreground);
-        text-align: justify;
         @media (max-width: 24em) { text-align: left; }
         padding: 0.5ex;
         display: block;
+        display: -moz-inline-box;
+        display: inline-block;
+        text-align: justify;
         font-size: 0.9em;
     }
 }
@@ -137,10 +159,12 @@ kbd {
     font-family: monospace;
     font-size: 0.95em;
     &:before { content: "% "; }
+    &.ok:before { content: "ok "; }
     &>span { white-space: nowrap; }
 
     blockquote & {
         display: block;
+        & + br { display: none; }
         text-align: left;
         padding-left: 3em;
         text-indent: -3em;
@@ -160,6 +184,7 @@ kbd {
 table {
     @include usecolour(border-top, ruledefault, 1px solid);
     border-collapse: collapse;
+    clear: both;
     width: 100%;
 }
 
@@ -203,8 +228,8 @@ table.cc {
     }
 }
 
-// CSS rules for stortable clicky table headers: Update the display of
-// the /table based on the current state.  Each column has its own set
+// CSS rules for sortable clicky table headers: Update the display of
+// the table based on the current state.  Each column has its own set
 // nearly-identical rules, only the class names differ.
 //
 // The clickytables.xsl stylesheet generates two inputs for each column.
diff --git a/content/weblog/eclipse-20240408.md b/content/weblog/eclipse-20240408.md
new file mode 100644 (file)
index 0000000..0cf01bf
--- /dev/null
@@ -0,0 +1,14 @@
+---
+title: Solar Eclipse near Cornwall on 2024-04-08
+copyright: 2024 Nick Bowler
+license: cc-by-sa-4.0
+published: 2024-04-09T00:44:23-0400
+updated: 2024-04-09T21:04:19-0400
+---
+
+More to come...
+
+<% images = @items.find_all("/images/eclipse-20240408*.jpg")
+images.sort_by(&:identifier).each do |item| %>
+<%= gallery_img(item, caption: "") %>
+<% end %>
diff --git a/content/weblog/ultra60-nvram.md b/content/weblog/ultra60-nvram.md
new file mode 100644 (file)
index 0000000..ec96370
--- /dev/null
@@ -0,0 +1,101 @@
+---
+title: M48T59Y-70PC1 NVRAM Battery Replacement
+copyright: 2022 Nick Bowler
+license: cc-by-sa-4.0
+published: 2022-07-09T12:12:21-0400
+---
+
+*[NVRAM]: Non-Volatile Random Access Memory
+*[SRAM]: Static Random-Access Memory
+*[NOS]: New Old Stock
+*[DIP]: Dual In-line Package
+*[SOIC]: Small-Outline Integrated Circuit
+*[MAC]: Media Access Control
+
+Thanks to [Mark Henderson's Sun NVRAM FAQ][nvram-faq] for providing invaluable
+insight regarding this repair.
+{:article-info="article-info"}
+
+[nvram-faq]: http://web.archive.org/web/20150919135835/http://www.squirrel.com/sun-nvram-hostid.faq.html
+
+The Sun Ultra 60 workstation uses an ST M48T59Y-70PC1 battery-backed SRAM with
+real-time clock.  When the embedded lithium primary cell inevitably dies, the
+chip is essentially useless.  The most noticeable negative effect of a dead
+chip is that the workstation always powers up in a default configuration with
+diag-switch?  true, running several minutes of self tests every time, with
+bogus MAC and host ID values.
+
+<%= floating_img(@items["/images/m48t59y.jpg"], caption: <<EOF
+You don't even know you are already dead.
+EOF
+) %>
+
+This device was branded obsolescent by the manufacturer in April of 2008 and
+has presumably been out of production since around that time.  Similar chips
+like the M48T58Y are still made but they are expensive (around $40) and slight
+differences may result in compatibility problems.  It appears that NOS parts
+can be found fairly cheap online but these must be almost 15 years old by now
+and who knows what state the embedded batteries are in.  No thanks.
+
+One option could be to find the SOIC version of the M48T59Y for which NOS also
+seems to be available, although somewhat less readily than the DIP modules, and
+then construct an adapter board to fit into the DIP socket on the motherboard.
+The SOIC package does not include the battery and crystal; instead, it has
+contacts on the top to attach a separate "SNAPHAT" package which are still
+made.  This would be complicated and somewhat expensive.
+
+Fortunately, a straightforward (if time-consuming) repair is possible.  This
+is a literal hackjob: we can dig through the potting to expose the battery
+terminals, disconnect the internal battery, and connect a normal battery clip.
+This enables the use of readily-available CR2032 lithium primary cells that can
+be replaced as needed, just like a normal PC.  Since we already have the chip
+we need, it is not necessary to source any obscure or expensive components.
+
+<%=
+floating_img(@items["/images/m48t59y-terminals.jpg"], left: 1, caption: '')
+%>
+
+<%=
+floating_img(@items["/images/m48t59y-solder.jpg"], left: 1, caption: '')
+%>
+
+The battery contacts are located on the end opposite pin 1, between pins
+14 and 15.  Looking underneath the chip there is a small well at either end
+filled with potting compound.  The battery connections are inside one of
+these.  Using a knife, cut back the plastic outer shell on the battery side,
+then begin scraping away potting compound until the terminals are exposed.
+You can use a suitable DIP socket to help protect the pins from accidental
+damage.
+
+Once the terminals are exposed, the internal battery must be disconnected.
+The thick protruding tabs near the bottom of the module are what we want
+to solder to.  The vertical strips going up and into the module are the
+internal battery terminals.  These can be desoldered from the tabs and
+lifted out of the way, or simply cut off.
+
+With the time-consuming parts completed it is a straightforward matter to
+connect a normal battery clip to the exposed terminals.  As the Ultra 60 has
+no clearance issues I simply glued it to the top of the chip.  Since this
+would obscure the barcode sticker which is useful to restore the original MAC
+address and host ID, I moved this sticker to the side of the chip.
+
+Finally all that remains is to put everything back together and power up
+the system.  The system will run the full self-diagnostic tests again and
+if all goes well, the "NVRAM Battery Detect Test" should no longer display
+any errors.  At the ok prompt, the memory can now be initialized.  Where
+"AA BB CC" are the six hexadecimal digits from the orange barcode sticker:
+
+<kbd class='ok'>set-defaults</kbd><br/>
+<kbd class='ok'>setenv diag-switch? false</kbd><br/>
+<kbd class='ok'>8 0 20 AA BB CC AABBCC mkpl<br/><em>&lt;Ctrl-D&gt;&lt;Ctrl-R&gt;</em></kbd><br/>
+<kbd class='ok'>.idprom</kbd><br/>
+<kbd class='ok'>reset</kbd>
+
+<%= gallery_img(@items["/images/m48t59y-fixed.jpg"], caption: <<EOF
+Just like a bought one!
+EOF
+) %>
+<%= gallery_img(@items["/images/m48t59y-installed.jpg"], caption: <<EOF
+There's no place like home in the Ultra 60.
+EOF
+) %>
index ae2e55ea361bf632ba771264e07ec674123b0446..db974c0a690f2044dcbc06446333837c3c3e1cec 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ae2e55ea361bf632ba771264e07ec674123b0446
+Subproject commit db974c0a690f2044dcbc06446333837c3c3e1cec
diff --git a/gitmodules/rarpd-dx b/gitmodules/rarpd-dx
new file mode 160000 (submodule)
index 0000000..e560983
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit e5609838c7733c84200f368bfd89bf2fe07b3d9e
diff --git a/gitmodules/rrace b/gitmodules/rrace
new file mode 160000 (submodule)
index 0000000..c1dbd8f
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit c1dbd8fcf932d82b4d77da62288b4a6cdf5c1470
index 11aeec1e955d0a273d856a37d8d45b67b03eb48f..2f78b3d8481e3805fddaead2dd771b1da5ff39e1 100644 (file)
@@ -64,6 +64,8 @@ end %>
 %>  <article>
 <%= attribute_to_time(@item[:published]).strftime \
 "    <published>%Y-%m-%d</published>\n" if @item[:published]
+%><%= attribute_to_time(@item[:updated]).strftime \
+"    <updated>%Y-%m-%d</updated>\n" if @item[:updated]
 %>  </article>
 <% end
 %>  <html xmlns="<%= Xmlns['xhtml'] %>" id="<%=
index d5be1039e5061cf8c8dc2eff408eeb306c35de0a..aa22e8f23460062220cba346f2b7468de96bf1ef 100644 (file)
 <xsl:param name='site-title' select='"The Citrine Citadel"' />
 <xsl:param name='section-links' select='//document/section-links' />
 
-<func:function name='f:ends-with'>
-  <xsl:param name='a' />
-  <xsl:param name='b' />
-  <func:result
-    select='substring($a, string-length($a)-string-length($b)+1)=$b' />
-</func:function>
-
 <xsl:template match='node()|@*'>
   <xsl:copy><xsl:apply-templates select='node()|@*' /></xsl:copy>
 </xsl:template>
   </xsl:copy>
 </xsl:template>
 
-<!--
-  Nokogiri's pretty-printer is a bit weird.  Regardless of the indentation
-  setting, if an element has no child text nodes then it will be pretty-
-  printed.  This works by adding arbitrary whitespace to that element, and
-  then all of its children are eligible to be pretty-printed.
-
-  If an element has any text nodes at all, then it is not pretty-printed and
-  neither are any of its descendents.
-
-  Adding arbitrary whitespace to <pre> is bad, so we inject zero-width non-
-  breaking spaces to prevent this.  This will render fine but the spaces
-  should be removed before final output to avoid problems with copy+paste.
--->
-<xsl:template match='xhtml:pre'>
-  <xsl:copy>
-    <xsl:apply-templates select='node()|@*' />
-    <xsl:text>&#x2060;</xsl:text>
-  </xsl:copy>
-</xsl:template>
-
-<!--
-  Likewise, adding spaces between consecutive span-level elements where
-  none existed before won't go over well.
--->
-<xsl:template name='glue-preceding-span'>
-  <xsl:if test='f:element-is-span(preceding-sibling::node()[1])'>
-    <xsl:text>&#x2060;</xsl:text>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template match='*[f:element-is-span()]'>
-  <xsl:call-template name='glue-preceding-span' />
-  <xsl:copy>
-    <xsl:apply-templates select='node()|@*' />
-    <xsl:if test='*'>
-      <!-- avoid breaking within a span element -->
-      <xsl:text>&#x2060;</xsl:text>
-    </xsl:if>
-  </xsl:copy>
-</xsl:template>
-
-<!--
-  Manually strip whitespace-only text nodes so the pretty printer can do its
-  thing on remaining elements.
--->
-<xsl:template match='text()[normalize-space(.) = ""]'>
-  <xsl:choose>
-    <!-- preserve anything according to xml:space -->
-    <xsl:when test='ancestor::*[@xml:space][1][@xml:space="preserve"]'>
-      <xsl:copy />
-    </xsl:when>
-    <!-- preserve anything under <pre> -->
-    <xsl:when test='ancestor::xhtml:pre'><xsl:copy /></xsl:when>
-    <!-- preserve whitespace which is the only child node of an element -->
-    <xsl:when test='count(../node()) = 1'><xsl:copy /></xsl:when>
-    <!-- preserve whitespace between consecutive span-level elements
-         which have at least one non-whitespace sibling text element -->
-    <xsl:when test='f:element-is-span(preceding-sibling::node()[1])
-                    and f:element-is-span(following-sibling::node()[1])
-                    and ../text()[normalize-space(.) != ""]'>
-      <xsl:copy />
-    </xsl:when>
-  </xsl:choose>
-</xsl:template>
-
-<!-- Clean up whitespace where harmless to do so -->
-<xsl:template match='xhtml:p/node()[1][self::text()]'>
-  <xsl:value-of select='f:strip-leading()' />
-</xsl:template>
-<xsl:template match='xhtml:p/node()[position()=last()][self::text()]'>
-  <xsl:value-of select='f:strip-trailing()' />
-</xsl:template>
-
 <!-- Add rel attributes to external links -->
 <xsl:template match='xhtml:a[starts-with(@href,"http://")
                           or starts-with(@href,"https://")
   </xsl:copy>
 </xsl:template>
 
+<!--
+  Allow abbr to apply to document titles too, since these are generated
+  and kramdown's abbr support won't influence them. We do this by just
+  checking each word of the heading to see if is identical to an existing
+  abbr tag, and just substituting that in its place.
+  -->
+<xsl:key name='abbr' match='xhtml:abbr' use='string(.)' />
+<xsl:template name='insert-abbr' match='xhtml:h1/text()'>
+  <xsl:param name='string' select='normalize-space(.)' />
+
+  <xsl:variable name='head'
+    select='substring-before(concat($string, " "), " ")' />
+  <xsl:variable name='tail' select='substring-after($string, " ")' />
+  <xsl:variable name='match' select='key("abbr", $head)[1]' />
+
+  <xsl:choose>
+    <xsl:when test='$match'><xsl:apply-templates select='$match' /></xsl:when>
+    <xsl:otherwise><xsl:value-of select='$head' /></xsl:otherwise>
+  </xsl:choose>
+  <xsl:if test='$tail'>
+    <xsl:text> </xsl:text>
+    <xsl:call-template name='insert-abbr'>
+      <xsl:with-param name='string' select='$tail' />
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
 <!--
   Convert caption attribute on tables into proper caption elements, to allow
   a simple way to add captions to kramdown tables.
 </xsl:template>
 
 <!-- For paragraphs containing only kbd elements, wrap in blockquote. -->
-<xsl:template match='xhtml:p[*[last()=count(../xhtml:kbd)]]'>
+<xsl:template match='xhtml:p[*[last()=count(../xhtml:kbd|../xhtml:br)]]'>
   <blockquote>
     <xsl:copy>
       <xsl:apply-templates select='node()|@*' />
   </p>
 </xsl:template>
 
+<!-- Article info block inserted between heading and main contents -->
 <xsl:template match='xhtml:h1[not(preceding::xhtml:h1)]'>
+  <xsl:variable name='nodes'
+    select='/document/article/published|//xhtml:*[@article-info]' />
+
   <xsl:copy><xsl:apply-templates select='node()|@*' /></xsl:copy>
-  <xsl:if test='/document/article/published'>
+
+  <xsl:if test='$nodes'>
     <div id='article-info'>
-      <p>
-        <xsl:text>Posted </xsl:text>
-        <xsl:value-of select='/document/article/published' />
-      </p>
+      <xsl:apply-templates mode='article-info' select='$nodes'>
+        <xsl:sort data-type='number'
+          select='number(generate-id(..)=generate-id(/document/article))' />
+      </xsl:apply-templates>
     </div>
   </xsl:if>
 </xsl:template>
 
+<xsl:template mode='article-info' match='/document/article/published'>
+  <p>
+    <xsl:text>Posted </xsl:text>
+    <xsl:value-of select='/document/article/published' />
+    <xsl:if test='/document/article/updated'>
+      <xsl:if test='/document/article/updated != /document/article/published'>
+        <xsl:text>, last updated </xsl:text>
+        <xsl:value-of select='/document/article/updated' />
+      </xsl:if>
+    </xsl:if>
+  </p>
+</xsl:template>
+
+<xsl:template match='*[@article-info]' />
+<xsl:template mode='article-info' match='*[@article-info]'>
+  <xsl:copy>
+    <xsl:apply-templates select='@*[local-name() != "article-info"]' />
+    <xsl:apply-templates select='node()' />
+  </xsl:copy>
+</xsl:template>
+
 <xsl:template name='imgpara' match='xhtml:p[count(*)=1]
                                            [normalize-space(text())=""]
                                            [descendant::xhtml:img]'>
   <xsl:variable name='images' select='key("gallery", generate-id(.))' />
   <xsl:choose>
     <xsl:when test='count($images) > 1'>
-      <div class='gallery'>
+      <div>
+        <xsl:attribute name='class'>
+          <xsl:text>gallery</xsl:text>
+          <xsl:if test='//xhtml:a[f:contains-token(@class, "left")
+                                  or f:contains-token(@class, "right")]'>
+            <xsl:text> inline</xsl:text>
+          </xsl:if>
+        </xsl:attribute>
         <xsl:for-each select='$images'>
           <xsl:call-template name='imgpara' />
         </xsl:for-each>
   </html>
 </xsl:template>
 
+<xsl:include href='layouts/whitespace.xsl' />
 <xsl:include href='layouts/clickytable.xsl' />
 
 </xsl:stylesheet>
index a88c3380cc88f3bb0d59491bcb6e33f8316f8830..bbaf90e34bbf971bbddf399fd77e73be398b4bb8 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   Nick's web site: XSLT helper functions.
 
-  Copyright © 2019-2021 Nick Bowler
+  Copyright © 2019-2022 Nick Bowler
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   </func:result>
 </func:function>
 
+<!--
+  f:contains-token(list, token)
+  Returns true iff the space-separated list contains the given token
+-->
+<func:function name='f:contains-token'>
+  <xsl:param name='haystack' />
+  <xsl:param name='needle' />
+
+  <func:result select='contains(
+                         concat(" ", normalize-space($haystack), " "),
+                         concat(" ", normalize-space($needle), " ")
+                       )' />
+</func:function>
+
 </xsl:stylesheet>
diff --git a/layouts/whitespace.xsl b/layouts/whitespace.xsl
new file mode 100644 (file)
index 0000000..c15639a
--- /dev/null
@@ -0,0 +1,116 @@
+<!--
+  Nick's web site: white-space normalization for Nokogiri.
+
+  Copyright © 2019, 2022 Nick Bowler
+
+  Nokogiri's pretty-printer seems a bit weird.  Regardless of the indentation
+  setting, if an element has no child text nodes then it will be pretty-
+  printed.  This works by adding arbitrary whitespace to that element, and
+  then all of its children are eligible to be pretty-printed.
+
+  If an element has any text nodes at all, then it is not pretty-printed and
+  neither are any of its descendents.
+
+  In general, adding or removing whitespace from an XHTML document is unsafe
+  (changes the meaning) around span-level elements, but it is OK around other
+  kinds of elements.
+
+  These templates exploit the Nokogiri behaviour in two ways:
+
+  - by explicitly stripping whitespace wherever it is safe to do so, attempting
+    to allow pretty printing as much as possible without changing the meaning
+    of the document.
+
+  - by explicitly adding text nodes to suppress pretty printing in
+    situations where it would otherwise change the meaning of the document.
+
+  The text nodes which are added consist of U+2060 word joiner characters.
+  These should be removed from the final document in a separate pass.
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <https://www.gnu.org/licenses/>
+-->
+<xsl:stylesheet version='1.0'
+  xmlns='http://www.w3.org/1999/xhtml'
+  xmlns:xhtml='http://www.w3.org/1999/xhtml'
+  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+  xmlns:f='http://draconx.ca/my-functions'>
+
+<xsl:import href='functions.xsl' />
+
+<!--
+  Adding arbitrary whitespace to <pre> is bad, so we inject zero-width non-
+  breaking spaces to prevent this.  This will render fine but the spaces
+  should be removed before final output to avoid problems with copy+paste.
+-->
+<xsl:template match='xhtml:pre'>
+  <xsl:copy>
+    <xsl:apply-templates select='node()|@*' />
+    <xsl:text>&#x2060;</xsl:text>
+  </xsl:copy>
+</xsl:template>
+
+<!--
+  Likewise, adding spaces between consecutive span-level elements where
+  none existed before won't go over well.
+-->
+<xsl:template name='glue-preceding-span'>
+  <xsl:if test='f:element-is-span(preceding-sibling::node()[1])'>
+    <xsl:text>&#x2060;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match='*[f:element-is-span()]'>
+  <xsl:call-template name='glue-preceding-span' />
+  <xsl:copy>
+    <xsl:apply-templates select='node()|@*' />
+    <xsl:if test='*'>
+      <!-- avoid breaking within a span element -->
+      <xsl:text>&#x2060;</xsl:text>
+    </xsl:if>
+  </xsl:copy>
+</xsl:template>
+
+<!--
+  Manually strip whitespace-only text nodes so the pretty printer can do its
+  thing on remaining elements.
+-->
+<xsl:template match='text()[normalize-space(.) = ""]'>
+  <xsl:choose>
+    <!-- preserve anything according to xml:space -->
+    <xsl:when test='ancestor::*[@xml:space][1][@xml:space="preserve"]'>
+      <xsl:copy />
+    </xsl:when>
+    <!-- preserve anything under <pre> -->
+    <xsl:when test='ancestor::xhtml:pre'><xsl:copy /></xsl:when>
+    <!-- preserve whitespace which is the only child node of an element -->
+    <xsl:when test='count(../node()) = 1'><xsl:copy /></xsl:when>
+    <!-- preserve whitespace between consecutive span-level elements
+         which have at least one non-whitespace sibling text element -->
+    <xsl:when test='f:element-is-span(preceding-sibling::node()[1])
+                    and f:element-is-span(following-sibling::node()[1])
+                    and ../text()[normalize-space(.) != ""]'>
+      <xsl:copy />
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<!-- Clean up whitespace where harmless to do so -->
+<xsl:template match='xhtml:p/node()[1][self::text()]'>
+  <xsl:value-of select='f:strip-leading()' />
+</xsl:template>
+<xsl:template match='xhtml:p/node()[position()=last()][self::text()]'>
+  <xsl:value-of select='f:strip-trailing()' />
+</xsl:template>
+
+</xsl:stylesheet>
index 016ed23d0729cb7d469d57fa605c1a54ae36f5ad..80e79113495f01acc7dd60da8ab7f2cd159c4b1b 100644 (file)
@@ -1,7 +1,7 @@
 # Nick's web site: compiled_content filter.  Simply calls the compiled_content
 # method on the current item to retrieve the text from a named rep or snapshot.
 #
-# Copyright © 2022 Nick Bowler
+# Copyright © 2022-2023 Nick Bowler
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,6 +20,6 @@ class CompiledContentFilter < Nanoc::Filter
     identifier :compiled_content
 
     def run(content, params = {})
-        return @item.compiled_content(params)
+        return @item.compiled_content(**params)
     end
 end
index 50662e337b94de454d681a0996289810524f6228..f15f64d9843f222480c1cc96b0824a9242d20101 100644 (file)
@@ -26,6 +26,22 @@ class CssDarkModeFilter < Nanoc::Filter
         return nodes.reject {|x| x[:node] == :whitespace }
     end
 
+    # Return a new list of nodes where consecutive whitespace nodes have been
+    # replaced with a single whitespace node, and if the whitespace contains
+    # one or more newlines, everything before the final newline is removed.
+    def simplify_whitespace(nodes)
+        nodes.slice_when do |a,b|
+            a[:node] != :whitespace or b[:node] != :whitespace
+        end.map do |x|
+            if x[0][:node] == :whitespace
+                combined = x.map{|y| y[:raw]}.join.sub(/.*\n/m, "\n")
+                x[0].merge({ raw: combined})
+            else
+                x[0]
+            end
+        end
+    end
+
     def is_media_dark_block(x)
         return false unless x[:node] == :simple_block
 
@@ -44,6 +60,10 @@ class CssDarkModeFilter < Nanoc::Filter
         x[:prelude].index {|y| is_media_dark_block(y)}
     end
 
+    def is_supports_block(x)
+        true if x[:node] == :at_rule and x[:name] == "supports"
+    end
+
     # Remove (prefers-color-scheme: dark) conditions from a media query.
     # If the resulting query is empty, returns the query's block alone.
     # Otherwise, returns the modified query.
@@ -115,6 +135,54 @@ class CssDarkModeFilter < Nanoc::Filter
         end
     end
 
+    def process(tree, params)
+        last_visited = {}
+        darknodes = []
+
+        tree.delete_if do |x|
+            sep = { node: :whitespace, raw: "\n" }
+            if last_visited[:node] == :whitespace
+                # Try to maintain indentation
+                sep[:raw] += last_visited[:raw].sub(/[^\n]*\z|.*\n/m, "")
+            end
+            last_visited = x
+
+            if is_supports_block(x)
+                # Re-parse the block as a list of rules
+                s = Crass::Parser.stringify(x[:block])
+                x[:block] = Crass::Parser.parse_rules(s, params)
+
+                block = process(x[:block], params)
+                unless block.empty?
+                    block << { node: :whitespace, raw: "\n" }
+                    darknodes << [sep, x.merge({ block: block })]
+                end
+
+                Crass::Parser.stringify(x[:block]).strip.empty?
+            elsif is_media_dark(x)
+                if params[:alternate]
+                    x = prune_media_dark(x)
+                end
+                darknodes << [sep, x]
+            end
+        end
+
+        # Combine consecutive equivalent media queries into a single query
+        result = darknodes.slice_when do |a,b|
+            !equiv_query(a[1], b[1])
+        end.each.map do |x|
+            case x[0][1]
+            when Hash
+                g = x.map{ |sep, node| node[:block] }.flatten
+                [ x[0][0], x[0][1].merge({ block: simplify_whitespace(g) }) ]
+            else
+                x
+            end
+        end.flatten
+
+        simplify_whitespace(result)
+    end
+
     def run(content, params = {})
         params = {
             preserve_comments: true,
@@ -123,36 +191,17 @@ class CssDarkModeFilter < Nanoc::Filter
 
         tree = Crass.parse(content, params)
 
-        darknodes = []
-        tree.delete_if { |x| darknodes << x if is_media_dark(x) }
-
-        # Combine consecutive equivalent media queries into a single query
-        darknodes = darknodes.slice_when{|a,b| !equiv_query(a, b)}.each.map \
-        do |x|
-            combined = x[0].merge({block: x.map{|x| x[:block]}.flatten})
-        end
-
-        # In alternate mode, remove prefers-color-scheme queries.
-        if params[:alternate]
-            darknodes.map!{|x| prune_media_dark(x)}
+        prologue = tree.take_while do |x|
+            x[:node] == :comment or x[:node] == :whitespace
         end
+        tree.slice!(0, prologue.length)
 
-        darkcss = ""
-        darknodes.each do |x|
-            darkcss += "#{Crass::Parser.stringify(x).rstrip}\n"
-        end
-        darkcss.sub!(/^\n*/, "")
-
-        if params[:alternate]
-            prologue = tree.take_while do |x|
-                x[:node] == :comment or x[:node] == :whitespace
-            end
-
-            "#{Crass::Parser.stringify(prologue).rstrip}\n\n#{darkcss}"
-        else
-            output = "#{Crass::Parser.stringify(tree).rstrip}\n"
-            output += "\n#{darkcss}" unless darkcss.empty?
-            output
+        output = "#{Crass::Parser.stringify(prologue).rstrip}\n"
+        darknodes = process(tree, params)
+        unless params[:alternate]
+            tree = simplify_whitespace(tree)
+            output += "#{Crass::Parser.stringify(tree).rstrip}\n"
         end
+        output += "#{Crass::Parser.stringify(darknodes).rstrip}\n"
     end
 end
index 77916dd29492582da2081c4a4a116b7e32105ee1..24d37e4ef33407db32c07153b055ccbb60f8ad6f 100644 (file)
@@ -1,6 +1,6 @@
 # Nick's web site: Ruby helpers for processing
 #
-# Copyright © 2018-2021 Nick Bowler
+# Copyright © 2018-2022 Nick Bowler
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -77,26 +77,31 @@ def counter(name = :default, item = @item)
     name.to_s.capitalize + " " + ($counters[item][name] += 1).to_s
 end
 
-def img_rep_fallback(item, rep)
-    return rep unless item.reps[rep].raw_path.nil?
-    return :large
+# Return a hash containing :src, :width and :height based on an image item rep.
+def img_rep_attrs(item, rep)
+    rep = :large if item.reps[rep].raw_path.nil?
+    attrs = {}
+
+    attrs[:src] ||= item_uri(item, rep: rep)
+    attrs[:width], attrs[:height] = FastImage.size(item.reps[rep].raw_path)
+
+    return attrs
 end
 
-def gallery_img(item, rep: :large, alt: nil, caption: nil)
+def embed_img(item, rep: :large, caption: nil, block_attrs: {}, img_attrs: {})
     return "[image not found]" unless item
 
-    alt ||= item[:title]
-    caption ||= alt
+    img_attrs[:alt] ||= item[:title]
+    caption ||= img_attrs[:alt]
     caption = caption.strip
     caption.gsub!(/\s+/, " ")
 
-    rep = img_rep_fallback(item, rep)
-    attrs = { :src => item_uri(item, rep: rep), :alt => item[:title] }
-    attrs[:width], attrs[:height] = FastImage.size(item.reps[rep].raw_path)
+    img_attrs = img_rep_attrs(item, rep).merge(img_attrs)
+    block_attrs[:href] = item_uri(item, rep: :info)
 
     b = Nokogiri::XML::Builder.new do |xml|
-        xml.a(:href => item_uri(item, rep: :info)) {
-            xml.img(attrs, "generate-gallery" => "generate-gallery")
+        xml.a(block_attrs) {
+            xml.img(img_attrs)
             unless caption.empty?
                 xml << " &#x2060;"
                 xml.small { xml << caption }
@@ -106,6 +111,19 @@ def gallery_img(item, rep: :large, alt: nil, caption: nil)
     b.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION)
 end
 
+def gallery_img(item, rep: :medium, caption: nil, alt: nil)
+    attrs = { alt: alt, "generate-gallery" => "generate-gallery" }
+    embed_img(item, rep: rep, caption: caption, img_attrs: attrs)
+end
+
+def floating_img(item, rep: :medium, caption: nil, alt: nil, left: nil)
+    battrs = { class: if left then "left" else "right" end }
+    attrs = { alt: alt }
+
+    embed_img(item, rep: rep, caption: caption,
+                    block_attrs: battrs, img_attrs: attrs)
+end
+
 def expand_copyright(copyright)
     result = { :years => {} }
 
index f955f245d9ff3a4f861ea292f2922df40fd33ae7..677f3678166223e1921a0655cf72ba8429dc9b09 100755 (executable)
@@ -29,7 +29,7 @@ if content =~ /\A---(--)?\s*$/
 end
 
 if metadata
-    meta = YAML.load(metadata)
+    meta = YAML.load(metadata, permitted_classes: [Time])
     timefmt = "%FT%T%z"
     updatestr = updatetime.round.strftime(timefmt)
     autoset = nil
@@ -49,7 +49,7 @@ if metadata
 
     if autoset
         # Revalidate YAML
-        meta = YAML.load(metadata)
+        meta = YAML.load(metadata, permitted_classes: [Time])
         unless meta[autoset] == updatetime.round
             raise "failed to auto-insert " + autoset
         end