Template engine mustache c#

Viewed 24

I am trying to program a blog by using an html text and now need to reformulate my body part with mustache template engine and Replace method. Could someone tell me how this works? (yes, I'm a beginner)

<body>
    <h4> meine Blogeinträge </h4>
    <ul>

        <li> name={blogeintrag.name} </li>
        <li> datum={blogeintrag.datum} </li>
        <li> text={blogeintrag.text} </li>
    </ul>
</body>



     
        List<Blogeintrag> geladeneEintraege = JsonConvert.DeserializeObject<List<Blogeintrag>>(readText);
        StreamWriter htmlText = new StreamWriter(@"C:\text.html");
        string head = @"head.txt";
        string readhead = File.ReadAllText(head);
        string footer = @"C:\footer.txt";
        string readfooter = File.ReadAllText(footer);
        string body = @"\html.text";
        string readbody = File.ReadAllText(body);
      
       
        foreach (Blogeintrag blogeintrag in geladeneEintraege)
        {
            object correct = readbody.Replace(" < ", "${}<'" ); -> its wrong

            htmlText.WriteLine(readhead +correct + readfooter);
                         


           Console.WriteLine($"text ={blogeintrag.text}, name={blogeintrag.name}, datum = 
           {blogeintrag.datum}");
        }

        htmlText.Close();
0 Answers
Related