[cig-commits] r15820 - doc/geodynamics.org/benchmarks/trunk

luis at geodynamics.org luis at geodynamics.org
Sun Oct 18 00:17:31 PDT 2009


Author: luis
Date: 2009-10-18 00:17:31 -0700 (Sun, 18 Oct 2009)
New Revision: 15820

Modified:
   doc/geodynamics.org/benchmarks/trunk/generate.py
Log:
Use an absolute URL for textheworld6.user.js

The current relative URL doesn't work on nested directories.
The path needs to be normalized accordingly, so in this case
it's better to switch to an absolute URL. This .js file will
change very rarely anyway.

Modified: doc/geodynamics.org/benchmarks/trunk/generate.py
===================================================================
--- doc/geodynamics.org/benchmarks/trunk/generate.py	2009-10-16 23:19:12 UTC (rev 15819)
+++ doc/geodynamics.org/benchmarks/trunk/generate.py	2009-10-18 07:17:31 UTC (rev 15820)
@@ -96,8 +96,12 @@
     #
     # We do this because there's no way to modify the information in <head>,
     # so we must parse the rst file, insert our content, and only then
-    # create the html file.
+    # create the html file. Specifically, we want to insert the following javascript
+    # file as a <script>, which will be responsible for transforming TeX [;EXPRESSIONS;]
+    # into inline images.
 
+    js_tex = 'http://geodynamics.org/cig/portal_javascripts/Plone%20Default/textheworld6.user.js'
+
     # Step (1) is straightforward enough. We read the rst file.
     # Here, 'pub.document` is a `docutils.node.document`.
     pub.document = pub.reader.read(pub.source, pub.parser, pub.settings)
@@ -113,13 +117,13 @@
     pub.writer.language = docutils.languages.get_language(pub.document.settings.language_code)
     pub.writer.destination = pub.destination
 
-    # Next, we need to deconstruct `pub.writer.translate()` so we can insert
-    # our <script> tag, used for parsing TeX [;EXPRESSIONS;].
+    # Next, we need to deconstruct `pub.writer.translate()`, and figure out
+    # where we can insert our <script> tag.
     visitor = pub.writer.visitor = pub.writer.translator_class(pub.writer.document)
     pub.writer.document.walkabout(visitor)
     for attr in pub.writer.visitor_attributes:
         setattr(pub.writer, attr, getattr(visitor, attr))
-    pub.writer.head += """<script type="text/javascript" src="../js/textheworld6.user.js"></script>"""
+    pub.writer.head += """<script type="text/javascript" src="%s"></script>""" % js_tex
     pub.writer.output = pub.writer.apply_template()
 
     # ...and with this line, we are done with Step (3).



More information about the CIG-COMMITS mailing list