test: add Drone tests

Also includes installation and development documentation, and updates
  to the latest development version of mkdocs-simple-plugin.

  Resolves #3.
This commit is contained in:
Glen Whitney 2021-01-09 08:11:30 -08:00
parent ea8e65ae64
commit 2235af160c
18 changed files with 926 additions and 22 deletions

View file

@ -1,11 +1,11 @@
""" md
## Usage
Once this plugin is [installed](../README.md#installation), in your `mkdocs.yml`
Once this plugin is [installed](../drone_install.md), in your `mkdocs.yml`
file just replace the plugin name `simple` with `semiliterate`. It accepts all
of the same parameters, so `mkdocs` will still work as before, and
you will have immediate access to all of the following extensions. (Note that this
documentation assumes a familiarity with the
you will have immediate access to all of the following extensions. (Note that
this documentation assumes a familiarity with the
[usage](https://athackst.github.io/mkdocs-simple-plugin/mkdocs_simple_plugin/plugin/)
of the `simple` plugin.)
"""
@ -45,7 +45,7 @@ normally copy. That is, it does not examine lines before the `start` regexp
is encountered, or after the `terminate` regexp, or between instances of
`stop` and `start`. It also doesn't check any text written from lines that
match these special expressions. Moreover, on such normally-transcribed lines,
it's the text **after** the application of any semiliterate replacements that
it's the text **after** the application of any semiliterate `replace`ments that
is checked for `{! ... !}`.
"""
@ -92,11 +92,11 @@ is checked for `{! ... !}`.
class SemiliteratePlugin(SimplePlugin):
""" md An extension of the mkdocs-simple-plugin
r""" md An extension of the mkdocs-simple-plugin
### Additional plugin parameters
`semiliterate` adds a couple of new plugin parameters to further tailor its
behavior as compared to `simple`. They are described in this section, with their
behavior as compared to `simple`. They are described in this section, with
default values in parentheses at the beginning of each entry.
{! plugin.py ---
@ -122,14 +122,14 @@ extract_standard_markdown
# because of the `extract_standard_markdown` default.
)
def copy_doc_files(self, destination_directory):
def build_docs(self):
if not self.config['copy_standard_markdown']:
self.include_extensions = self.config['include_extensions']
return super().copy_doc_files(destination_directory)
return super().build_docs()
## FIXME: This method is copied from simple, just to insert a control
## over what class is used to do the extraction. Try to get this inserted as
## the method of the same name in simple.
# FIXME: This method is copied from simple, just to insert a control
# over what class is used to do the extraction. Try to get this inserted as
# the method of the same name in simple.
def extract_from(self, from_directory, name, destination_directory):
"""Extract content from the file in _from_directory_ named _name_
to a file or files in _destination_directory_, as specified by
@ -140,15 +140,22 @@ extract_standard_markdown
for item in self.semiliterate:
name_match = item['pattern'].search(name)
if name_match:
new_name = (name[:name_match.start(name_match.lastindex)]
+ '.md'
+ name[name_match.end(name_match.lastindex):])
new_name = ''
if name_match.lastindex:
new_name = (name[:name_match.start(name_match.lastindex)]
+ '.md'
+ name[name_match.end(name_match.lastindex):])
if 'destination' in item:
new_name = name_match.expand(item['destination'])
if not new_name:
raise LookupError(
"mkdocs-simple-plugin: No last group in match of"
+ "{} to {} and no destination".format(
item['pattern'], name))
new_file = LazyFile(destination_directory, new_name)
with open(original) as original_file:
utils.log.debug(
"mkdocs-simple-plugin: Scanning {} ...".format(original))
"mkdocs-simple-plugin: Scanning {}...".format(original))
productive = self.try_extraction(
original_file, from_directory, new_file, **item)
new_file.close()