Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace pelican-md-metayaml with an updated version #382

Merged
merged 1 commit into from
Feb 19, 2015
Merged

Replace pelican-md-metayaml with an updated version #382

merged 1 commit into from
Feb 19, 2015

Conversation

pR0Ps
Copy link
Contributor

@pR0Ps pR0Ps commented Dec 25, 2014

Replaces the pelican-md-metayaml plugin with an updated fork of it.

@kernc
Copy link
Contributor

kernc commented Feb 1, 2015

How is your updated version better? What is updated? The commit message seems pretty insufficient.

Python-Markdown supports YAML metadata from version 2.6+, but Pelican is as of yet incompatible with it.

@pR0Ps
Copy link
Contributor Author

pR0Ps commented Feb 3, 2015

I added more detailed information to the commit.

The reason I started looking into this plugin is that it didn't work (for me anyway, it may have worked for others). In fixing it, I noticed that it was inheriting the BaseReader class and re-implementing a bunch of logic already defined in the MarkdownReader class. It was also doing some crazy pathing hacks to load the markdown yaml plugin (which was an outdated version because the source was just pasted in at some point).

I basically rewrote the plugin, taking out the pathing hacks, reusing functionality already built into the MarkdownReader class, and changing the library it uses to be a submodule pointing at the current version of the project.

The plugin added as a submodule in this commit can be found here: https://github.com/pR0Ps/pelican-md-metayaml

@justinmayer
Copy link
Member

Since Python-Markdown 2.6 will support YAML metadata, it probably makes the most sense to build on top of that.

@waylan: Do you think it might be possible to release 2.6 sooner rather than later?

@kernc
Copy link
Contributor

kernc commented Feb 18, 2015

I'd be happy to hack the missing bits for seamless support in Pelican. From top of the head, I think the only two issues are:

  • METADATA_PROCESSORS['date'] needs to support date already being a datetime object, and
  • MarkdownReader should relax it's meta requirement to allow meta(yaml=True)

@pR0Ps
Copy link
Contributor Author

pR0Ps commented Feb 18, 2015

I've submitted a pull request to the original project with these changes in it, hopefully it's accepted. I didn't submit one initially because in my experience, completely rewriting someones code and asking them to replace it doesn't usually go over well.

When that pull request is accepted, I'll update this pull request to update to it instead. If Markdown is updated to 2.6+ and works properly with Pelican before then, this issue can just be closed.

@waylan
Copy link

waylan commented Feb 18, 2015

I expect that Python-Markdown 2.6 will be released relatively soon. Possibly within a week - time permitting.

@pR0Ps
Copy link
Contributor Author

pR0Ps commented Feb 19, 2015

The pull request to the original project was accepted so I've updated this pull request to just update the plugin instead of replacing it with a different project.

@justinmayer
Copy link
Member

Thanks, Waylan. Looking forward to the release.

And thanks for the plugin rewrite, Carey!

justinmayer added a commit that referenced this pull request Feb 19, 2015
Replace pelican-md-metayaml with an updated version
@justinmayer justinmayer merged commit cdc3445 into getpelican:master Feb 19, 2015
@kernc
Copy link
Contributor

kernc commented Feb 19, 2015

@justinmayer Looking forward to having Pelican 3.6 deferred by then or at least until the support is in there (working on it).

@waylan
Copy link

waylan commented Feb 20, 2015

FYI, I just released Python-Markdown 2.6. See the release notes.

@justinmayer
Copy link
Member

@waylan: Many thanks for releasing 2.6 within 24 hours of my request. You rock! 👍

@kernc: Are you working on support for YAML-based metadata for Markdown in Pelican? That's how I interpreted your comment above, but I didn't want to assume as much. (^_^) Let me know either way, as I'm trying to plan the schedule for the Pelican 3.6 release. Thanks!

kernc added a commit to kernc/pelican that referenced this pull request Feb 23, 2015
kernc added a commit to kernc/pelican that referenced this pull request Feb 23, 2015
Python-Markdown>=2.6 and its meta extension supports YAML headers
and optional `yaml` switch which, when used, parses data with
PyYAML and hence a wee bit different metadata object gets provided.

Related: getpelican/pelican-plugins#382
@kernc
Copy link
Contributor

kernc commented Feb 23, 2015

@justinmayer, I absolutely am/have been. It just took a little longer than first expected as something more urgent came up. Here's an attempt: getpelican/pelican#1636 Also can look into migrating the 2.6-introduced deprecations if that'd be desirable.

@waylan
Copy link

waylan commented Feb 26, 2015

FYI, you guys might want to see the discussion going on here before going any further with using the built-in meta-data extension for YAML support.

kernc added a commit to kernc/pelican that referenced this pull request May 27, 2015
~~Python-Markdown>=2.6 and its meta extension supports YAML headers
and optional `yaml` switch which, when used, parses data with
PyYAML and hence a wee bit different metadata object gets provided.~~
Not anymore.

YAML is supported by python-markdown-yaml-meta-data extension
which uses PyYAML, which returns parsed lists of strings instead
of raw strings, datetime objects instead of string date
representations etc. Pelican needed only slight adjusting, and
now support Jekyll-like YAML headers with aforementioned Markdown
extension.

Related:
* https://github.com/teoric/python-markdown-yaml-meta-data
* getpelican/pelican-plugins#382
* Python-Markdown/markdown#390 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants