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
1
.gitignore
vendored
1
.gitignore
vendored
@ -33,7 +33,6 @@ MANIFEST
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
|
@ -10,9 +10,10 @@ plugins:
|
||||
merge_docs_dir: false
|
||||
ignore_folders: [build, dist, tests]
|
||||
include_extensions: [LICENSE]
|
||||
semiliterate:
|
||||
- pattern: '(\.md)$'
|
||||
report_docs_build: true
|
||||
extract_standard_markdown:
|
||||
replace: [['^(.*)<!-- repo: -->.*<!-- site:(.*?) -->(.*\s*)$', '\1\2\3']]
|
||||
semiliterate:
|
||||
- pattern: '(\.py)$'
|
||||
start: '"""\smd'
|
||||
stop: '"""'
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
[metadata]
|
||||
name = mkdocs-semiliterate
|
||||
version = 0.0.7
|
||||
version = 0.0.8
|
||||
|
||||
[options]
|
||||
packages = mkdocs_semiliterate
|
||||
|
18
tests/bootstrap.manifest
Normal file
18
tests/bootstrap.manifest
Normal file
@ -0,0 +1,18 @@
|
||||
site
|
||||
site/404.html
|
||||
site/css
|
||||
site/css/theme.css
|
||||
site/css/theme_extra.css
|
||||
site/drone_develop
|
||||
site/drone_develop/index.html
|
||||
site/drone_install
|
||||
site/drone_install/index.html
|
||||
site/index.html
|
||||
site/LICENSE
|
||||
site/mkdocs_semiliterate
|
||||
site/mkdocs_semiliterate/plugin
|
||||
site/mkdocs_semiliterate/plugin/index.html
|
||||
site/search
|
||||
site/search.html
|
||||
site/sitemap.xml
|
||||
site/sitemap.xml.gz
|
Loading…
Reference in New Issue
Block a user