Changes in docs/sphinx-docs/build_sphinx.py [f4771596:01f1e17] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
rf4771596 r01f1e17 324 324 print("!!!!NO MODEL DOCS WILL BE BUILT!!!!") 325 325 326 326 327 def retrieve_bumps_docs(): 327 328 """ … … 359 360 SASVIEW_BUILD]) 360 361 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 387 362 def build(): 388 363 """ 389 364 Runs sphinx-build. Reads in all .rst files and spits out the final html. 390 365 """ 391 print("=== Build HTML Docs from Re STFiles ===")366 print("=== Build HTML Docs from Rest Files ===") 392 367 subprocess.call(["sphinx-build", 393 368 "-b", "html", # Builder name. TODO: accept as arg to setup.py. … … 400 375 copy_tree(html, SASVIEW_DOCS) 401 376 402 def fetch_katex(version, destination="_static"):403 from zipfile import ZipFile404 import urllib2405 url = "https://github.com/Khan/KaTeX/releases/download/%s/katex.zip" % version406 cache_path = "katex_%s.zip" % version407 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 static428 429 377 def rebuild(): 430 378 clean() … … 432 380 retrieve_user_docs() 433 381 retrieve_bumps_docs() 434 #fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT)435 #fetch_mathjax()436 382 apidoc() 437 383 build() 438 #build_pdf()439 #convert_katex()440 #convert_mathjax()441 384 442 385 print("=== Done ===")
Note: See TracChangeset
for help on using the changeset viewer.