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 so far , I have the following As you can see, 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: 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 An easy way to do this would be: 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: 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"%}
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
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.
## 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%}
# 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;
Comments
Post a Comment