Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
mingzhen committed Feb 16, 2020
1 parent 1ee2780 commit 2f7aba9
Showing 1 changed file with 26 additions and 30 deletions.
56 changes: 26 additions & 30 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,20 @@

import sys
import os
import shlex
from git_lfs import fetch

#sys.path.insert(0, os.path.abspath('..'))
import sphinx_rtd_theme
from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify

DOC_SOURCES_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_ROOT_DIR = os.path.dirname(os.path.dirname(DOC_SOURCES_DIR))
sys.path.insert(0, DOC_SOURCES_DIR)
print('PROJECT_ROOT_DIR', PROJECT_ROOT_DIR)

# If runs on ReadTheDocs environment
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
DOC_SOURCES_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_ROOT_DIR = os.path.dirname(os.path.dirname(DOC_SOURCES_DIR))
sys.path.insert(0, DOC_SOURCES_DIR)
print('PROJECT_ROOT_DIR', PROJECT_ROOT_DIR)

# If runs on ReadTheDocs environment
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

# Hack for lacking git-lfs support ReadTheDocs # Hack for lacking git-lfs support ReadTheDocs
# Hack for lacking git-lfs support ReadTheDocs
if on_rtd:
print('Fetching files with git_lfs')
Expand Down Expand Up @@ -60,6 +57,7 @@ def _patched_fetch_urls(lfs_url, oid_list):
git_lfs.fetch_urls = _patched_fetch_urls
git_lfs.fetch(DOC_SOURCES_DIR)


# The suffix of source filenames.
source_parsers = {
'.md': 'recommonmark.parser.CommonMarkParser',
Expand All @@ -82,10 +80,10 @@ def _patched_fetch_urls(lfs_url, oid_list):
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx_markdown_tables',
'sphinx_copybutton',
'sphinxcontrib.mermaid',

'sphinx.ext.mathjax',
'sphinx_markdown_tables',
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -100,18 +98,18 @@ def _patched_fetch_urls(lfs_url, oid_list):
master_doc = 'index'

# General information about the project.
project = u'WeBASE'
project = u'FISCO BCOS'
copyright = u'© 2019. All rights reserved.'
author = u'WeBankFinTech'
author = u'fisco-bcos-dev'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.2'
version = '2.2'
# The full version, including alpha/beta/rc tags.
release = 'v1.2.2'
release = 'v2.2.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -157,7 +155,7 @@ def _patched_fetch_urls(lfs_url, oid_list):


# -- Options for HTML output ----------------------------------------------

html_theme = 'sphinx_rtd_theme'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme_options = {'navigation_depth': 4,}
Expand All @@ -168,7 +166,8 @@ def _patched_fetch_urls(lfs_url, oid_list):
# VCS options: https://docs.readthedocs.io/en/latest/vcs.html#github
html_context = {
"display_github": True, # Integrate GitHub
"github_repo": "WeBASE-DOC", # Repo name
"github_repo": "FISCO-BCOS-DOC", # Repo name
"github_user": "FISCO-BCOS",
"github_version": "master", # Version
"conf_py_path": "/", # Path in the checkout to the docs root
}
Expand Down Expand Up @@ -264,12 +263,11 @@ def _patched_fetch_urls(lfs_url, oid_list):
#html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'WeBASE_doc'
htmlhelp_basename = 'FISCO_BCOS_doc'

# -- Options for LaTeX output ---------------------------------------------

#latex_engine = 'pdflatex'
latex_engine = 'xelatex'
latex_engine = 'pdflatex'
latex_use_xindy = False
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
Expand All @@ -283,7 +281,7 @@ def _patched_fetch_urls(lfs_url, oid_list):
'preamble': r'''
\hypersetup{unicode=true}
\usepackage{CJKutf8}
\DeclareUnicodeCharacter{00A0}{~}
\DeclareUnicodeCharacter{00A0}{\nobreakspace}
\DeclareUnicodeCharacter{2203}{\ensuremath{\exists}}
\DeclareUnicodeCharacter{2200}{\ensuremath{\forall}}
\DeclareUnicodeCharacter{2286}{\ensuremath{\subseteq}}
Expand All @@ -300,14 +298,12 @@ def _patched_fetch_urls(lfs_url, oid_list):
#'figure_align': 'htbp',
}



# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'WeBASE.tex', u'WeBASE Documentation',
u'WeBankFinTech', 'manual'),
(master_doc, 'FISCO-BCOS.tex', u'FISCO BCOS Documentation',
u'fisco-dev', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -336,7 +332,7 @@ def _patched_fetch_urls(lfs_url, oid_list):
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'WeBASE', u'WeBASE Documentation',
(master_doc, 'FISCO BCOS', u'FISCO BCOS Documentation',
[author], 1)
]

Expand All @@ -350,8 +346,8 @@ def _patched_fetch_urls(lfs_url, oid_list):
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'WeBASE', u'WeBASE Documentation',
author, 'WeBankFinTech', 'documents of WeBASE',
(master_doc, 'FISCO BCOS', u'FISCO BCOS Documentation',
author, 'fisco-dev', 'documents of FISCO BCOS',
'Miscellaneous'),
]

Expand Down Expand Up @@ -381,4 +377,4 @@ def setup(app):

app.add_transform(AutoStructify)
app.add_stylesheet('css/custom.css')

app.add_javascript('js/readthedocs-analytics.js')

0 comments on commit 2f7aba9

Please sign in to comment.