Re: [hyde-dev] How can I change generated filename extension?

173 views
Skip to first unread message

Lakshmi Vyas

unread,
Dec 24, 2012, 8:13:19 PM12/24/12
to hyde...@googlegroups.com
Hi,

Please check this out:

Note that this is just a stop gap solution. I think the extension change should 
be a part of hyde core.

Thanks
Lakshmi

On 25-Dec-2012, at 12:54 AM, Thiago de Arruda <tpadi...@gmail.com> wrote:

I would like to use *.mkd extension for the filenames in the content dir, how can I do that and still have the generated filenames ending with .html ?

--
You received this message because you are subscribed to the Google Groups "Hyde" group.
To post to this group, send email to hyde...@googlegroups.com.
To unsubscribe from this group, send email to hyde-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/hyde-dev/-/2OIedyLisAoJ.
For more options, visit https://groups.google.com/groups/opt_out.



Thiago Padilha

unread,
Dec 25, 2012, 1:01:53 PM12/25/12
to hyde...@googlegroups.com
Thank you very much for this code.

Im confused though: Why do you say it should be part of the core if it can be implemented as a plugin? Unless you mean the renamer plugin should be part of hyde's main package(which I totally agree with)

The current design seems perfect, decoupling content conversion(markdown -> html) from file renaming is elegant and flexible.

I hope you keep up the good work, and thanks for this nice software.


Jared

unread,
Dec 29, 2012, 10:44:02 PM12/29/12
to hyde...@googlegroups.com
Thanks Lakshmi for the gist and Thiago for bringing it up.  I'm trying to implement this as well (after far too many times accidentally double clicking on an .html file and having it open in a browser window).  I copied the following lines from the site.yaml file:

plugins:
    - site_plugins.RenamerPlugin
...
renamer:
    include_file_patterns:
        - '*.md'
        - '*.markdown'
    config:
        html:
            - '*.md'
            - '*.markdown'            

and placed site_plugins.py in the same directory as site.yaml.  After a "rm -rf ./deploy" and "hyde gen -r" the deployed files still have the .md extension.  Did I miss something?  I've checked twice and couldn't find anything else different in the config file that seems like it should matter.

Thanks in advance,
Jared

Lakshmi

unread,
Dec 29, 2012, 11:52:18 PM12/29/12
to hyde...@googlegroups.com
> Why do you say it should be part of the core if it can be implemented as a plugin?

Because file names have special meaning in hyde, for example, the sorter plugin can use the `kind` property 
to filter certain file type.

Perhaps the entire rename functionality need not be a part of hyde core, but the fact that plugins can change the file 
name must be taken into account in other parts of hyde and hyde core must make it much more obvious or transparent.

Lakshmi

unread,
Dec 29, 2012, 11:57:57 PM12/29/12
to hyde...@googlegroups.com
Not really sure why thats happening.

1. What version of hyde are you running? (`hyde --version`)
2. The attached source works for me. Can you share your source (a minimal version that demonstrates the problem)?

Thanks 
Lakshmi
test.zip

Jared Sampson

unread,
Dec 31, 2012, 12:03:39 AM12/31/12
to hyde...@googlegroups.com
It must be some difference in setup, because I can't get the example to work either.  Here's what I have.

$ hyde --version
hyde 0.8.4

I'm running in a virtualenv with the following (from `pip freeze`), most of which were installed as hyde dependencies by pip.

Fabric==1.5.1
Jinja2==2.6
Markdown==2.2.1
PyYAML==3.10
Pygments==1.5
argparse==1.2.1
commando==0.1.2a
hyde==0.8.4
paramiko==1.9.0
pycrypto==2.6
smartypants==1.6.0.3
typogrify==2.0.0
wsgiref==0.1.2

I tried `hyde gen -r` in the unzipped test directory you sent, and all the .md file extensions are still present in ./deploy as in ./content.  (See result of `ls` command below.) 

$ hyde gen -r
 23:51:23 hyde.engine Reading site configuration from [/Users/jared/Downloads/test/site.yaml]
 23:51:24 hyde Regenerating the site...
 23:51:24 hyde.engine Reading site contents
 23:51:24 hyde.engine Generating site at [/Users/jared/Downloads/test]
 23:51:24 hyde.engine Configuring the template environment
 23:51:24 hyde.engine Generating site to [/Users/jared/Downloads/test/deploy]
 23:51:25 hyde Generation complete.
$ ls ./deploy/blog
angry-post.md excerpts.xml index.md

If I run the hyde server, no entries are shown, and clicking on the Blog link produces a bare directory listing.

Obviously this is not a crucial feature, so I can just go back to .html extensions, but if you have any ideas why it works for you and not me, I'm all ears!

Thanks,
Jared


To view this discussion on the web visit https://groups.google.com/d/msg/hyde-dev/-/Q6NZCpGuU4oJ.
Screen Shot 2012-12-31 at 12.01.31 AM.png
Screen Shot 2012-12-31 at 12.01.46 AM.png

Lakshmi Vyas

unread,
Dec 31, 2012, 9:20:53 AM12/31/12
to hyde...@googlegroups.com
> hyde 0.8.4

That might be it. Try running the edge.


<Screen Shot 2012-12-31 at 12.01.31 AM.png><Screen Shot 2012-12-31 at 12.01.46 AM.png>

Jared Sampson

unread,
Dec 31, 2012, 2:14:59 PM12/31/12
to hyde-dev
Ah, I guess I needed the github version, rather than pypi.  Removed hyde and reinstalled with `pip install -e git://github.com/hyde/hyde#egg=hyde` and it works perfectly.

Thanks...and happy 2013!

Jared

Jared Sampson

unread,
Feb 13, 2013, 4:11:30 PM2/13/13
to hyde-dev
Sorry to revive an old thread, but here's a follow-up question.  How can I tell the SorterPlugin to filter only the .md files when, e.g. showing a blog listing page?

As an example, in a fresh "basic" template with the RenamerPlugin installed (per the gist), changing one of the blog entries' extensions from ".html" to ".md" results in loss of one of the posts from the "site:8080/blog/" listing page.  The sorter filter setting for "source.kind" appears to be the culprit.

sorter:
    time:
        attr:
            - meta.created
        reverse: true
        filters:
            source.kind: html
            meta.listable: true

Changing "html" to "md" (without quotes) causes hyde gen to fail. Changing it to "markdown" (without quotes) or "*.md" (with quotes, as in the Renamer config settings) allows the deploy process to complete, but no entries are listed.  Commenting out the source.kind line entirely causes the sorter plugin to choke on the other files in the directory (e.g. atom.xml).

How can I filter for these renamed files?

Thanks,
Jared


Jared Sampson

unread,
Feb 13, 2013, 6:08:39 PM2/13/13
to hyde-dev
After some tinkering, it turns out this issue was somehow related to the tagger plugin (which was set to use the "time" sorter).  After disabling that plugin, which I don't actually use anyway, everything turns out to work fine.

Sorry for the inbox invasion.

Thanks,
Jared
Reply all
Reply to author
Forward
0 new messages