-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Theme fix - use style sources from theme instead from built-in #91
Open
thiersa
wants to merge
11
commits into
useblocks:main
Choose a base branch
from
thiersa:theme-fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
dcb16ef
Theme fix - use style sources from theme instead from built-in
e9d6085
add ci pipeline
f79caf3
Fix pipeline (from poetry to setuptools+twine)
97d1362
Bump version: 1.6.0 -> 1.6.1a1
1921ef2
Move SASS css generation to the theme
d010690
Move CSS generation to theme
50538e6
Cleanup code
94278e9
Cleanup artifacts
4f3d2ce
Reset version to 1.6.0
868f54f
Theme version back to 0.1.0
9faded6
Put docstring back in get_config_var and get_theme_var
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
""" | ||
from os import path | ||
|
||
import sass | ||
|
||
|
||
__version__ = '0.1.0' | ||
__version_full__ = __version__ | ||
|
@@ -14,10 +16,33 @@ def get_html_theme_path(): | |
return cur_dir | ||
|
||
|
||
def create_custom_css(app): | ||
|
||
def get_config_var(name, default): | ||
return app.config.simplepdf_vars.get(name, default) | ||
|
||
def get_theme_var(name, default): | ||
return app.config.simplepdf_theme_options.get(name, default) | ||
|
||
here = path.abspath(path.dirname(__file__)) | ||
scss_folder = path.join(here, "static", "styles", "sources") | ||
|
||
staticdir = path.join(app.builder.outdir, "_static") | ||
|
||
sass.compile( | ||
dirname=(scss_folder, staticdir), | ||
output_style="nested", | ||
custom_functions={ | ||
sass.SassFunction("config", ("$a", "$b"), get_config_var), | ||
sass.SassFunction("theme_option", ("$a", "$b"), get_theme_var), | ||
}, | ||
) | ||
|
||
|
||
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package | ||
def setup(app): | ||
app.add_html_theme('simplepdf_theme', path.abspath(path.dirname(__file__))) | ||
# app.add_css_file('styles/main.css') | ||
app.connect('builder-inited', create_custom_css) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think with this line we call We should add a check inside |
||
|
||
return { | ||
"parallel_read_safe": True, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the doc_string of the original function here?
I know the code is understandable without it, but it also explains the use case and therefore why it is needed.