简体   繁体   中英

Template + Haml + custom body

I have xml which I need to parse and make into an html page.

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.

For example:

%html
%head .....

These two elements in the template and the parsed xml (converted haml elements) have to go into the body.

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

Please give a solution for achieving this using ruby haml.

i think you need a yield in there:

template :

%html
  %head
    =yield

also see: Structuring of layout template in Haml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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