about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2023-01-27 22:10:16 +0900
committerNguyễn Gia Phong <mcsinyx@disroot.org>2023-01-27 22:10:16 +0900
commit6954e559a2bff00e839f052ced2747c63674f5f9 (patch)
tree21c8e3e668f3838ccc701cfaaa23709ef0fe4a10
parent61fc04a1f1c6cb676df3aa42aee1bd22bf79a61d (diff)
downloadpx-6954e559a2bff00e839f052ced2747c63674f5f9.tar.gz
Preserve hyphens in titles
-rw-r--r--00/index.xml8
-rw-r--r--01/index.xml6
-rw-r--r--02/index.xml8
-rw-r--r--03/index.xml8
-rw-r--r--atom.xslt4
-rw-r--r--page.xslt9
6 files changed, 23 insertions, 20 deletions
diff --git a/00/index.xml b/00/index.xml
index 15e76ca..c5b7681 100644
--- a/00/index.xml
+++ b/00/index.xml
@@ -1,22 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml-stylesheet href="/page.xslt" type="text/xsl"?>
 <page curr="00" next="01">
-  <post id="nanocomputers">
+  <post title="nanocomputers">
     <picture filename="nwz-b163f" desc="Beat-up and dead Walkman NWZ-B163F"/>
     <picture filename="pinecil" desc="Pinecil"/>
     <picture filename="q1" desc="Shanling Q1"/>
     <time>2022-02-10T07:08:09Z</time>
   </post>
-  <post id="chiếc-thuyền-ngoài-xa">
+  <post title="chiếc thuyền ngoài xa">
     <picture filename="boats" desc="Ships on the horizon"/>
     <time>2022-04-05T23:32:31Z</time>
   </post>
-  <post id="view-from-dorm-window">
+  <post title="view from dorm window">
     <picture filename="unist-dorm-spring"
              desc="Cherry blossoms viewed from UNIST dorm window"/>
     <time>2022-04-06T11:51:28Z</time>
   </post>
-  <post id="around-the-campus">
+  <post title="around the campus">
     <picture filename="unist-path-spring-0"
              desc="Blooming cherry behind a tree with bright green leaves"/>
     <picture filename="unist-path-spring-1"
diff --git a/01/index.xml b/01/index.xml
index 55adb0f..c64636e 100644
--- a/01/index.xml
+++ b/01/index.xml
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml-stylesheet href="/page.xslt" type="text/xsl"?>
 <page prev="00" curr="01" next="02">
-  <post id="life-finds-a-way">
+  <post title="life finds a way">
     <picture filename="ants" desc="ants and red mites on top of concrete fence"/>
     <picture filename="red-mites" desc="closeup of red mites on blue concrete"/>
     <picture filename="brick-grass"
              desc="tiny grass growing between paving bricks"/>
     <time>2022-04-23T14:05:47Z</time>
   </post>
-  <post id="hoa-cỏ-ven-đường">
+  <post title="hoa cỏ ven đường">
     <picture filename="ragwort-withered-0"
              desc="ragwort plant with withered flowers"/>
     <picture filename="ragwort-withered-1"
@@ -20,7 +20,7 @@
              desc="blooming ragworts at the base of a tree trunk"/>
     <time>2022-05-15T09:34:55Z</time>
   </post>
-  <post id="lập-hạ">
+  <post title="lập hạ">
     <picture filename="grass" desc="green grass and short trees"/>
     <picture filename="palmate-maples"
              desc="green and brown palmate maples below a casuarina"/>
diff --git a/02/index.xml b/02/index.xml
index 8caf795..632a83e 100644
--- a/02/index.xml
+++ b/02/index.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml-stylesheet href="/page.xslt" type="text/xsl"?>
 <page prev="01" curr="02" next="03">
-  <post id="electromagneticpunk">
+  <post title="electromagneticpunk">
     <picture filename="urban-0"
              desc="street with lots of power lines and surveillance cameras"/>
     <picture filename="urban-1"
@@ -13,15 +13,15 @@
     <picture filename="urban-4" desc="rooftop with many antennae"/>
     <time>2022-06-13T15:22:11Z</time>
   </post>
-  <post id="mante-morte">
+  <post title="mante morte">
     <picture filename="mante-morte" desc="dead mantis lying on the floor"/>
     <time>2022-09-21T17:06:45Z</time>
   </post>
-  <post id="always-look-on-the-bright-side-of-life">
+  <post title="always look on the bright side of life">
     <picture filename="verbena" desc="bush of verbena bonariensis"/>
     <time>2022-09-29T18:25:14Z</time>
   </post>
-  <post id="yellow-flowers">
+  <post title="yellow flowers">
     <picture filename="sundrops-flowers"
              desc="evening primrose flowers and buds"/>
     <picture filename="squash-flower"
diff --git a/03/index.xml b/03/index.xml
index 882cdfd..f6b7f4b 100644
--- a/03/index.xml
+++ b/03/index.xml
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml-stylesheet href="/page.xslt" type="text/xsl"?>
 <page prev="02" curr="03">
-  <post id="xế-chiều">
+  <post title="xế chiều">
     <picture filename="twilight-moon"
              desc="cloudy sky with crescent moon in the twilight"/>
     <picture filename="twilight-silhouette"
              desc="cloudy sky with tree silhouette in the twilight"/>
     <time>2022-10-04T10:59:39Z</time>
   </post>
-  <post id="dance-of-the-dinosaurs">
+  <post title="dance of the dinosaurs">
     <picture filename="pigeons-0"
              desc="two pigeons facing opposite directions"/>
     <picture filename="pigeons-1"
@@ -21,12 +21,12 @@
              desc="one walking pigeon in the middle of two pecking ones"/>
     <time>2022-10-10T05:18:52Z</time>
   </post>
-  <post id="phất-cờ">
+  <post title="phất cờ">
     <picture filename="grass-flowers-0" desc="true grass flowers"/>
     <picture filename="grass-flowers-1" desc="more true grass flowers"/>
     <time>2022-10-14T08:28:54Z</time>
   </post>
-  <post id="hồng-nhan-bạc-mệnh">
+  <post title="hồng nhan bạc mệnh">
     <picture filename="cans"
              desc="red soft drink cans faded to light orange under the sun"/>
     <time>2022-10-18T02:28:25Z</time>
diff --git a/atom.xslt b/atom.xslt
index 3d65467..2ed6e5b 100644
--- a/atom.xslt
+++ b/atom.xslt
@@ -14,12 +14,12 @@
       <xsl:variable name="url">
         <xsl:value-of select="$base"/>
         <xsl:text>#</xsl:text>
-        <xsl:value-of select="@id"/>
+        <xsl:value-of select="translate(@title, ' ', '-')"/>
       </xsl:variable>
       <entry>
         <link rel="alternate" type="application/xhtml+xml" href="{$url}"/>
         <id><xsl:value-of select="$url"/></id>
-        <title><xsl:value-of select="translate(@id, '-', ' ')"/></title>
+        <title><xsl:value-of select="@title"/></title>
         <content type="xhtml">
           <div xmlns="http://www.w3.org/1999/xhtml">
             <xsl:for-each select="picture">
diff --git a/page.xslt b/page.xslt
index a739083..2b529b1 100644
--- a/page.xslt
+++ b/page.xslt
@@ -19,9 +19,12 @@
         </nav>
 
         <xsl:for-each select="post">
-          <article id="{@id}">
-            <h2><a href="#{@id}">
-              <xsl:value-of select="translate(@id, '-', ' ')"/>
+          <xsl:variable name="id">
+            <xsl:value-of select="translate(@title, ' ', '-')"/>
+          </xsl:variable>
+          <article id="{$id}">
+            <h2><a href="#{$id}">
+              <xsl:value-of select="@title"/>
             </a></h2>
             <xsl:for-each select="picture">
               <a href="{@filename}.jpg">