middleman

Tilt (kramdown) preventing ERB processing when rendering markdown

只愿长相守 提交于 2019-12-20 04:51:48
问题 I am building a website with Middleman. I am storing a lot of information in data files, as I am going to use the same information on multiple pages. (Partials wouldn't work for me, as same text from data can be used with different HTML tags or be slightly modified for different pages.) I want to write markdown in data files and then use it within HAML templates for specific pages. When I try to create relative links to other pages while using a reference to other data file, resulting HTML is

middleman console: how to use it?

只愿长相守 提交于 2019-12-13 11:40:29
问题 I would like to know how to use middleman console . Is it a simple irb? What can I do with it that differs from the simple irb? middleman console [options] # Start an interactive console in the cont... I have some articles and I try to do Article.all but I had this following error: NameError: uninitialized constant Middleman::Application::MiddlemanApplication1::Article from (irb#1):1 and I also have local-data /data/friends.json but Friend.all output error too. { "friends": [ "Tom", "Dick",

Middleman Not Found Error (File shows in Sitemap)

有些话、适合烂在心里 提交于 2019-12-12 02:13:58
问题 I removed the old post and I decided to better clarify the problems. I moved the images from / img / directory to / images /, then I removed the /img/ directory and updated all html.erb and partials files to point to /images/ instead of /img/. I installed bootstrap (manually, I had some problems with bower so I decided to do "the easy way"). Then I decided to run "bundle exec middleman build --verbose --clean". As you can see, the command execute normally, but there is a "not found" error in

Middleman not parsing source file up template chain if missing ERb tags

我的梦境 提交于 2019-12-12 00:11:44
问题 I'm converting a Jekyll site to Middleman. I have named my files like filename.html.md.liquid.erb for processing with those libraries in that order: ERb, then liquid, then kramdown. What I found is that if I don't have at least one erb tag in the file, the template parsing simply stops and the whole file is rendered as plain text rather than being parsed by liquid and then kramdown. Simply adding <% if nil %> <% end %> at the bottom of the source document causes the whole template chain to be

Execute Ruby method on whole page in Middleman

走远了吗. 提交于 2019-12-11 15:30:17
问题 On my Middleman-built website, I need to execute specific Ruby code on the contents of all the pages (templates). For example, if I had following helper in my config.rb : def myexample(text) text.gsub("dog","cat") end And in my test.html.haml : = myexample("Some text about a dog.") My previewed and generated /test.html would read: Some text about a cat. However, I am using several different ways to output text that needs to be modified, most notably through HAML's :markdown filter, so I would

How can helpers be accessed from Middleman Console

有些话、适合烂在心里 提交于 2019-12-11 06:35:45
问题 How can helpers be accessed from middleman console ? Answer for both 3.x and 4.x would be helpful if it's not the same object path. 回答1: I couldn't find any documentation on this, so settled for the following work around: Here's my helper module PageHelpers def thing "THING!" end end Call the helper method on an instance of a class that includes it: $ bundle exec middleman console irb...> (class Thing; include PageHelpers; end).new.thing => "THING!" 来源: https://stackoverflow.com/questions

How to debug Middleman 3 gem installation issues on Windows.

两盒软妹~` 提交于 2019-12-11 05:08:00
问题 I have installed Middleman 3.1.5 as described on my Windows 8 Machnine along with Ruby using rubyinstaller-2.0.0-p247.exe and followed the steps to get started with success. I am now building my first site with some success (coding some pages, starting the server, building the site) but when I try to use some advanced third party components like middleman-navigation or middleman-deploy I seem to hit a wall. At first I thought of a mistake by myself but as more and more things seem to be buggy

Middleman: referencing URL stored in a data file from markdown

▼魔方 西西 提交于 2019-12-10 20:46:25
问题 For my Middleman-built website I have stored links and other information about all pages in a data file. data/pages.yaml : pageA: link: /some-long-url-subject-to-change.html name: PageA name info: Some other related info Then, in my HAML template ( source/test.haml ), I can print relative path to pageA with = data.pages.pageA.link . Now, I want to use markdown syntax to reference that page by its name (pageA). Example ( source/test.html.haml ): .info :markdown This is some text with a [manual

Output haml content via :ruby filter

 ̄綄美尐妖づ 提交于 2019-12-10 15:35:29
问题 When I use the :ruby filter to do some simple stuff in haml, for example... :ruby to = comments > max_comments ? max_comments : comments (0...to).each do |i| comment = data[i] puts li_comment comment[0], comment[1], comment[2] end the puts statement writes the output to the console. The docs for :ruby indicate that it Creates an IO object named haml_io , anything written to it is output into the Haml document. How exactly does one use the haml_io object to write to the haml document, but not

How to rendering partials within a partials in middleman

柔情痞子 提交于 2019-12-10 13:06:29
问题 I have some Haml partials, many of which contain the boilerplate .container .row .col-lg-12 When I try to abstract that out ala = partial "site_section" , I get: syntax error, unexpected keyword_end, expecting end-of-input end;end;end;end I'm using ruby 2.2.2. How do I render a Haml partial within a Haml partial in Middleman? Thanks update This is apparently some kind of special case dealing with my partial (above). I have other partials-within-partials rendering just fine. update With