On Fri, 14 Feb 2025, Gerald Pfeifer wrote:
> On Fri, 24 Jan 2025, David Malcolm wrote:
>> The attached patch adds a postprocessing step to "bin" that
>> turns e.g.
>>   <h1 id="ID">TEXT</h1>
>> to:
>>   <h1 id="ID"><a href="#ID">TEXT</a></h1>
> It looks like this is causing an issue for (at least) one of our pages.
> 
> http://gcc.gnu.org/projects/cxx-status.html no longer validates with 
> 
>    Error: Start tag a seen but an element of the same type was already open.
>    From line 644, column 32; to line 644, column 48
>    ...d="cxx2a"><a href="#cxx20"><a id=...
> 
>    Error: Duplicate ID cxx2a.
>    From line 644, column 49; to line 644, column 62
>    ...="#cxx20"><a id="cxx2a">C++20...
> 
> See https://validator.w3.org 
> /nu/?doc=http://gcc.gnu.org/projects/cxx-status.html
> 
> 
> The HTML in question in projects/cxx-status.html is 
> 
>    <h2 id="cxx20"><a id="cxx2a">C++20 Support in GCC</a></h2>
> 
> which the script transforms to
> 
>    <h2 id="cxx20"><a id="cxx2a"><a href="#cxx20"><a id="cxx2a">C++20 Support 
> in GCC</a></a></h2>↩

It's not great, but given how often this page is updated, for the time 
being I pushed the following workaround.

(The id="cxx2a" is now with the first paragraph, not the actual header.)

Still will be good to look into the script itself.


Gerald


>From 5fb1646f0af29002e8c6c00fc4cfc50baab199ef Mon Sep 17 00:00:00 2001
From: Gerald Pfeifer <ger...@pfeifer.com>
Date: Sat, 1 Mar 2025 20:40:11 +0100
Subject: [PATCH] cxx-status: Work around issue in bin/preprocess-html.py

This script rewrites
  <h2 id="cxx20"><a id="cxx2a">C++20 Support in GCC</a></h2>
to
  <h2 id="cxx20"><a id="cxx2a"><a href="#cxx20"><a id="cxx2a">C++20...
which is not proper HTML and duplicates the <a id="cxx2a"> tag.

Work around this by pushing id="cxx2a" into the following <p>.
---
 htdocs/projects/cxx-status.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/htdocs/projects/cxx-status.html b/htdocs/projects/cxx-status.html
index 369d6fb2..94046aac 100644
--- a/htdocs/projects/cxx-status.html
+++ b/htdocs/projects/cxx-status.html
@@ -670,9 +670,9 @@
     -->
   </table>
 
-  <h2 id="cxx20"><a id="cxx2a">C++20 Support in GCC</a></h2>
+  <h2 id="cxx20">C++20 Support in GCC</h2>
 
-  <p>GCC has experimental support for the previous revision of the C++
+  <p id="cxx2a">GCC has experimental support for the previous revision of the 
C++
   standard, which was published in 2020.
   The status of C++20 library features is described in
   <a 
href="https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2020";>the
 library documentation</a>.</p>
-- 
2.48.1

Reply via email to