jasonwebster / tumblargh

MIT License
128 stars 20 forks source link

There is apparently no support for custom theme options #18

Open marcinant opened 10 years ago

marcinant commented 10 years ago

Short example from http://www.tumblr.com/docs/en/custom_themes/#theme-options Input ./test.html.erb :

<html>
    <head>
        <meta name="text:Flickr Username" content=""/>
    </head>
    <body>
        {block:IfFlickrUsername}
            <div id="flickr_widget">
                <script type="text/javascript"
                src="http://flickr.com/widget?user={text:Flickr Username}">
                </script>
            </div>
        {/block:IfFlickrUsername}
    </body>
</html>

Output on http://0.0.0.0:4567/test.html :

NoMethodError at /test.html
undefined method `capitalize' for nil:NilClass
Ruby    /usr/lib/ruby/gems/1.9.1/gems/activesupport-4.0.4/lib/active_support/inflector/methods.rb: in block in camelize, line 72
Web     GET 0.0.0.0/test.html

Could someone give me an advice how to solve this problem? Does Tumblargh support custom variables and theme options?

jasonwebster commented 10 years ago

Thanks for the report. It should support theme variables, however this looks to be potentially unrelated. I'll write a test case for your example and track down the issue.

marcinant commented 10 years ago

I forund a kind of a workaround. I just moved all variables to data files and configured different data files for development and build. For example: I got /data/devel/flickr.yml and /data/build/flickr.yml

Devel version:

username: "someusername"

Build version:

username: "{text:Flickr Username}"

Then in my layout I can use: data.flickr.username and Middleman will render this differently for development and build.

But it's just a workaround.

jasonwebster commented 10 years ago

Like I said, it should work. It's even tested https://github.com/jasonwebster/tumblargh/blob/master/spec/renderer/blocks_spec.rb#L41 https://github.com/jasonwebster/tumblargh/blob/master/spec/parser_spec.rb#L112

So there's obviously just a bug somewhere.

marcinant commented 10 years ago

Well, I'll try it in a minute.

But in a meanwhile I got another problem with code copied from Disqus.

RuntimeError at /
No appearance option for if:disqusshortname
Ruby    /usr/lib/ruby/gems/1.9.1/gems/tumblargh-0.2.2/lib/tumblargh/renderer/document.rb: in rescue in custom_value_for_type, line 51
Web     GET 0.0.0.0/

Source is here: http://help.disqus.com/customer/portal/articles/758168-tumblr-manual-installation-instructions

And I got meta in header...

marcinant commented 10 years ago

BTW my platform is Linux with Ruby:

ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

Could this cause problems?

jasonwebster commented 10 years ago

Oh.

So, it seems as if when rendering, we don't support conditionals for meta options other than boolean ones.

marcinant commented 10 years ago

Partially fixed with #19