fix(destination): Allow the destination to reside in an arbitrary directory
That is to say, the destination will now be interpreted as an entire path relative to the source, not simply a filename in the same directory as the source. Resolves #20.
This commit is contained in:
parent
04a410a85b
commit
f85c5fc6eb
25 changed files with 3724 additions and 5 deletions
|
@ -401,9 +401,12 @@ semiliterate.ensurelines
|
|||
if len(self.patterns) == 0:
|
||||
self.patterns = [FlextractionPattern()]
|
||||
|
||||
# Note this needs to be identical to Semiliterate.try_extraction
|
||||
# except with StreamInclusion in place of StreamExtract in the
|
||||
# `extraction =` line, and a couple of options as noted below:
|
||||
# Note that this has diverged noticeably from the
|
||||
# Semiliterate.try_extraction method that it overrides, especially
|
||||
# in regards to adjusting the destination directory.
|
||||
# Hence, great care must be taken when mkdocs-simple-plugin is updated
|
||||
# to make sure that any changes to this method are reflected in the
|
||||
# code below:
|
||||
def try_extraction(
|
||||
self,
|
||||
from_directory,
|
||||
|
@ -418,6 +421,8 @@ semiliterate.ensurelines
|
|||
if not to_file:
|
||||
return False
|
||||
from_file_path = os.path.join(from_directory, from_file)
|
||||
to_file_path = os.path.join(destination_directory, to_file) # ## ADDED
|
||||
(destination_directory, to_file) = os.path.split(to_file_path) # ADDED
|
||||
try:
|
||||
with open(from_file_path) as original_file:
|
||||
utils.log.debug(f"mkdocs-semiliterate: Scanning {from_file}...")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue