github.com/servernoj/jade@v0.0.0-20231225191405-efec98d19db1/testdata/v2/interpolation.go (about)

     1  // Code generated by "jade.go"; DO NOT EDIT.
     2  
     3  package jade
     4  
     5  import (
     6  	"strings"
     7  
     8  	pool "github.com/valyala/bytebufferpool"
     9  )
    10  
    11  func Jade_interpolation(buffer *pool.ByteBuffer) {
    12  
    13  	var title = "On Dogs: Man's Best Friend"
    14  	var author = "enlore"
    15  	var theGreat = "<span>escape!</span>"
    16  	buffer.WriteString(`<h1>`)
    17  	WriteEscString(title, buffer)
    18  	buffer.WriteString(`</h1><p>Written with love by `)
    19  	WriteEscString(author, buffer)
    20  	buffer.WriteString(`</p><p>This will be safe: `)
    21  	WriteEscString(theGreat, buffer)
    22  	buffer.WriteString(`</p>`)
    23  	var msg = "not my inside voice"
    24  	buffer.WriteString(`<p>This is `)
    25  	WriteAll(strings.ToUpper(msg), true, buffer)
    26  	buffer.WriteString(`</p><p>No escaping for `)
    27  	WriteEscString("}", buffer)
    28  	buffer.WriteString(`!</p><p>Escaping works with \#{interpolation}</p><p>Interpolation works with `)
    29  	WriteEscString("#{interpolation}", buffer)
    30  	buffer.WriteString(` too!</p>`)
    31  
    32  	var riskyBusiness = "<em>Some of the girls are wearing my mother's clothing.</em>"
    33  	buffer.WriteString(`<div class="quote"><p>Joel: `)
    34  	buffer.WriteString(riskyBusiness)
    35  	buffer.WriteString(`</p></div><p>  This is a very long and boring paragraph that spans multiple lines.
    36    Suddenly there is a <strong>strongly worded phrase</strong> that cannot be
    37    <em>ignored</em>.</p><p>  And here's an example of an interpolated tag with an attribute:
    38    <q lang="es">¡Hola Mundo!</q>
    39  
    40  </p><p>If I don't write the paragraph with tag interpolation, tags like<strong>strong</strong>and<em>em</em>might produce unexpected results.</p><p>  If I do, whitespace is <strong>respected</strong> and <em>everybody</em> is happy.
    41  </p>`)
    42  
    43  }