简体   繁体   English

模板+ Haml +自定义主体

[英]Template + Haml + custom body

I have xml which I need to parse and make into an html page. 我有xml,我需要解析并制成html页面。

The contents of the parsed xml have to go inside the body of the html page but the header and html tag come from the template. 解析后的xml的内容必须放在html页面的主体内,但标头和html标记来自模板。

For example: 例如:

%html
%head .....

These two elements in the template and the parsed xml (converted haml elements) have to go into the body. 模板中的这两个元素和已解析的xml(转换后的haml元素)必须进入主体。

%html
%head
%meta-name#content..
%body
%parsed xml (converted haml)

Please give a solution for achieving this using ruby haml. 请提供解决方案,以使用红宝石haml实现此目的。

i think you need a yield in there: 我认为您需要在其中获得收益:

template : 模板:

%html
  %head
    =yield

also see: Structuring of layout template in Haml 另请参见: Haml中布局模板的结构化

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM