[postprocessor:metadata] add 'private' option

pull/3287/head
Mike Fährmann 2 years ago
parent a24dcbe802
commit 6b97dcf2e0
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -3768,6 +3768,17 @@ Description
See the ``mode`` parameter of |open()|_ for further details.
metadata.private
----------------
Type
``bool``
Default
``false``
Description
Include private fields,
i.e. fields whose name starts with an underscore.
metadata.encoding
-----------------
Type

@ -108,6 +108,7 @@ class MetadataPP(PostProcessor):
self.mtime = options.get("mtime")
self.omode = options.get("open", omode)
self.encoding = options.get("encoding", "utf-8")
self.private = options.get("private", False)
def run(self, pathfmt):
archive = self.archive
@ -209,7 +210,9 @@ class MetadataPP(PostProcessor):
fp.write("\n".join(tags) + "\n")
def _write_json(self, fp, kwdict):
util.dump_json(util.filter_dict(kwdict), fp, self.ascii, self.indent)
if not self.private:
kwdict = util.filter_dict(kwdict)
util.dump_json(kwdict, fp, self.ascii, self.indent)
__postprocessor__ = MetadataPP

Loading…
Cancel
Save