Ability to set a specific field in the file's metadata
Eg: `--parse-metadata "description:(?s)(?P<meta_comment>.+)"` sets the "comment" field using `description`
This commit is contained in:
parent
54df8fc5b2
commit
84601bb72b
3 changed files with 12 additions and 6 deletions
|
|
@ -45,7 +45,7 @@ class MetadataFromFieldPP(PostProcessor):
|
|||
# replace %(..)s with regex group and escape other string parts
|
||||
for match in re.finditer(r'%\((\w+)\)s', fmt):
|
||||
regex += re.escape(fmt[lastpos:match.start()])
|
||||
regex += r'(?P<%s>[^\r\n]+)' % match.group(1)
|
||||
regex += r'(?P<%s>.+)' % match.group(1)
|
||||
lastpos = match.end()
|
||||
if lastpos < len(fmt):
|
||||
regex += re.escape(fmt[lastpos:])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue