2016-10-10 63 views
0

這裏是我的苗條的模板:苗條 - 如何讓同時包含純文本和其他節點的節點

h5 
    span built by 
     a href='http://maxpleaner.com' maxpleaner 
     | with 
     a a href='http://github.com/maxpleaner/static' static 

我期待它來呈現這樣的:

通過maxpleaner建有static

但它代替了這個:

建立由href ='http://maxpleaner.com'maxpleaner |與A HREF =「http://github.com/maxpleaner/static」靜態

有沒有辦法混合明文和子節點,或者我需要做的子節點包含我的明文?

回答

1

如果從與標記相同的行開始,Slim會將整個嵌套塊視爲純文本。如果將「通過內置」分解成塊它就像你想:

h5 
    span 
    | built by 
    a href='http://maxpleaner.com' maxpleaner 
    | with 
    a href='http://github.com/maxpleaner/static' static 

你必須要小心這裏的空白,雖然。你可能更願意使用',而不是|,並添加> to your tags

h5 
    span 
    ' built by 
    a> href='http://maxpleaner.com' maxpleaner 
    ' with 
    a href='http://github.com/maxpleaner/static' static 

爲了避免空白的問題,你可以使用一個embedded language like markdown,但是這會增加p標籤,因此可能無法在這種情況下的理想:

h5: span 
    markdown: 
    built by [maxpleaner](http://maxpleaner.com) with [static](http://github.com/maxpleaner/static) 
相關問題