Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
choldgraf committed Feb 23, 2020
1 parent 2965a3e commit 4859825
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 50 deletions.
63 changes: 37 additions & 26 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

# -- Project information -----------------------------------------------------

project = 'Sphinx Collapse Admonitions'
copyright = '2018, Chris Holdgraf'
author = 'Chris Holdgraf'
project = "Sphinx Collapse Admonitions"
copyright = "2018, Chris Holdgraf"
author = "Chris Holdgraf"

# The short X.Y version
version = ''
version = ""
# The full version, including alpha/beta/rc tags
release = ''
release = ""


# -- General configuration ---------------------------------------------------
Expand All @@ -38,23 +38,21 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx_togglebutton"
]
extensions = ["sphinx_togglebutton"]

togglebutton_selector = ".toggle, .secondtoggle"

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -66,18 +64,18 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"


# -- 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 = 'alabaster'
html_theme = "alabaster"
# html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
Expand All @@ -89,7 +87,7 @@
# 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,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -105,7 +103,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'SphinxCollapseAdmonitionsdoc'
htmlhelp_basename = "SphinxCollapseAdmonitionsdoc"


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -114,15 +112,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -132,8 +127,13 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'SphinxCollapseAdmonitions.tex', 'Sphinx Collapse Admonitions Documentation',
'Chris Holdgraf', 'manual'),
(
master_doc,
"SphinxCollapseAdmonitions.tex",
"Sphinx Collapse Admonitions Documentation",
"Chris Holdgraf",
"manual",
)
]


Expand All @@ -142,8 +142,13 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'SphinxCollapseAdmonitions', 'Sphinx Collapse Admonitions Documentation',
[author], 1)
(
master_doc,
"SphinxCollapseAdmonitions",
"Sphinx Collapse Admonitions Documentation",
[author],
1,
)
]


Expand All @@ -153,7 +158,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'SphinxCollapseAdmonitions', 'Sphinx Collapse Admonitions Documentation',
author, 'SphinxCollapseAdmonitions', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"SphinxCollapseAdmonitions",
"Sphinx Collapse Admonitions Documentation",
author,
"SphinxCollapseAdmonitions",
"One line description of project.",
"Miscellaneous",
)
]
24 changes: 10 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@
from setuptools import setup, find_packages
from sphinx_togglebutton import __version__

with open('./README.rst', 'r') as ff:
with open("./README.rst", "r") as ff:
readme_text = ff.read()

setup(
name='sphinx-togglebutton',
name="sphinx-togglebutton",
version=__version__,
description="Add a toggle button to items on a page.",
long_description=readme_text,
long_description_content_type='text/x-rst',
author='Chris Holdgraf',
author_email='choldgraf@berkeley.edu',
long_description_content_type="text/x-rst",
author="Chris Holdgraf",
author_email="choldgraf@berkeley.edu",
url="https://github.com/choldgraf/sphinx-togglebutton",
license='MIT License',
license="MIT License",
packages=find_packages(),
package_data={'sphinx_togglebutton': [
'_static/togglebutton.css',
'_static/togglebutton.js'
]
package_data={
"sphinx_togglebutton": ["_static/togglebutton.css", "_static/togglebutton.js"]
},
install_requires=["setuptools", "wheel", "sphinx"],
extras_require={
"sphinx": ["sphinx"]
}
classifiers=["License :: OSI Approved :: MIT License"]
extras_require={"sphinx": ["sphinx"]},
classifiers=["License :: OSI Approved :: MIT License"],
)
24 changes: 14 additions & 10 deletions sphinx_togglebutton/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,36 @@


def st_static_path(app):
static_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '_static'))
static_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "_static"))
app.config.html_static_path.append(static_path)


# This function reads in a variable and inserts it into JavaScript
def insert_custom_selection_config(app):
# This is a configuration that you've specified for users in `conf.py`
selector = app.config['togglebutton_selector']
selector = app.config["togglebutton_selector"]
js_text = "var togglebuttonSelector = '%s';" % selector
app.add_js_file(None, body=js_text)


# We connect this function to the step after the builder is initialized
def setup(app):
# Add our static path
app.connect('builder-inited', st_static_path)
app.connect("builder-inited", st_static_path)

# Add relevant code to headers
app.add_stylesheet('togglebutton.css')
app.add_stylesheet("togglebutton.css")

# Add the string we'll use to select items in the JS
# Tell Sphinx about this configuration variable
app.add_config_value('togglebutton_selector', ".toggle", "html")
app.add_js_file('togglebutton.js')
app.add_config_value("togglebutton_selector", ".toggle", "html")
app.add_js_file("togglebutton.js")

# Run the function after the builder is initialized
app.connect('builder-inited', insert_custom_selection_config)
app.connect("builder-inited", insert_custom_selection_config)

return {"version": __version__,
"parallel_read_safe": True,
"parallel_write_safe": True}
return {
"version": __version__,
"parallel_read_safe": True,
"parallel_write_safe": True,
}

0 comments on commit 4859825

Please sign in to comment.