Closed arsenerei closed 8 years ago
Thanks!
So I should have checked this PR more carefully but this (and probably the AsciiDoc plugin too) actually needs to be updated as well which is why I've reverted the merge.
If you submit an updated PR I'll take another look :)
I can do that, but I'm not sure what you're referencing? This PR should work for both Markdown and Asciidoc. I can add more tests if necessary, but if there's something wrong let me know. :)
So, the problem is that each plugin injects the part of the path matching its extension as seen in the snippet @lacarmen linked. So, the plugins for each type of parser need to also be updated to use a fallback path.
I'm sorry, it's still not clear to me what you or @lacarmen are saying. Here's my understanding. The only place where dir
is used is in the find-assets
function. In this function I preserve using the mu/dir
command, which will either be Markdown's "md" or Asciidoc's "asc". It will inject this into the first case as "templates/{dir}/pages/", so either "templates/md/pages/" or "templates/asc/pages/". If no assets are found there, then the new functionality will look at "templates/pages" instead.
With this as the proposed functionality, why must the plugins be updated to use a fallback path? Is dir
used elsewhere?
Ah sorry, I've looked a bit more and I misunderstood what was happening there. You're right the dir
from the plugins should be used in the core. However, there are a few more places where the path is used, e.g. here. The full test would be to generate a new project with lein new cryogen blog
, then use the latest version of cryogen-core
and move the templates to the new location.
By default, when using markdown files, Cryogen will look for
resources/templates/md/pages/*.md
. This commits allows Cryogen to fall back toresources/templates/pages/*.md
in the case that it can't find any files in the former directory. It works similarly for posts and Asciidoc files.Since we're looking specifically for
*.md
for Markdown files and*.asc
for Ascii files, this is an opportunity to eliminate redundancy.