source: sasview/docs/sphinx-docs/build_sphinx.py @ d3b0c77

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalcmagnetic_scattrelease-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since d3b0c77 was 6e546f8, checked in by wojciech, 7 years ago

Latex file name fixed

  • Property mode set to 100755
File size: 20.1 KB
Line 
1#!/usr/bin/env python
2"""
3Functions for building sphinx docs.
4
5For more information on the invocation of sphinx see:
6http://sphinx-doc.org/invocation.html
7"""
8from __future__ import print_function
9
10import subprocess
11import os
12import sys
13import fnmatch
14import shutil
15import imp
16
17from glob import glob
18from distutils.dir_util import copy_tree
19from distutils.util import get_platform
20from distutils.spawn import find_executable
21
22from shutil import copy
23from os import listdir
24
25platform = '.%s-%s'%(get_platform(),sys.version[:3])
26
27CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
28
29run = imp.load_source('run', os.path.join(CURRENT_SCRIPT_DIR, '..', '..', 'run.py'))
30run.prepare()
31
32SASVIEW_SRC = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "src")
33SASVIEW_BUILD = os.path.abspath(os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "build", "lib"+platform))
34SASVIEW_DOCS = os.path.join(SASVIEW_BUILD, "doc")
35SASVIEW_TEST = os.path.join(SASVIEW_SRC, "..", "sasview", "test", "media")
36SASVIEW_TOC_SOURCE = os.path.join(CURRENT_SCRIPT_DIR, "source")
37
38# Need to slurp in the new sasmodels model definitions to replace the old model_functions.rst
39# We are currently here:
40#/sasview-local-trunk/docs/sphinx-docs/build_sphinx.py
41SASMODELS_SOURCE_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc")
42SASMODELS_SOURCE_GPU = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "gpu")
43SASMODELS_SOURCE_SESANS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "sesans")
44SASMODELS_SOURCE_SESANSIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "sesans", "sesans_img")
45SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "magnetism")
46SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "magnetism", "mag_img")
47SASMODELS_SOURCE_REF_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "models")
48SASMODELS_SOURCE_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model")
49SASMODELS_SOURCE_IMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model", "img")
50SASMODELS_SOURCE_AUTOIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "_build", "html","_images")
51## Don't do assemble-in-place
52## Assemble the docs in a temporary folder
53SASMODELS_DEST_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "source-temp")
54SASMODELS_DEST_REF_MODELS = os.path.join(SASMODELS_DEST_PROLOG, "user")
55SASMODELS_DEST_MODELS = os.path.join(SASMODELS_DEST_PROLOG, "user", "models")
56SASMODELS_DEST_IMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "model-imgs", "new-models")
57SASMODELS_DEST_MAGIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "mag_img")
58SASMODELS_DEST_SESANSIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "sesans_img")
59SASMODELS_DEST_BUILDIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "models", "img")
60
61
62SPHINX_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build")
63SPHINX_SOURCE = os.path.join(CURRENT_SCRIPT_DIR, "source-temp")
64SPHINX_SOURCE_API = os.path.join(SPHINX_SOURCE, "dev", "api")
65SPHINX_SOURCE_GUIFRAME = os.path.join(SPHINX_SOURCE, "user", "sasgui", "guiframe")
66SPHINX_SOURCE_MODELS = os.path.join(SPHINX_SOURCE, "user", "models")
67SPHINX_SOURCE_PERSPECTIVES = os.path.join(SPHINX_SOURCE, "user", "sasgui", "perspectives")
68SPHINX_SOURCE_TEST = os.path.join(SPHINX_SOURCE, "test")
69SPHINX_SOURCE_USER = os.path.join(SPHINX_SOURCE, "user")
70
71BUMPS_DOCS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..",
72                          "bumps", "doc", "guide")
73BUMPS_TARGET = os.path.join(SPHINX_SOURCE_PERSPECTIVES, "fitting")
74
75def inplace_change(filename, old_string, new_string):
76# Thanks to http://stackoverflow.com/questions/4128144/replace-string-within-file-contents
77        s=open(filename).read()
78        if old_string in s:
79                print('Changing "{old_string}" to "{new_string}"'.format(**locals()))
80                s=s.replace(old_string, new_string)
81                f=open(filename, 'w')
82                f.write(s)
83                f.flush()
84                f.close()
85        else:
86                print('No occurences of "{old_string}" found.'.format(**locals()))
87
88def _remove_dir(dir_path):
89    """Removes the given directory."""
90    if os.path.isdir(dir_path):
91        print("Removing \"%s\"... " % dir_path)
92        shutil.rmtree(dir_path)
93
94def clean():
95    """
96    Clean the sphinx build directory.
97    """
98    print("=== Cleaning Sphinx Build ===")
99    _remove_dir(SASVIEW_DOCS)
100    _remove_dir(SPHINX_BUILD)
101    _remove_dir(SPHINX_SOURCE)
102    #_remove_dir(SPHINX_SOURCE_GUIFRAME)
103    #_remove_dir(SPHINX_SOURCE_MODELS)
104    #_remove_dir(SPHINX_SOURCE_PERSPECTIVES)
105    #_remove_dir(SPHINX_SOURCE_TEST)
106
107def setup_source_temp():
108    """
109    Copy the source toctrees to new folder for assembling the sphinx-docs
110    """
111    print("=== Copying Source toctrees ===")
112    if os.path.exists(SASVIEW_TOC_SOURCE):
113       print("Found docs folder at", SASVIEW_TOC_SOURCE)
114       shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE)
115
116def retrieve_user_docs():
117    """
118    Copies across the contents of any media/ directories in src/, and puts them
119    in an appropriately named directory of docs/sphinx-docs/source/. For
120    example:
121
122        sas/../[MODULE]/media/dir/A.rst
123        sas/../[MODULE]/media/B.rst
124
125    gets copied to a new location:
126
127        docs/sphinx-docs/source/user/[MODULE]/dir/A.rst
128        docs/sphinx-docs/source/user/[MODULE]/B.rst
129
130    so that Sphinx may pick it up when generating the documentation.
131    """
132    print("=== Retrieve User Docs ===")
133
134    # Copy documentation files from their "source" to their "destination".
135    for root, dirnames, _ in os.walk(SASVIEW_SRC):
136        for dirname in fnmatch.filter(dirnames, 'media'):
137
138            docs = os.path.abspath(os.path.join(root, dirname))
139            print("Found docs folder at \"%s\"." % docs)
140
141            dest_dir_part = os.path.dirname(os.path.relpath(docs, SASVIEW_SRC))
142            if os.sep in dest_dir_part:
143                dest_dir_part = dest_dir_part[dest_dir_part.index(os.sep) + 1:]
144            dest_dir = os.path.join(SPHINX_SOURCE, "user", dest_dir_part)
145
146            copy_tree(docs, dest_dir)
147
148    # Now pickup testdata_help.rst
149    print("=== Including Test Data Docs ===")
150    if os.path.exists(SASVIEW_TEST):
151       print("Found docs folder at", SASVIEW_TEST)
152       shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST)
153
154    print("=== And the Sasmodels Docs ===")
155    # Make sure we have the relevant images for the new sasmodels documentation
156    # First(!) we'll make a local reference copy for SasView (/new-models will be cleaned each build)
157    if os.path.exists(SASMODELS_SOURCE_IMG):
158        print("Found img folder SASMODELS_SOURCE_IMG at", SASMODELS_SOURCE_IMG)
159        if not os.path.exists(SASMODELS_DEST_IMG):
160            print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG)
161            os.makedirs(SASMODELS_DEST_IMG)
162            print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG)
163        else:
164            print("Found img folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG)
165        print("Copying sasmodels model image files...")
166        for files in os.listdir(SASMODELS_SOURCE_IMG):
167            fromhere=os.path.join(SASMODELS_SOURCE_IMG,files)
168            tohere=os.path.join(SASMODELS_DEST_IMG,files)
169            shutil.copy(fromhere,tohere)
170    else:
171        print("no source directory",SASMODELS_SOURCE_IMG,"was found")
172
173    if os.path.exists(SASMODELS_SOURCE_AUTOIMG):
174        print("Found img folder SASMODELS_SOURCE_AUTOIMG at", SASMODELS_SOURCE_AUTOIMG)
175        if not os.path.exists(SASMODELS_DEST_IMG):
176            print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG)
177            os.makedirs(SASMODELS_DEST_BUILDIMG)
178            print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG)
179        print("Copying sasmodels model auto-generated image files...")
180        for files in os.listdir(SASMODELS_SOURCE_AUTOIMG):
181            fromhere=os.path.join(SASMODELS_SOURCE_AUTOIMG,files)
182            tohere=os.path.join(SASMODELS_DEST_IMG,files)
183            shutil.copy(fromhere,tohere)
184    else:
185        print("no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found")
186
187    # And the rst prolog with the unit substitutions
188    if os.path.exists(SASMODELS_SOURCE_PROLOG):
189        print("Found prolog folder SASMODELS_SOURCE_PROLOG at", SASMODELS_SOURCE_PROLOG)
190        if os.path.exists(SASMODELS_DEST_PROLOG):
191            print("Found docs folder SASMODELS_DEST_PROLOG at", SASMODELS_DEST_PROLOG)
192            print("Copying sasmodels rst_prolog file...")
193            for files in os.listdir(SASMODELS_SOURCE_PROLOG):
194                if files.startswith("rst"):
195                    fromhere=os.path.join(SASMODELS_SOURCE_PROLOG,files)
196                    tohere=os.path.join(SASMODELS_DEST_PROLOG,files)
197                    shutil.copy(fromhere,tohere)
198    else:
199        print("no source directory",SASMODELS_SOURCE_PROLOG, "was found")
200
201    if os.path.exists(SASMODELS_SOURCE_GPU):
202        print("Found docs folder SASMODELS_SOURCE_GPU at", SASMODELS_SOURCE_GPU)
203        if os.path.exists(SPHINX_SOURCE_USER):
204            print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER)
205            print("Copying sasmodels gpu files...")
206            for files in os.listdir(SASMODELS_SOURCE_GPU):
207                if files.endswith(".rst"):
208                    fromhere=os.path.join(SASMODELS_SOURCE_GPU,files)
209                    tohere=os.path.join(SPHINX_SOURCE_USER,files)
210                    shutil.copy(fromhere,tohere)
211    else:
212        print("no source directory",SASMODELS_SOURCE_GPU,"was found")
213
214    if os.path.exists(SASMODELS_SOURCE_SESANS):
215        print("Found docs folder SASMODELS_SOURCE_SESANS at", SASMODELS_SOURCE_SESANS)
216        if os.path.exists(SPHINX_SOURCE_USER):
217            print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER)
218            print("Copying sasmodels sesans files...")
219            for files in os.listdir(SASMODELS_SOURCE_SESANS):
220                if files.endswith(".rst"):
221                    fromhere=os.path.join(SASMODELS_SOURCE_SESANS,files)
222                    tohere=os.path.join(SPHINX_SOURCE_USER,files)
223                    shutil.copy(fromhere,tohere)
224    else:
225        print("no source directory",SASMODELS_SOURCE_SESANS,"was found")
226
227    if os.path.exists(SASMODELS_SOURCE_MAGNETISM):
228        print("Found docs folder SASMODELS_SOURCE_MAGNETISM at", SASMODELS_SOURCE_MAGNETISM)
229        if os.path.exists(SASMODELS_DEST_REF_MODELS):
230            print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS)
231            print("Copying sasmodels model toctree files...")
232            for files in os.listdir(SASMODELS_SOURCE_MAGNETISM):
233                if files.endswith(".rst"):
234                    fromhere=os.path.join(SASMODELS_SOURCE_MAGNETISM,files)
235                    tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files)
236                    shutil.copy(fromhere,tohere)
237    else:
238        print("no source directory",SASMODELS_SOURCE_MAGNETISM,"was found")
239
240    if os.path.exists(SASMODELS_SOURCE_MAGIMG):
241        print("Found img folder SASMODELS_SOURCE_MAGIMG   at", SASMODELS_SOURCE_MAGIMG)
242        if not os.path.exists(SASMODELS_DEST_MAGIMG):
243            print("Missing img folder SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG)
244            os.makedirs(SASMODELS_DEST_MAGIMG)
245            print("created SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG)
246        print("Copying sasmodels mag image files...")
247        for files in os.listdir(SASMODELS_SOURCE_MAGIMG):
248            fromhere=os.path.join(SASMODELS_SOURCE_MAGIMG,files)
249            tohere=os.path.join(SASMODELS_DEST_MAGIMG,files)
250            shutil.copy(fromhere,tohere)
251    else:
252        print("no source directory",SASMODELS_SOURCE_MAGIMG ,"was found")
253
254    if os.path.exists(SASMODELS_SOURCE_SESANSIMG):
255        print("Found img folder SASMODELS_SOURCE_SESANSIMG at", SASMODELS_SOURCE_SESANSIMG)
256        if not os.path.exists(SASMODELS_DEST_SESANSIMG):
257            print("Missing img folder SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG)
258            os.makedirs(SASMODELS_DEST_SESANSIMG)
259            print("created SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG)
260        print("Copying sasmodels sesans image files...")
261        for files in os.listdir(SASMODELS_SOURCE_SESANSIMG):
262            fromhere=os.path.join(SASMODELS_SOURCE_SESANSIMG,files)
263            tohere=os.path.join(SASMODELS_DEST_SESANSIMG,files)
264            shutil.copy(fromhere,tohere)
265    else:
266        print("no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found")
267
268    if os.path.exists(SASMODELS_SOURCE_REF_MODELS):
269        print("Found docs folder SASMODELS_SOURCE_REF_MODELS at", SASMODELS_SOURCE_REF_MODELS)
270        if os.path.exists(SASMODELS_DEST_REF_MODELS):
271            print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS)
272            print("Copying sasmodels model toctree files...")
273            for files in os.listdir(SASMODELS_SOURCE_REF_MODELS):
274                if files.endswith(".rst"):
275                    fromhere=os.path.join(SASMODELS_SOURCE_REF_MODELS,files)
276                    tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files)
277                    shutil.copy(fromhere,tohere)
278            # But need to change the path to the model docs in the tocs
279            for files in os.listdir(SASMODELS_DEST_REF_MODELS):
280        #        print files
281                if files.startswith("shape"):
282                    print("Changing toc paths in", files)
283                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
284                if files.startswith("sphere"):
285                    print("Changing toc paths in", files)
286                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
287                if files.startswith("custom"):
288                    print("Changing toc paths in", files)
289                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
290                if files.startswith("structure"):
291                    print("Changing toc paths in", files)
292                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
293    else:
294        print("no source directory",SASMODELS_SOURCE_REF_MODELS," was found")
295
296    if os.path.exists(SASMODELS_SOURCE_MODELS):
297        print("Found docs folder SASMODELS_SOURCE_MODELS at", SASMODELS_SOURCE_MODELS)
298        if os.path.exists(SASMODELS_DEST_MODELS):
299            print("Found docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
300            print("Copying sasmodels model files...")
301            for files in os.listdir(SASMODELS_SOURCE_MODELS):
302                if files.endswith(".rst"):
303                    fromhere=os.path.join(SASMODELS_SOURCE_MODELS,files)
304                    tohere=os.path.join(SASMODELS_DEST_MODELS,files)
305                    shutil.copy(fromhere,tohere)
306        else:
307            print("Missing docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
308            os.makedirs(SASMODELS_DEST_MODELS)
309            if not os.path.exists(SASMODELS_DEST_BUILDIMG):
310                os.makedirs(SASMODELS_DEST_BUILDIMG)
311            print("Created docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
312            print("Copying model files for build...")
313            for files in os.listdir(SASMODELS_SOURCE_MODELS):
314                if files.endswith(".rst"):
315                    fromhere=os.path.join(SASMODELS_SOURCE_MODELS,files)
316                    tohere=os.path.join(SASMODELS_DEST_MODELS,files)
317                    shutil.copy(fromhere,tohere)
318            # No choice but to do this because model files are all coded for images in /models/img
319            print("Copying image files for build...")
320            for files in os.listdir(SASMODELS_DEST_IMG):
321                fromhere=os.path.join(SASMODELS_DEST_IMG,files)
322                tohere=os.path.join(SASMODELS_DEST_BUILDIMG,files)
323                shutil.copy(fromhere,tohere)
324    else:
325        print("no source directory",SASMODELS_SOURCE_MODELS,"was found.")
326        print("!!!!NO MODEL DOCS WILL BE BUILT!!!!")
327
328def retrieve_bumps_docs():
329    """
330    Copies select files from the bumps documentation into fitting perspective
331    """
332    if os.path.exists(BUMPS_DOCS):
333        print("=== Retrieve BUMPS Docs ===")
334        filenames = [os.path.join(BUMPS_DOCS, "optimizer.rst")]
335        filenames += glob(os.path.join(BUMPS_DOCS, "dream-*.png"))
336        filenames += glob(os.path.join(BUMPS_DOCS, "fit-*.png"))
337        for f in filenames:
338            print("Copying file", f)
339            shutil.copy(f, BUMPS_TARGET)
340    else:
341        print("""
342======= Error =======
343missing directory %s
344The documentation will not include the optimizer selection section.
345Checkout the bumps source tree and rebuild the docs.
346""" % BUMPS_DOCS)
347
348def apidoc():
349    """
350    Runs sphinx-apidoc to generate .rst files from the docstrings in .py files
351    in the SasView build directory.
352    """
353    print("=== Generate API Rest Files ===")
354
355    # Clean directory before generating a new version.
356    _remove_dir(SPHINX_SOURCE_API)
357
358    subprocess.call(["sphinx-apidoc",
359                     "-o", SPHINX_SOURCE_API, # Output dir.
360                     "-d", "8", # Max depth of TOC.
361                     SASVIEW_BUILD])
362
363def build_pdf():
364    """
365    Runs sphinx-build for pdf.  Reads in all .rst files and spits out the final html.
366    """
367    print("=== Build PDF Docs from ReST Files ===")
368    subprocess.call(["sphinx-build",
369                     "-b", "latex", # Builder name. TODO: accept as arg to setup.py.
370                     "-d", os.path.join(SPHINX_BUILD, "doctrees"),
371                     SPHINX_SOURCE,
372                     os.path.join(SPHINX_BUILD, "latex")])
373
374    LATEXDIR = os.path.join(SPHINX_BUILD, "latex")
375    #TODO: Does it need to be done so many time?
376    def pdflatex():
377        subprocess.call(["pdflatex", "SasView.tex"], cwd=LATEXDIR)
378    pdflatex()
379    pdflatex()
380    pdflatex()
381    subprocess.call(["makeindex", "-s", "python.ist", "SasView.idx"], cwd=LATEXDIR)
382    pdflatex()
383    pdflatex()
384
385    print("=== Copy PDF to HTML Directory ===")
386    source = os.path.join(LATEXDIR, "SasView.pdf")
387    target = os.path.join(SASVIEW_DOCS, "SasView.pdf")
388    shutil.copyfile(source, target)
389
390def build():
391    """
392    Runs sphinx-build.  Reads in all .rst files and spits out the final html.
393    """
394    print("=== Build HTML Docs from ReST Files ===")
395    subprocess.call(["sphinx-build",
396                     "-b", "html", # Builder name. TODO: accept as arg to setup.py.
397                     "-d", os.path.join(SPHINX_BUILD, "doctrees"),
398                     SPHINX_SOURCE,
399                     os.path.join(SPHINX_BUILD, "html")])
400
401    print("=== Copy HTML Docs to Build Directory ===")
402    html = os.path.join(SPHINX_BUILD, "html")
403    copy_tree(html, SASVIEW_DOCS)
404
405def fetch_katex(version, destination="_static"):
406    from zipfile import ZipFile
407    import urllib2
408    url = "https://github.com/Khan/KaTeX/releases/download/%s/katex.zip" % version
409    cache_path = "katex_%s.zip" % version
410    if not os.path.exists(cache_path):
411        try:
412            fd_in = urllib2.urlopen(url)
413            with open(cache_path, "wb") as fd_out:
414                fd_out.write(fd_in.read())
415        finally:
416            fd_in.close()
417    with ZipFile(cache_path) as zip:
418        zip.extractall(destination)
419
420def convert_katex():
421    print("=== Preprocess HTML, converting latex to html ===")
422    subprocess.call(["node", "convertKaTex.js", SASVIEW_DOCS])
423
424def convert_mathjax():
425    print("=== Preprocess HTML, converting latex to html ===")
426    subprocess.call(["node", "convertMathJax.js", SASVIEW_DOCS])
427
428def fetch_mathjax():
429    subprocess.call(["npm", "install", "mathjax-node-page"])
430    # TODO: copy fonts from node_modules/mathjax/fonts/HTML-CSS/Tex into static
431
432def rebuild():
433    clean()
434    setup_source_temp()
435    retrieve_user_docs()
436    retrieve_bumps_docs()
437    #fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT)
438    #fetch_mathjax()
439    apidoc()
440    build()
441    if find_executable('latex'):
442        build_pdf()
443    #convert_katex()
444    #convert_mathjax()
445
446    print("=== Done ===")
447
448if __name__ == "__main__":
449    rebuild()
Note: See TracBrowser for help on using the repository browser.