Add/send a metadata signal.
Pull Request Checklist
- [X] I’ve read the guidelines for contributing.
- [ ] I updated AUTHORS.txt and CHANGES.txt (if the change is non-trivial) and documentation (if applicable).
- [X] I tested my changes.
Description
Send a "metadata" signal to allow interested parties to make additions/changes to the metadata. One example use of this would be to set the "updated" time of a post to the actual modification time of the source file for the post.
I don’t like the approach of mutating the meta dictionary in a signal. Perhaps a MetadataExtractor plugin would suit your needs better?
In any case, this should be documented in at least extending.rst
I don’t like the approach of mutating the meta dictionary in a signal. Perhaps a MetadataExtractor plugin would suit your needs better?
I looked at that approach first. For my specific use case (setting the "updated" metadata for any post to the modification time of the source file) I couldn't see a way of doing it using MetadataExtractor, because extract_filename() is only called with filenames for paths which match FILE_METADATA_REGEXP. Since you can only have one such regexp, using it to match all posts would mean it couldn't be used with e.g. an actual regexp.
https://github.com/getnikola/nikola/blob/650b954294ab01627ba9b45d81835293a5e02bb8/nikola/post.py#L1196-L1201
In any case, this should be documented in at least extending.rst
If this functionality is going to be merged, I will happily update the documentation to cover it.