sphinx-rtd-theme not formatting correctly - missing theme.css - python-sphinx

Background: I upgraded my repo to use python 3.9 (was 3.6). Upgraded all the packages to latest. Noticed my docs are not formatting with the sphinx-rtd-theme. See https://docs.members.loutilities.com/en/1.4.1.dev1/ as compared to https://docs.members.loutilities.com/en/1.4.0/
Reviewed the difference using chrome console, and with 1.4.0, the formatting is being done with https://docs.members.loutilities.com/en/1.4.0/_static/css/theme.css, but the theme.css file is missing in 1.4.1.dev1.
Note: reversion to old, previously working rtd-requirements.txt did not fix the issue.
repo code is in https://github.com/louking/members/tree/1.4.1.dev1/docs
specifically, conf.py has the following
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# 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 sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'membertility'
copyright = '2021, loutilities (Lou King)'
author = 'Lou King'
# The full version, including alpha/beta/rc tags
release = '1.0'
# -- General configuration ---------------------------------------------------
# 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_rtd_theme',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.graphviz',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# 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']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# see https://sphinx-rtd-theme.readthedocs.io/en/stable/index.html
html_theme = 'sphinx_rtd_theme'
html_theme_path = ['_themes', ]
# 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.
# set navigation depth
html_theme_options = {
'navigation_depth': -1,
'collapse_navigation': False,
'sticky_navigation': True,
}
# 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']
# https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html
html_context = {
'css_files': [
'_static/theme_overrides.css', # override wide tables in RTD theme
],
}

Don't use html_context for custom style, it will break your stylesheet.
html_static_path = ['_static']
html_css_files = ['theme_overrides.css']
Should work for you.

Related

sphinx documentation - excluding rst files that begin with a specific character?

I work on page drafts in my sphinx doc that I don't want to be available when I run sphinx-build.
for example I have files named _bob.md , _mistbuddy.md etc.
in my conf.py file I put:
exclude_patterns = [ '**/_*']
to ignore these file.
This works on load - files ignored :
However, if I then click on one of the topics, and ALL pages are available.
I have tried .. only:: <tag> however, a directive doesn't work on all contents in a file.
Thank you.

Remove extra line before first item of a list in Sphinx

When I create a bullet list in Sphinx by typing
Text before the listing
- Item 1
- Item 2
Text after the listing
it renders as follows:
This behaviour is independent of the HTML theme (tried it with 'classic' and 'sphinx_rtd_theme') and the markup language (be it ReStructuredText or Markdown with the MyST parser).
While it seems intentional that an extra line is added before the first item, I find it distracting.
Can I suppress the extra line with an option or an HTML/CSS modification?
Sphinx supports custom CSS styling. If your CSS file is _static/css/custom.css, then you need to add its location to the conf.py file so that Sphinx finds it:
## conf.py
# These folders are copied to the documentation's HTML output
html_static_path = ['_static']
# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
'css/custom.css',
]
To implement the desired formatting, put the following into the above-mentioned custom.css file:
p { margin: 0; }
ul { margin-top: 0; }
as described here.

How to embedd a gpg key in static Nikola websites?

What is the best way to include gpg public keys on a website, which is generated by the Nikola website generator?
It should be easy to import by visitors.
Nikola must not the key while rendering the page.
Edit: After 7 months I think the ideal solution makes use of WKD
As a default, all files within the files/ folder will be copied 1:1 into the output files. So if you're using the default config: to have your public key on your page, you can simply store it in files/key.txt and it will be available as https://yourpage.com/key.txt.
In the conf.py you can find the following:
# One or more folders containing files to be copied as-is into the output.
# The format is a dictionary of {source: relative destination}.
# Default is:
# FILES_FOLDERS = {'files': ''}
# Which means copy 'files' into 'output'```

include files recursively in Cocoapods podspec

I want to create a local podspec that is based on some private code. I can't seem to use the 'source' attribute, as that is not working. I can use the 'source_files' attribute, but it does not include files recursively. So with a directory that looks like this
Library
/src
/Core
/Audio
/Graphics
And my podspec looks like this:
Pod::Spec.new do |s|
...
s.source = 'src' # this does not work.
s.source_files = 'src' # this only includes the files in src, and not in any of the Core, Audio or Graphics folders.
I kind of want to specify a '-r' flag. I have tried using wildcards but no luck.
The source_files attribute uses Ruby file glob syntax. The pattern must be relative to the root of your project (i.e., the podspec file), so this should work for you:
s.source_files = 'Library/src/**/*.{h,m}'
The source attribute is not for source code files, but rather for the remote repository from which the code should be retrieved (most commonly a Git repository URL and tag). See the CocoaPods specification docs for more info.
CocoaPods source_files
[CocoaPods]
spec.source_files = 'Classes/**/*.{h,m,swift}', 'More_Classes/**/*.{h,m,swift}'
File patterns:
* - Matches any file.
** - Matches directories recursively.
? - Matches any one character.
[set] - Matches any one character in set.
{p,q} - Matches either literal p or literal q.
\ - Escapes the next meta-character.

How to make a file into a shell script and run it?

I created the file:
tinymce_compressor.sh
$chmod +x tinymce_compressor.sh
$ tinymce_compressor
-bash: tinymce_compressor: command not found
How can I run this shell script in terminal?
Here's the full script:
#!/bin/sh
# Tinymce compressor shell script
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# (C) Copyright 2010 Gabor Vitez
#
#
# Concatenates the tinymce components into a single static file
# Can be used with any web server which can serve static files
# Note you have to re-run this script every time you upgrade tinymce,
# or change the required modules
#
# Usage: upon every invocation, the scipt will create a new
# "tinymceappended.js" file, which contains the requested components
#
# In your html pages you have to change
#
# <script type="text/javascript" src="<your installation path>/tiny_mce/tiny_mce.js"></script>
#
# to
#
# <script type="text/javascript" src="<your compressed tinymce url>/tinymceappended.js"> </script>
#
#config section
#where does tinymce live in the filesystem?
BASE="/Users/xxxx/Sites/cline/public/javascripts/tiny_mce/"
#under which URLs do the original tinymce components show up?
URLBASE="/tinymce"
#just as in the javascript config section
THEMES="advanced"
PLUGINS="safari spellchecker pagebreak style layer save advhr advimage advlink emotions iespell inlinepopups insertdatetime preview media searchreplace contextmenu paste directionality fullscreen noneditable visualchars nonbreaking xhtmlxtras"
LANGUAGES="en"
#end config section
(
LOADED=""
cd $BASE || exit 1
#cat tiny_mce.js
sed "s/tinymce._init();/tinymce.baseURL='\/tinymce';tinymce._init();/"<tiny_mce.js
#echo "tinyMCE_GZ.start();"
#cat tiny_mce_popup.js && LOADED="$LOADED $URLBASE/tiny_mce_popup.js"
for lang in $LANGUAGES
do
cat langs/$lang.js && LOADED="$LOADED $URLBASE/langs/$lang.js"
done
for theme in $THEMES
do
cat themes/$theme/editor_template.js && LOADED="$LOADED $URLBASE/themes/$theme/editor_template.js"
for lang in $LANGUAGES
do
cat themes/$theme/langs/$lang.js && LOADED="$LOADED $URLBASE/themes/$theme/langs/$lang.js"
done
done
for plugin in $PLUGINS
do
cat plugins/$plugin/editor_plugin.js && LOADED="$LOADED $URLBASE/plugins/$plugin/editor_plugin.js"
for lang in $LANGUAGES
do
cat plugins/$plugin/langs/$lang.js && LOADED="$LOADED $URLBASE/plugins/$plugin/langs/$lang.js"
done
done
echo
#echo $LOADED >&2
for i in $LOADED
do
echo "tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(\"$i\"));"
done
#echo "tinyMCE_GZ.end();"
) >tinymceappended.js
Thanks
You have made it, just call
$ ./tinymce_compressor.sh
It seems that you come from Windows, where executables can be called without extensions and the current directory is always in PATH.
The script is in your current directory, but which is not in your path (which is what the shell uses to try and find commands to run) by default. So,
./tinymce_compressor.sh
should do the trick. For more information on the command search path, and why it may not be a good idea to include the current directory (aka ".") in the path, see "What's wrong with having '.' in your $PATH ?
" from the Unix frequently asked questions list..
By default the current directory isn't on the path; you need to specify that the script is in the current folder (.):
./tinymce_compressor.sh

Resources