Reviewers: Graham Percival,

Message:
Please review.

Description:
This is an updated patch to put the missing image files back into
http://lilypond.org/doc/v2.15/Documentation/web-big-page.html#examples.

It adds an extra element to the path to ly-examples (web/) which fixes
up the links in web-big-page.  It does the same with the css address.
These extra elements are then parsed out with postprocess_html.py and
website_post.py.  The latter file change is the new feature of this
patch - it ensures that the split web pages are valid after make website
and also make doc.  I have used this patch and compiled from scratch and
see both web-split and web-big have the example images and use the style
sheet.

To test this.  Apply the patch.  make website - do you see images and
styles in /lilypond-git/build/out-website/website/index.html.  make;
make doc.  Do you see images in web-split and web-big?  If these are
yes, then the patch is OK.

Please review this at http://codereview.appspot.com/4964041/

Affected files:
  M Documentation/lilypond-texi2html.init
  M Documentation/macros.itexi
  M python/auxiliar/postprocess_html.py
  M scripts/build/website_post.py


Index: Documentation/lilypond-texi2html.init
diff --git a/Documentation/lilypond-texi2html.init b/Documentation/lilypond-texi2html.init index 3585a9e8ede21472bd4c36d9ad08b2f6ad2105d6..621a17b775fcbaf21679b877a9653bfe7e4b93a8 100644
--- a/Documentation/lilypond-texi2html.init
+++ b/Documentation/lilypond-texi2html.init
@@ -852,7 +852,7 @@ sub web_settings() {
print STDERR "Processing web site: [$Texi2HTML::THISDOC{current_lang}]\n";
   $Texi2HTML::Config::BODYTEXT = "";
   @Texi2HTML::Config::CSS_REFS      = (
-      {FILENAME => "lilypond-website.css", TITLE => "Default style"}
+      {FILENAME => "web/lilypond-website.css", TITLE => "Default style"}
       );
   @Texi2HTML::Config::ALT_CSS_REFS      = (
       );
Index: Documentation/macros.itexi
diff --git a/Documentation/macros.itexi b/Documentation/macros.itexi
index 6e567a56d555a52f71e94cfac997ba50c2dd07fb..31f5c59a8cf33af8a99169a58cb500937ce01cd9 100644
--- a/Documentation/macros.itexi
+++ b/Documentation/macros.itexi
@@ -730,8 +730,8 @@ For LilyPond version @version{}
 @macro exampleImage{IMAGE-FILE}
 @html
 <div class="float-center">
-  <a class="clickable" href="ly-examples/\IMAGE-FILE\.png">
-    <img src="ly-examples/\IMAGE-FILE\-small.png" alt="\IMAGE-FILE\">
+  <a class="clickable" href="web/ly-examples/\IMAGE-FILE\.png">
+    <img src="web/ly-examples/\IMAGE-FILE\-small.png" alt="\IMAGE-FILE\">
   </a>
   <p style="text-align: center">
     (click to enlarge)
Index: python/auxiliar/postprocess_html.py
diff --git a/python/auxiliar/postprocess_html.py b/python/auxiliar/postprocess_html.py index de3848537cb2f466fd8816414bc6519147c30ea9..f92ee3d60e4d0aa95114e7963e8949a34791da50 100644
--- a/python/auxiliar/postprocess_html.py
+++ b/python/auxiliar/postprocess_html.py
@@ -105,6 +105,8 @@ def source_links_replace (m, source_val):
split_docs_re = re.compile('(Documentation/out-www/(automated-engraving| essay|notation|changes|extending|music-glossary|usage|web|learning|snippets| contributor))/')
 lily_snippets_re = re.compile ('(href|src)="([0-9a-f]{2}/lily-.*?)"')
 pictures_re = re.compile ('src="(pictures/.*?)"')
+webcss_re = re.compile ('href="web/lilypond-website')
+lyexamples_re = re.compile ('src="web/(ly-examples/.*?)"')

 docindex_link_re = re.compile (r'href="index.html"')
manuals_page_link_re = re.compile (r'href="((?:\.\./)+)Documentation/web/manuals') @@ -117,6 +119,8 @@ def hack_urls (s, prefix, target, is_development_branch):
     if split_docs_re.match (prefix):
         s = lily_snippets_re.sub ('\\1="../\\2"', s)
         s = pictures_re.sub ('src="../\\1"', s)
+        s = webcss_re.sub ('href="lilypond-website', s)
+        s = lyexamples_re.sub ('src="\\1"', s)

     # we also need to replace in the lsr, which is already processed above!
     if 'input/' in prefix or 'Documentation/topdocs' in prefix or \
Index: scripts/build/website_post.py
diff --git a/scripts/build/website_post.py b/scripts/build/website_post.py
index 7e8ffefbd624a59510fbf0d5cc49d8c5df52105f..8e73be70bafd6439b413a11079a22e2229968396 100644
--- a/scripts/build/website_post.py
+++ b/scripts/build/website_post.py
@@ -80,7 +80,6 @@ dir = sys.argv[1]
 os.chdir(dir)
 html_files = glob.glob( '*.html' )

-
 ### messy way to get all languages
 langs_set = set()
 for file in html_files:
@@ -171,6 +170,12 @@ for file in html_files:
     os.remove(file)
     outfile = open(file, 'w')

+    footer_done = True
+    try:
+        lines.index('<div id="footer">\n')
+    except ValueError:
+        footer_done = False
+
     lang_footer = makeFooter (file_base, lang)

     ### alter file
@@ -205,11 +210,18 @@ urchinTracker();
             elif (line.find('2.15') >= 0):
line = line.replace('a href=', 'a onClick=\"javascript:urchinTracker(\'/download/v2.15\');\" href=')
         ### add language selection footer
-        if (line.find("<div id=\"verifier_texinfo\">") >= 0):
-            outfile.write("<div id=\"footer\">\n")
-            outfile.write( lang_footer )
-        if (line.find("</body") >= 0):
-            outfile.write("</div>\n")
+        if (not footer_done):
+            if (line.find("<div id=\"verifier_texinfo\">") >= 0):
+                outfile.write("<div id=\"footer\">\n")
+                outfile.write( lang_footer )
+                outfile.write("</div>\n")
+        ### Fix stylesheet refs
+        if (line.find('href="web/lilypond-website.css"') >= 0):
+ line = line.replace('href="web/lilypond-website.css"','href="lilypond-website.css"') + ### and the links to example images (we need to do it this way because of the
+        ### way web-big-page is made in make doc
+        if (line.find('web/ly-examples') >= 0):
+            line = line.replace('web/ly-examples','ly-examples')
         outfile.write(line)
     outfile.close()




_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to