Changeset f4771596 in sasview
- Timestamp:
- Jun 19, 2017 12:34:42 PM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 35ddae5
- Parents:
- 8f1bb6f
- Location:
- docs/sphinx-docs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
r3194371 rf4771596 324 324 print("!!!!NO MODEL DOCS WILL BE BUILT!!!!") 325 325 326 def retrieve_bumps_docs(): 327 """ 328 Copies select files from the bumps documentation into fitting perspective 329 """ 330 if os.path.exists(BUMPS_DOCS): 331 print("=== Retrieve BUMPS Docs ===") 332 filenames = [os.path.join(BUMPS_DOCS, "optimizer.rst")] 333 filenames += glob(os.path.join(BUMPS_DOCS, "dream-*.png")) 334 filenames += glob(os.path.join(BUMPS_DOCS, "fit-*.png")) 335 for f in filenames: 336 print("Copying file", f) 337 shutil.copy(f, BUMPS_TARGET) 338 else: 339 print(""" 340 ======= Error ======= 341 missing directory %s 342 The documentation will not include the optimizer selection section. 343 Checkout the bumps source tree and rebuild the docs. 344 """ % BUMPS_DOCS) 345 346 def apidoc(): 347 """ 348 Runs sphinx-apidoc to generate .rst files from the docstrings in .py files 349 in the SasView build directory. 350 """ 351 print("=== Generate API Rest Files ===") 352 353 # Clean directory before generating a new version. 354 _remove_dir(SPHINX_SOURCE_API) 355 356 subprocess.call(["sphinx-apidoc", 357 "-o", SPHINX_SOURCE_API, # Output dir. 358 "-d", "8", # Max depth of TOC. 359 SASVIEW_BUILD]) 360 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 def build(): 388 """ 389 Runs sphinx-build. Reads in all .rst files and spits out the final html. 390 """ 391 print("=== Build HTML Docs from ReST Files ===") 392 subprocess.call(["sphinx-build", 393 "-b", "html", # Builder name. TODO: accept as arg to setup.py. 394 "-d", os.path.join(SPHINX_BUILD, "doctrees"), 395 SPHINX_SOURCE, 396 os.path.join(SPHINX_BUILD, "html")]) 397 398 print("=== Copy HTML Docs to Build Directory ===") 399 html = os.path.join(SPHINX_BUILD, "html") 400 copy_tree(html, SASVIEW_DOCS) 401 326 402 def fetch_katex(version, destination="_static"): 327 403 from zipfile import ZipFile … … 339 415 zip.extractall(destination) 340 416 341 def retrieve_bumps_docs():342 """343 Copies select files from the bumps documentation into fitting perspective344 """345 if os.path.exists(BUMPS_DOCS):346 print("=== Retrieve BUMPS Docs ===")347 filenames = [os.path.join(BUMPS_DOCS, "optimizer.rst")]348 filenames += glob(os.path.join(BUMPS_DOCS, "dream-*.png"))349 filenames += glob(os.path.join(BUMPS_DOCS, "fit-*.png"))350 for f in filenames:351 print("Copying file", f)352 shutil.copy(f, BUMPS_TARGET)353 else:354 print("""355 ======= Error =======356 missing directory %s357 The documentation will not include the optimizer selection section.358 Checkout the bumps source tree and rebuild the docs.359 """ % BUMPS_DOCS)360 361 def apidoc():362 """363 Runs sphinx-apidoc to generate .rst files from the docstrings in .py files364 in the SasView build directory.365 """366 print("=== Generate API Rest Files ===")367 368 # Clean directory before generating a new version.369 _remove_dir(SPHINX_SOURCE_API)370 371 subprocess.call(["sphinx-apidoc",372 "-o", SPHINX_SOURCE_API, # Output dir.373 "-d", "8", # Max depth of TOC.374 SASVIEW_BUILD])375 376 def build_pdf():377 """378 Runs sphinx-build for pdf. Reads in all .rst files and spits out the final html.379 """380 print("=== Build PDF Docs from ReST Files ===")381 subprocess.call(["sphinx-build",382 "-b", "latex", # Builder name. TODO: accept as arg to setup.py.383 "-d", os.path.join(SPHINX_BUILD, "doctrees"),384 SPHINX_SOURCE,385 os.path.join(SPHINX_BUILD, "latex")])386 387 LATEXDIR = os.path.join(SPHINX_BUILD, "latex")388 def pdflatex():389 subprocess.call(["pdflatex", "Sasview.tex"], cwd=LATEXDIR)390 pdflatex()391 pdflatex()392 pdflatex()393 subprocess.call(["makeindex", "-s", "python.ist", "Sasview.idx"], cwd=LATEXDIR)394 pdflatex()395 pdflatex()396 397 print("=== Copy PDF to HTML Directory ===")398 source = os.path.join(LATEXDIR, "Sasview.pdf")399 target = os.path.join(SASVIEW_DOCS, "Sasview.pdf")400 shutil.copyfile(source, target)401 402 def build():403 """404 Runs sphinx-build. Reads in all .rst files and spits out the final html.405 """406 print("=== Build HTML Docs from ReST Files ===")407 subprocess.call(["sphinx-build",408 "-b", "html", # Builder name. TODO: accept as arg to setup.py.409 "-d", os.path.join(SPHINX_BUILD, "doctrees"),410 SPHINX_SOURCE,411 os.path.join(SPHINX_BUILD, "html")])412 413 print("=== Copy HTML Docs to Build Directory ===")414 html = os.path.join(SPHINX_BUILD, "html")415 copy_tree(html, SASVIEW_DOCS)416 417 417 def convert_katex(): 418 418 print("=== Preprocess HTML, converting latex to html ===") 419 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 420 428 421 429 def rebuild(): … … 424 432 retrieve_user_docs() 425 433 retrieve_bumps_docs() 426 fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT) 434 #fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT) 435 #fetch_mathjax() 427 436 apidoc() 428 437 build() 429 438 #build_pdf() 430 439 #convert_katex() 440 #convert_mathjax() 431 441 432 442 print("=== Done ===") -
docs/sphinx-docs/source/_extensions/mathjax.py
rafca488 rf4771596 105 105 # http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn 106 106 app.add_config_value('mathjax_path', 107 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?' 108 'config=TeX-AMS-MML_HTMLorMML', False) 107 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?' 108 'config=TeX-MML-AM_CHTML', 109 #'config=TeX-AMS-MML_HTMLorMML', 110 False) 109 111 app.add_config_value('mathjax_css', None, 'html') 110 112 app.add_config_value('mathjax_use_katex', False, 'html') -
docs/sphinx-docs/source/conf.py
rdce368f rf4771596 35 35 'sphinx.ext.todo', 36 36 'sphinx.ext.coverage', 37 'mathjax', 37 'sphinx.ext.mathjax', 38 #'mathjax', # replacement mathjax that allows a list of paths 38 39 'dollarmath', 39 40 'sphinx.ext.viewcode'] 40 41 42 mathjax_path = ( 43 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?' 44 'config=TeX-MML-AM_CHTML') 45 46 # For katex uncomment the following 47 """ 41 48 #STATIC_PATH = '../../_static/' 42 49 STATIC_PATH = '' … … 47 54 ] 48 55 mathjax_css = STATIC_PATH + 'katex/katex.min.css' 56 """ 49 57 50 58 … … 211 219 # -- Options for LaTeX output -------------------------------------------------- 212 220 221 # TODO: seems like angstroms is defined twice. 213 222 LATEX_PREAMBLE=r""" 223 \usepackage[utf8]{inputenc} % Allow unicode symbols in text 224 \usepackage{underscore} % Allow underscore outside math mode 225 \usepackage[T1]{fontenc} % Use underscore character from font 226 \newcommand{\lt}{<} % HTML needs \lt rather than < 227 \newcommand{\gt}{>} % HTML needs \gt rather than > 214 228 \renewcommand{\AA}{\text{\r{A}}} % Allow \AA in math mode 215 \usepackage[utf8]{inputenc} % Allow unicode symbols in text 216 \usepackage[T1]{fontenc} % Taking care of underscores 217 \catcode`\_=12 % Moving underscore to category 12 218 \newcommand{\lt}{<} %lower than symbol handling 219 \newcommand{\gt}{>} %greater than symbol handling 229 \DeclareUnicodeCharacter {212B} {\AA} % Angstrom 220 230 \DeclareUnicodeCharacter {00B7} {\ensuremath{\cdot}} % cdot 221 231 \DeclareUnicodeCharacter {00B0} {\ensuremath{^\circ}} % degrees 222 \DeclareUnicodeCharacter {212B} {\AA} % Angstrom223 232 """ 224 233 latex_elements = {
Note: See TracChangeset
for help on using the changeset viewer.