feat: Add extract_standard_markdown
and report_docs_build
parameters
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
Also includes the bootstrap manifest, which was inadvertently '.gitignore'd. Resolves #5.
This commit is contained in:
parent
981384c6f7
commit
ec0854d8b9
5 changed files with 54 additions and 10 deletions
|
@ -127,28 +127,54 @@ default values in parentheses at the beginning of each entry.
|
|||
start: '[*]SimplePlugin.config_scheme'
|
||||
terminate: '^\s*\)'
|
||||
replace:
|
||||
- ['\(.(.*)., config_options.Type\(.*, default=(.*)\)\)', '\1\n: (\2)']
|
||||
- ["\\('(.*)',\\s*$", '\1\n']
|
||||
- ['config_options.Type.*?default=([^\)]*)', ': (\1)']
|
||||
- '^\s*#(.*\s*)$'
|
||||
!}
|
||||
|
||||
extract_standard_markdown
|
||||
: (true) To be implemented and documented
|
||||
"""
|
||||
|
||||
config_scheme = (
|
||||
# Note documentation of each new parameter **follows** the parameter.
|
||||
*SimplePlugin.config_scheme,
|
||||
('copy_standard_markdown', config_options.Type(bool, default=False))
|
||||
('copy_standard_markdown',
|
||||
config_options.Type(bool, default=False)),
|
||||
# Whether to add MkDocs' list of standard Markdown extensions to the
|
||||
# `include_extensions` parameter so that Markdown files will be
|
||||
# directly copied to the docsite. Note that the `simple` behavior
|
||||
# corresponds to a _true_ value for `copy_standard_markdown`, but
|
||||
# `semiliterate` still incorporates all standard Markdown files
|
||||
# because of the `extract_standard_markdown` default.
|
||||
# because of the following `extract_standard_markdown` parameter.
|
||||
('extract_standard_markdown',
|
||||
config_options.Type(dict, default={})),
|
||||
# If the `enable` key of this dict parameter is true
|
||||
# (which it defaults to),
|
||||
# it adds a semiliterate block causing extraction (and hence
|
||||
# include-directive processing) from all standard Markdown files
|
||||
# (as defined by MkDocs). The remaining keys of this parameter are
|
||||
# included as parameters of that semiliterate block. Thus, the
|
||||
# default value of the parameter arranges for Markdown file to be
|
||||
# copied "as-is", except possibly for embedded inclusions.
|
||||
# On the other hand, setting it to `{enable: false}` will prevent
|
||||
# automatic extraction from standard Markdown files.
|
||||
('report_docs_build',
|
||||
config_options.Type(bool, default=False))
|
||||
# If true, the name of the temporary directory to which generated docs
|
||||
# files are copied/extracted will be written to standard output
|
||||
# (even if the `-v` verbose option to mkdocs is not specified).
|
||||
)
|
||||
|
||||
def build_docs(self):
|
||||
if self.config['report_docs_build']:
|
||||
utils.log.info(
|
||||
f"semiliterate: generating docs in {self.build_docs_dir}")
|
||||
if not self.config['copy_standard_markdown']:
|
||||
self.include_extensions = self.config['include_extensions']
|
||||
if self.config['extract_standard_markdown'].get('enable', True):
|
||||
ext_pat = '|'.join(re.escape(s) for s in utils.markdown_extensions)
|
||||
self.semiliterate.append(dict(
|
||||
pattern=re.compile(f"^(.*(?:{ext_pat}))$"),
|
||||
destination=r'\1',
|
||||
**self.config['extract_standard_markdown']))
|
||||
return super().build_docs()
|
||||
|
||||
# FIXME: This method is copied from simple, just to insert a control
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue