This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gcc-wwwdocs".

The branch, master has been updated
       via  35b1a4a83807dac875aee90ed232d19ce4d313de (commit)
       via  25682e5a6a5131d5e0244d3c1df95139c6564672 (commit)
      from  396cefae3631131ee9b033bc077dedc0b70d80e3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 35b1a4a83807dac875aee90ed232d19ce4d313de
Author: David Malcolm <dmalc...@redhat.com>
Date:   Fri Jan 31 23:01:12 2025 +0800

    wwwdocs: add a Python postprocessing script
    
    The heading elements in our website contain "id" information,
    but currently to find them you to look at the page source,
    whereas in the generated HTML for the manual we have e.g.:
    
      <a class="copiable-link" href="#index-mabi-1"> &para;</a>
    
    which shows up nicely in the browser in e.g.
      https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
    as a pilcrow character when you hover over the link, which
    you can then use to copy the URL to the clipboard.
    
    It's *very* helpful to have easily shareable links to within pages.
    
    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>
    
    which makes it very easy to copy links in the generated website.
    
    Hook this script into our general preprocessing script for web pages.

diff --git a/bin/preprocess b/bin/preprocess
index 2e474b0c..8bb65934 100755
--- a/bin/preprocess
+++ b/bin/preprocess
@@ -119,6 +119,14 @@ process_html_file()
         exit 1
     fi
 
+    # Run output.raw through a Python script, then overwrite it with the
+    # output from the script.
+    if ! python3 /www/gcc/bin/preprocess-html.py $TMPDIR/output.raw 
$TMPDIR/output.after-py; then
+        echo "preprocess-html.py failed; aborting."
+        exit 1
+    fi
+    mv $TMPDIR/output.after-py $TMPDIR/output.raw
+
     # Use sed to work around makeinfo 4.7 brokenness.
     # Use sed to work around MetaHTML brokenness wrt. <DIV>.
     # Then remove leading blank lines and single line comments.
diff --git a/bin/preprocess-html.py b/bin/preprocess-html.py
new file mode 100755
index 00000000..8a36a587
--- /dev/null
+++ b/bin/preprocess-html.py
@@ -0,0 +1,32 @@
+#! /usr/bin/python3
+#
+# Python 3 script to preprocess .html files below htdocs
+
+import re
+import sys
+
+input_path = sys.argv[1]
+output_path = sys.argv[2]
+
+with open(input_path) as f_in:
+    with open(output_path, 'w') as f_out:
+        for line in f_in:
+            # Convert from e.g.
+            #   <h1 id="ID">TEXT</h1>
+            # to:
+            #   <h1 id="ID"><a href="#ID">TEXT</a></h1>
+            for element_name in {'h1', 'h2', 'h3', 'h4'}:
+                pattern = \
+                    (r'<'
+                     + element_name
+                     + r' id="(.+)">(.+)</'
+                     + element_name
+                     + '>')
+                replacement = \
+                    (r'<'
+                     + element_name
+                     + r' id="\1"><a href="#\1">\2</a></'
+                     + element_name
+                     + '>')
+                line = re.sub(pattern, replacement, line)
+            f_out.write(line)

commit 25682e5a6a5131d5e0244d3c1df95139c6564672
Author: Gerald Pfeifer <ger...@pfeifer.com>
Date:   Sun Jan 19 08:56:28 2025 +0800

    gcc-7: Update link to LEON3FT errata

diff --git a/htdocs/gcc-7/changes.html b/htdocs/gcc-7/changes.html
index 9a43803f..1b317a53 100644
--- a/htdocs/gcc-7/changes.html
+++ b/htdocs/gcc-7/changes.html
@@ -1327,7 +1327,7 @@ are not listed here).</p>
 <h4>SPARC</h4>
   <ul>
     <li>Workarounds for the four <a
-        href="https://www.gaisler.com/index.php/information/app-tech-notes";>
+        href="https://www.gaisler.com/app-notes-tech-notes-and-white-papers";>
         LEON3FT errata GRLIB-TN-0010..0013</a> have been added. Relevant errata
         are activated by the target specific <code>-mfix-ut699</code>,
         <code>-mfix-ut700</code> and <code>-mfix-gr712rc</code> switches.</li>

-----------------------------------------------------------------------

Summary of changes:
 bin/preprocess            |  8 ++++++++
 bin/preprocess-html.py    | 32 ++++++++++++++++++++++++++++++++
 htdocs/gcc-7/changes.html |  2 +-
 3 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100755 bin/preprocess-html.py


hooks/post-receive
-- 
gcc-wwwdocs

Reply via email to