Skip to content

Commit

Permalink
Merge pull request #370 from SrainApp/bugfix/doc-build
Browse files Browse the repository at this point in the history
Fix sphinx doc build
  • Loading branch information
SilverRainZ authored Aug 16, 2022
2 parents ac00f83 + a133267 commit c7c2a4d
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 67 deletions.
108 changes: 56 additions & 52 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

# -- Enviroment information -----------------------------------------------------

CI = os.environ.get('CI') is not None

# -- General configuration ------------------------------------------------

Expand All @@ -34,7 +37,6 @@
extensions = [
'sphinx.ext.githubpages',
'sphinx.ext.intersphinx',
'sphinxnotes.strike',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -79,27 +81,25 @@
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


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

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# HTML theme configuration
html_theme = 'sphinx_book_theme'
if CI:
html_theme = 'sphinx_book_theme'
else:
html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
if CI:
html_theme_options = {
'repository_url': 'https://github.com/SrainApp/srain',
"use_repository_button": True,
"use_download_button": False,
"show_toc_level": 2,
}
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand All @@ -113,16 +113,17 @@
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
blog_post_page = [ # Provided by sphinx_book_theme
'sidebar-logo.html', 'search-field.html',
# Provided by ABlog
'postcard.html', 'recentposts.html', 'tagcloud.html',
'categories.html', 'archives.html']
html_sidebars = {
'blog': blog_post_page, # ABlog's "All Posts" page
'blog/**': blog_post_page, # Inlucde posts and autogenerated pages
'changelog': blog_post_page, # Inlucde posts and autogenerated pages
}
if CI:
blog_post_page = [ # Provided by sphinx_book_theme
'sidebar-logo.html', 'search-field.html',
# Provided by ABlog
'postcard.html', 'recentposts.html', 'tagcloud.html',
'categories.html', 'archives.html']
html_sidebars = {
'blog': blog_post_page, # ABlog's "All Posts" page
'blog/**': blog_post_page, # Inlucde posts and autogenerated pages
'changelog': blog_post_page, # Inlucde posts and autogenerated pages
}

html_logo = '../data/icons/hicolor/128x128/apps/im.srain.Srain.png'
html_favicon = html_logo
Expand Down Expand Up @@ -200,34 +201,37 @@
'ghrepo': ('https://github.com/%s', '⛺'),
}

extensions.append('ablog')
blog_path = 'blog'
blog_title = project
blog_baseurl = baseurl
blog_authors = {
author: (author, blog_baseurl),
}
blog_languages = {
language: ('English', None),
}
blog_default_author = author
blog_default_language = language
post_auto_image = 1
blog_feed_fulltext = True
fontawesome_included = True
html_css_files.append('ablog-custom.css')

extensions.append('sphinxnotes.mock')
mock_directives = []
mock_directives.append('contents') # Theme has built-in local-toc, see html_theme

extensions.append('sphinx_sitemap')
sitemap_filename = "sitemap.xml"
sitemap_url_scheme = "{link}"

extensions.append('sphinxcontrib.gtagjs')
gtagjs_ids = ['G-6DC73T8933']

extensions.append('sphinxext.opengraph')
ogp_site_url = baseurl
ogp_site_name = project
if CI:
extensions.append('sphinxnotes.strike')

extensions.append('ablog')
blog_path = 'blog'
blog_title = project
blog_baseurl = baseurl
blog_authors = {
author: (author, blog_baseurl),
}
blog_languages = {
language: ('English', None),
}
blog_default_author = author
blog_default_language = language
post_auto_image = 1
blog_feed_fulltext = True
fontawesome_included = True
html_css_files.append('ablog-custom.css')

extensions.append('sphinxnotes.mock')
mock_directives = []
mock_directives.append('contents') # Theme has built-in local-toc, see html_theme

extensions.append('sphinx_sitemap')
sitemap_filename = "sitemap.xml"
sitemap_url_scheme = "{link}"

extensions.append('sphinxcontrib.gtagjs')
gtagjs_ids = ['G-6DC73T8933']

extensions.append('sphinxext.opengraph')
ogp_site_url = baseurl
ogp_site_name = project
32 changes: 17 additions & 15 deletions docs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@ sphinx_source_dir = meson.current_source_dir()
sphinx_build_dir = meson.current_build_dir()

# Build documentation
foreach b: doc_builders
run_command(
sphinx,
'-b', b,
sphinx_source_dir,
join_paths(sphinx_build_dir, b),
check: true)
endforeach
if sphinx.found()
foreach b: doc_builders
run_command(
sphinx,
'-b', b,
sphinx_source_dir,
join_paths(sphinx_build_dir, b),
check: true)
endforeach

# `in` operator requires meson 0.49.0
if doc_builders.contains('man')
install_man(join_paths(sphinx_build_dir, 'man', 'srain.1'))
endif
# `in` operator requires meson 0.49.0
if doc_builders.contains('man')
install_man(join_paths(sphinx_build_dir, 'man', 'srain.1'))
endif

# `in` operator requires meson 0.49.0
if doc_builders.contains('html')
install_subdir(join_paths(sphinx_build_dir, 'html'), install_dir: pkg_doc_dir)
# `in` operator requires meson 0.49.0
if doc_builders.contains('html')
install_subdir(join_paths(sphinx_build_dir, 'html'), install_dir: pkg_doc_dir)
endif
endif

0 comments on commit c7c2a4d

Please sign in to comment.