module helpgen.sphinx_main_helper
¶
Short summary¶
module pyquickhelper.helpgen.sphinx_main_helper
Contains helpers for the main function generate_help_sphinx()
.
Functions¶
function |
truncated documentation |
---|---|
Compiles the latex documents. |
|
Copies images, initial intent was for slides, once converted into html, link to images are relative to the folder … |
|
Formats history based on module releases. |
|
Generates a RST tables containing the changes stored by a SVN or GIT repository, the outcome … |
|
Converts a date into a datetime. |
|
Returns the code for a graph which counts the number of changes per week over the last year. |
|
Replaces a place holder by a list of blog post. |
|
Modifies environment variables to be able to use external tools such as Inkscape. |
Documentation¶
Contains helpers for the main function generate_help_sphinx
.
- pyquickhelper.helpgen.sphinx_main_helper.compile_latex_output_final(root, latex_path, doall, afile=None, latex_book=False, fLOG=<function fLOG>, custom_latex_processing=None, remove_unicode=False)[source]¶
Compiles the latex documents.
- Parameters:
root – root
latex_path – path to the compiler
doall – do more transformation of the latex file before compiling it
afile – process a specific file
latex_book – do some customized transformation for a book
fLOG – logging function
custom_latex_processing – function which does some post processing of the full latex file
remove_unicode – remove unicode characters before compiling it
- pyquickhelper.helpgen.sphinx_main_helper.enumerate_copy_images_for_slides(src, dest, pattern='.*(([.]png)|([.]gif])|([.]jpeg])|([.]jpg])|([.]svg]))$')[source]¶
Copies images, initial intent was for slides, once converted into html, link to images are relative to the folder which contains them, we copy the images from
_images
to_downloads
.- Parameters:
src – sources
dest – destination
pattern – see
explore_folder_iterfile
- Returns:
enumerator of copied files
- pyquickhelper.helpgen.sphinx_main_helper.format_history(src, dest, format='basic')[source]¶
Formats history based on module releases.
- Parameters:
src – source history (file)
dest – destination (file)
Parameter format was added. Sphinx extension release no longer used but the formatting is still available.
- pyquickhelper.helpgen.sphinx_main_helper.generate_changes_repo(chan, source, exception_if_empty=True, filter_commit=<function <lambda>>, fLOG=<function fLOG>, modify_commit=None)[source]¶
Generates a RST tables containing the changes stored by a SVN or GIT repository, the outcome is stored in a file. The log comment must start with
*
to be taken into account.- Parameters:
chan – filename to write (or None if you don’t need to)
source – source folder to get changes for
exception_if_empty – raises an exception if empty
filter_commit – function which accepts a commit to show on the documentation (based on the comment)
fLOG – logging function
modify_commit – function which rewrite the commit text (see below)
- Returns:
string (rst tables with the changes)
pandas is not imported in the function itself but at the beginning of the module. It seemed to cause soe weird exceptions when generating the documentation for another module:
File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
Doing that helps. The cause still remains obscure. If not None, function modify_commit is called the following way (see below). nbch is the commit number. date can be returned as a datetime or a string.
nbch, date, author, comment = modify_commit(nbch, date, author, comment)
- pyquickhelper.helpgen.sphinx_main_helper.get_executables_path()[source]¶
Returns the paths to Python, Python Scripts.
- Returns:
a list of paths
- pyquickhelper.helpgen.sphinx_main_helper.my_date_conversion(sdate)[source]¶
Converts a date into a datetime.
- Parameters:
sdate – string
- Returns:
date
- pyquickhelper.helpgen.sphinx_main_helper.produce_code_graph_changes(df)[source]¶
Returns the code for a graph which counts the number of changes per week over the last year.
- Parameters:
df – dataframe (has a column date with format
YYYY-MM-DD
)- Returns:
graph
The call to datetime.datetime.strptime introduced exceptions:
File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
when generating the documentation for another project. The reason is still unclear. It was replaced by a custom function.
- pyquickhelper.helpgen.sphinx_main_helper.replace_placeholder_by_recent_blogpost(all_tocs, plist, placeholder, nb_post=5, fLOG=<function fLOG>)[source]¶
Replaces a place holder by a list of blog post.
- Parameters:
all_tocs – list of files to look into
plist – list of blog post
placeholder – place holder to replace
nb_post – number of blog post to display
fLOG – logging function