@isaiah, I'm not sure which part do you need the help with, but I'm pretty sure 
the code as written doesn't do what you want it to. It's not easy to deduce 
your intent, so please, tell us what you're trying to achieve.

The code above doesn't really require any real templating as the only 
substitution I see is the `{body}` in the first proc. So it could be written as:
    
    
    const
      MainHeader = """
    <!doctype html>
    <html>
      <head>
        <title>Blog Written in Nim</title>
        <link rel="stylesheet" type="text/css" href="style.css">
      </head>
      <body>
    """
      Footer = """
      </body>
    </html>
    """
      LoginDiv = """
      <div id="login">
        <span>Login</span>
        <span>Please type in your username...</span>
        <form action="login" method="post">
          <input type="text" name="username">
          <input type="password" name="password">
          <input type="submit"  value="Login">
        </form>
      </div>
    """
    
    func renderMain*(body: string): string =
      MainHeader & body & Footer
    
    func renderLogin*(): string =
      LoginDiv
    
    echo renderMain("  <h1>Happy holidays!</h1>\n" & renderLogin())
    
    
    Run

If the [Source Code Filters 
documentation](https://nim-lang.org/docs/filters.html) is not doing it for you, 
here's one more example of using it for basic HTML templating: 
<https://github.com/indiscipline/catalay/blob/main/src/preview.nimf>

Reply via email to