ruby - Jekyll: parametric (partial?) include -


In Jquery, I include a block of HTML code (a Bootstrap is creating multiple tab structure) in my output page Would like to Since the contents of each tab are quite long, I continue to write it in Markdown, with the support of the named link.

However, I have different pages with different tabs, so I prefer to pass the capture contents as include as the parameter of the statement example For, I want to like my .md files:

  --- layout: default title: test keyword: test description: test date : 24 April 2014 --- # test page {% capture content 1%} some content is here ** markdown marka ** want to be able to present myself, capture such _this_ {% endcapture%} {% Materials 2%} Some other stuff I want to be able to as well as the [link] [Google]. [Google]: http://www.google.it/ {% endcapture%} {% contains myparametrictemplate.html section = "content1, content2"%}   

so far , I have the following myparametrictemplate.html :

  ## created to confirm that "content1" and "content2" are accessible ### Section 1 & lt; div class = "mytab" & gt; {{Content1 | Markdownify}} & lt; / Div & gt; ### Section 2 & lt; Div class = "mytab" & gt; {{Content2 | Markdownify}} & lt; / Div & gt; & Lt; Hours / & gt; ## Here is the part that I want to work on to check that include. Section = "content1, content2" `: {{in.sections}} {assign assign arr = include.sections | Here I have printed the string "content1" (or "content2"), that is not the actual content of the liquid tag: ",", "%}" for {item in {% arr}: & lt; Div class = "mytab" & gt; {{Item | Markdownify}} & lt; / Div & gt; {% Endfor%} & lt; Hour / & gt; ## Ugly Solution (% content1%} ### Section 1 
{{Content1 | Markdownify}} {% Endif%} {% Content 2 %} ### Section 2
{% Endif%} {% content3%} ### Section 3 {{Content3 | Markdownify}} & lt; / div> {% endif%}

As you can see, Prints {{item}} (either in the above example code content1 or Content2 ), while I have content1 < / Code> or content2 . To get the latter somehow I have not been able to find anything in liquid documentation.

The ugly solution I have prepared from the last part of the example, which I am not happy (because the way I can not be multiple Is a --- with a different set of each tab --- on the same page).

Edit: A little less ugly solution (Still, not still elegant) is the following:

  ## A little less ugly solution (% arr arr = include.sections | Split: ","%} {% if arr contains "content1"%} ### Section 1 & lt; Div class = "mytab" & gt; {{Content1 | Markdownify}} & lt; / Div & gt; {% Endif%} {% if arr is "content2"%} ### Section 2 & lt; div class = "mytab" & gt; {{Content2 | Markdownify}} & lt; / Div & gt; {% Endif%} {% if arr is "content3"%} ### Section 3 & lt; Div class = "mytab" & gt; {{Content3 | Markdownify}} & lt; / Div & gt; {% Endif%}   

I accept that I'm a newbie rather than Jacques, so I can take the wrong way to solve my problem. Any guidelines will be appreciated, thanks.

Note: I would like to avoid the proposed solution in (or) because I have the .md file on the same page.

An easy way to do this would be:

  # myparametrictemplate Html & lt; div class = "mytab" & gt; {{Content1 | Markdownify}} & lt; / Div & gt; & Lt; div class = "mytab" & gt; {{Content2 | Markdownify}} & lt; / Div & gt; & Lt; div class = "mytab" & gt; {{Content3 | Markdownify}} & lt; / Div & gt;   

You do not have to pass the criteria to get involved because the scope of incorporating the file will be obtained.

So you can just call:

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -