Author: bugman
Date: Fri Feb  6 10:41:39 2015
New Revision: 27579

URL: http://svn.gna.org/viewcvs/relax?rev=27579&view=rev
Log:
The rehead.py script now modifies the special index.html and frames.html Epydoc 
API documentation files.


Modified:
    website/api/rehead.py

Modified: website/api/rehead.py
URL: 
http://svn.gna.org/viewcvs/relax/website/api/rehead.py?rev=27579&r1=27578&r2=27579&view=diff
==============================================================================
--- website/api/rehead.py       (original)
+++ website/api/rehead.py       Fri Feb  6 10:41:39 2015
@@ -13,17 +13,17 @@
 
 # Blacklisted files to not change.
 BLACKLIST = [
-    'frames.html',
-    'index.html',
     'redirect.html'
 ]
 
 # The contents for the HEAD tag, excluding the title tag.
-HEAD_CONTENTS = [
+HEAD_CONTENTS_CSS = [
     "",
     "  <!--Epydoc setup-->",
     "  <link rel=\"stylesheet\" href=\"epydoc.css\" type=\"text/css\" />",
     "  <script type=\"text/javascript\" src=\"epydoc.js\"></script>",
+]
+HEAD_CONTENTS_SHORT = [
     "",
     "  <!--Mobile device support-->",
     "  <meta name=viewport content=\"width=device-width, initial-scale=1\">",
@@ -44,6 +44,7 @@
     "",
     "  </script>",
 ]
+HEAD_CONTENTS = HEAD_CONTENTS_CSS + HEAD_CONTENTS_SHORT
 
 # The expected head tag contents.
 EXPECTED = [
@@ -101,8 +102,13 @@
                 file.write(title)
                 file.write("\n")
 
+                # The 
+                contents = HEAD_CONTENTS
+                if self.short_head:
+                    contents = HEAD_CONTENTS_SHORT
+
                 # Add the rest of the head contents.
-                for line in HEAD_CONTENTS:
+                for line in contents:
                     file.write("%s\n" % line)
 
                 # Go to the end of the head tag.
@@ -129,6 +135,7 @@
         index = 0
         pre_modified = False
         analytics = False
+        self.short_head = False
         for line in self.file_lines:
             # In the head tag.
             if search("<head>", line):
@@ -144,8 +151,12 @@
                 if index == 4 and line[:-1] == "  <!--Google analytics JS-->":
                     analytics = True
 
+                # Short headers.
+                if index == 2 and line[:-1] == "</head>":
+                    self.short_head = True
+
                 # Check the line, skipping the title tag.
-                if not pre_modified and not analytics and EXPECTED[index] != 
None and EXPECTED[index] != line[:-1]:
+                if not pre_modified and not analytics and not self.short_head 
and EXPECTED[index] != None and EXPECTED[index] != line[:-1]:
                     print("%s: Unexpected head tag encountered, quitting." % 
file_name)
                     print("    Encountered line:  \"%s\"" % line[:-1])
                     print("    Expected line:  \"%s\"" % EXPECTED[index])


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@gna.org

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

Reply via email to