hkjournalist package¶
Submodules¶
hkjournalist.journalist module¶
-
class
hkjournalist.journalist.
Journalist
(template_file=None, fig_width=None, fig_height=None, tmp_path='./temp', zh=False)[source]¶ Bases:
object
Class to record and generate reports
Parameters: - template_file (str) – file path of md template
- fig_width (None, int) – figure width (percentage of whole page width), prior to fig_height settings
- fig_height (None, int) – figure height (percentage of whole page width)`
- tmp_path (str) – temporary directory path to store temporary files (such as figures)
- zh (bool) – if it supports chinese (zh_CN) usage
-
generate_template
(template_file='./template.md', title='template', author='Author', append=False)[source]¶ Generate a md template according to mappings which previously passed to.
The output template will be structed as each variable on a single slide with variable name as its title
Note:it may overwrite the file with the address
Parameters: - template_file (str) – output template file path
- title (str) – report title
- author (str) – author name
- append (bool) – If use append mode to add new contents of report
Returns: None
Return type: None
Returns:
-
hear
(config_dict: dict)[source]¶ Pass your variables mappings to the reporter
Parameters: config_dict (dict) – variable mappings such as {‘var_name’:value} Returns: None Return type: None
-
report
(output_file='./final_report.pdf', beamer=True, theme='default', color_theme='seagull', use_template_config=False, overwrite=True, aspectratio=43)[source]¶ Generate final pdf (or other format) report using previously heard config dict
Parameters: - output_file (str) – final output file path
- beamer (bool) – whether the output pdf will be a beamer slides ?
- theme (str) – the theme used to create beamer (see https://hartwork.org/beamer-theme-matrix/))
- color_theme (str) – the color theme used to create beamer (see https://hartwork.org/beamer-theme-matrix/)
- use_template_config (bool) – whether use metadata params of format in your custom template, if false, just use params in this function to produce a report. otherwise, please ref to https://pandoc.org/MANUAL.html to write a fine
md
template - overwrite (bool) – whether use a timestamp of current time as a postfix for the final output filename. if false, a new file will occur every time the method call without overwriting previouly ones.
- aspectratio (int) – aspect ratio of slide page. only valid when beamer is turn on and output format is pdf
Returns: execution return code (0 if succeed)
Return type: int