简体   繁体   中英

JSON not picking up <br>

I have a webpage which uses JSON files for content, but for some reason, not all JSON elements are picking up the html entity <br> and I cannot figure out why...

"pages": [{
    "title": "Title",
    "intro": "Lorum<br>Ipsm",
    "content": [
       {
        "title": "Title 2",
        "text": [
            {"content": "Lorum<br>Ipsm"}
                    ]
       },...

The <br> in my "content" is shown as a line break, but in my "intro" it's not... What can be the cause of this strange behavior?

I call the JSON by using this HTML:

<article class="a_page">
    <section class="left">
        <header>
        <h1>{{title}}</h1>
        </header>

        <section>
            <p>{{intro}}</p>
        </section>
    </section>

    <section class="right">
        {{#content}}
        <section>
            <h2>{{title}}</h2>
                <section>
                    {{#text}}
                        <section>
                    <!--<h3>{{title}}</h3>-->
                    <p>{{{content}}}</p>
                </section>
                {{/text}}
            </section>
        </section>
        {{/content}}
    </section>
</article>

Mustache.js documentation says you should enclose text with tags in triple curly braces. use

{{{intro}}}

instead of

{{intro}}

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