This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: wwwdocs: Broken links due to the preprocess script


Hi Tobias,

On Fri, 25 Oct 2013, Tobias Burnus wrote:
>> http://gcc.gnu.org/onlinedocs/gcc/Loop_002dSpecific-Pragmas.html
>> However, some script changes the link to:
>>    http://gcc.gnu.org/onlinedocs/gcc/Loop-Specific-Pragmas.html
>> which won't work. Try yourself at http://gcc.gnu.org/gcc-4.9/changes.html
>>
>> Actually, a similar issue was reported at
>> http://gcc.gnu.org/ml/gcc-help/2013-10/msg00132.html
> The reason for the broken links are the following lines in the
> /www/bin/preprocess script:
> http://gcc.gnu.org/cgi-bin/cvsweb.cgi/wwwdocs/bin/preprocess.diff?r1=1.38&r2=1.39&f=h
> 
> Gerald, do you still know why you added it 9 years ago? The commit 
> comment is "Use sed to work around makeinfo 4.7 brokenness."

yes, I do recall.

This was to work around a less then well advised change in makeinfo 
that replaced "-" in the local part of URLs by encoding it as "_002d".  
I firmly believe that this approach creates ugly and harder to use URLs 
for what I consider theoretical benefits only.

Cf. #alpha_002a_002d_002a_002d_002a vs  #alpha*-*-*, for a real example.

Here are some historical references

  http://gcc.gnu.org/ml/gcc/2004-09/msg00222.html
  http://gcc.gnu.org/ml/gcc/2004-09/msg00219.html

> I think "makeinfo" is still broken, but those pages do not seem to go 
> through the preprocess script, which means that only links to that page 
> will change to a hyphen, breaking the links.
> 
> Do you think it would be sensible to remove those lines again - or,
> alternatively, to run a similar script (e.g. "perl -i -e 's/_002d/-/g' `find
> onlinedocs -name \*.html`) on the onlinedocs/.

>From all I can tell, we should do the latter, that is, ensure that our
other web pages (/onlinedocs) are adjusted properly as well.

And maintainer-scripts/update_web_docs_svn was supposed to do that,
alas I just realize it is only handling wwwdocs/htdocs, not what we
generate for /onlinedocs.

Below you'll find a patch for maintainer-scripts/update_web_docs_svn
which I tested on gcc.gnu.org and the current documentation pages (not 
those for older releases) are adjusted now.  

Among others this fixes the link you reported above (though adjusting
gcc-4.9/changes.html directly is now a logical next step).

Thoughts?

Gerald


2013-12-02  Gerald Pfeifer  <gerald@pfeifer.com> 
 
        * update_web_docs_svn: Work around makeinfo generated file names 
        and references with "_002d" instead of "-". 

Index: maintainer-scripts/update_web_docs_svn
===================================================================
--- update_web_docs_svn	(revision 205584)
+++ update_web_docs_svn	(working copy)
@@ -172,6 +172,19 @@
   fi
 done
 
+# Work around makeinfo generated file names and references with
+# "_002d" instead of "-".
+find . -name '*.html' | while read f; do
+  # Do this for the contents of each file.
+  sed -i -e 's/_002d/-/g' "$f"
+  # And rename files if necessary.
+  ff=`echo $f | sed -e 's/_002d/-/g'`;
+  if [ "$f" != "$ff" ]; then
+    printf "Renaming %s to %s\n" "$f" "$ff" 
+    mv "$f" "$ff"
+  fi
+done
+
 # Then build a gzipped copy of each of the resulting .html, .ps and .tar files
 for file in */*.html *.ps *.pdf *.tar; do
   cat $file | gzip --best > $file.gz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]