Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/sphinx-docs/build_sphinx.py

    rf4771596 r01f1e17  
    324324        print("!!!!NO MODEL DOCS WILL BE BUILT!!!!") 
    325325 
     326 
    326327def retrieve_bumps_docs(): 
    327328    """ 
     
    359360                     SASVIEW_BUILD]) 
    360361 
    361 def build_pdf(): 
    362     """ 
    363     Runs sphinx-build for pdf.  Reads in all .rst files and spits out the final html. 
    364     """ 
    365     print("=== Build PDF Docs from ReST Files ===") 
    366     subprocess.call(["sphinx-build", 
    367                      "-b", "latex", # Builder name. TODO: accept as arg to setup.py. 
    368                      "-d", os.path.join(SPHINX_BUILD, "doctrees"), 
    369                      SPHINX_SOURCE, 
    370                      os.path.join(SPHINX_BUILD, "latex")]) 
    371  
    372     LATEXDIR = os.path.join(SPHINX_BUILD, "latex") 
    373     def pdflatex(): 
    374         subprocess.call(["pdflatex", "Sasview.tex"], cwd=LATEXDIR) 
    375     pdflatex() 
    376     pdflatex() 
    377     pdflatex() 
    378     subprocess.call(["makeindex", "-s", "python.ist", "Sasview.idx"], cwd=LATEXDIR) 
    379     pdflatex() 
    380     pdflatex() 
    381  
    382     print("=== Copy PDF to HTML Directory ===") 
    383     source = os.path.join(LATEXDIR, "Sasview.pdf") 
    384     target = os.path.join(SASVIEW_DOCS, "Sasview.pdf") 
    385     shutil.copyfile(source, target) 
    386  
    387362def build(): 
    388363    """ 
    389364    Runs sphinx-build.  Reads in all .rst files and spits out the final html. 
    390365    """ 
    391     print("=== Build HTML Docs from ReST Files ===") 
     366    print("=== Build HTML Docs from Rest Files ===") 
    392367    subprocess.call(["sphinx-build", 
    393368                     "-b", "html", # Builder name. TODO: accept as arg to setup.py. 
     
    400375    copy_tree(html, SASVIEW_DOCS) 
    401376 
    402 def fetch_katex(version, destination="_static"): 
    403     from zipfile import ZipFile 
    404     import urllib2 
    405     url = "https://github.com/Khan/KaTeX/releases/download/%s/katex.zip" % version 
    406     cache_path = "katex_%s.zip" % version 
    407     if not os.path.exists(cache_path): 
    408         try: 
    409             fd_in = urllib2.urlopen(url) 
    410             with open(cache_path, "wb") as fd_out: 
    411                 fd_out.write(fd_in.read()) 
    412         finally: 
    413             fd_in.close() 
    414     with ZipFile(cache_path) as zip: 
    415         zip.extractall(destination) 
    416  
    417 def convert_katex(): 
    418     print("=== Preprocess HTML, converting latex to html ===") 
    419     subprocess.call(["node", "convertKaTex.js", SASVIEW_DOCS]) 
    420  
    421 def convert_mathjax(): 
    422     print("=== Preprocess HTML, converting latex to html ===") 
    423     subprocess.call(["node", "convertMathJax.js", SASVIEW_DOCS]) 
    424  
    425 def fetch_mathjax(): 
    426     subprocess.call(["npm", "install", "mathjax-node-page"]) 
    427     # TODO: copy fonts from node_modules/mathjax/fonts/HTML-CSS/Tex into static 
    428  
    429377def rebuild(): 
    430378    clean() 
     
    432380    retrieve_user_docs() 
    433381    retrieve_bumps_docs() 
    434     #fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT) 
    435     #fetch_mathjax() 
    436382    apidoc() 
    437383    build() 
    438     #build_pdf() 
    439     #convert_katex() 
    440     #convert_mathjax() 
    441384 
    442385    print("=== Done ===") 
Note: See TracChangeset for help on using the changeset viewer.