You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
arnaucode c77af453f4 works 7 years ago
.gitignore works 7 years ago
LICENSE Initial commit 7 years ago
README.md works 7 years ago
color.go works 7 years ago
errors.go works 7 years ago
fileOperations.go works 7 years ago
main.go works 7 years ago
timmy works 7 years ago
timmy.png works 7 years ago

README.md

Timmy Go Report Card

web templating engine for static websites, written in Go lang

timmy

Example

  • Simple project structure example:
webInput/
    index.html
    templates/
        userTemplate.html
        userTemplate.json
  • Set the html file:
<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

<timmy-template html="templates/userTemplate.html" data="templates/userTemplate.json"></timmy-template>

</body>
</html>

  • Set the template file:
<div class="class1">
    <div class="class2">{{username}}</div>
    <div class="class2">{{description}}</div>
    <div class="class2">{{phone}}</div>
</div>
  • Set the template data file:
[{
        "username": "Michaela Doe",
        "description": "Hi, I'm here to code",
        "phone": "456456456"
    },
    {
        "username": "John Doe",
        "description": "Hi, I'm here",
        "phone": "123456789"
    },
    {
        "username": "Myself",
        "description": "How are you",
        "phone": "no phone"
    }
]
  • Execute Timmy
./timmy
  • Output:
<!DOCTYPE html>
<html>

<body>
    <h1>My First Heading</h1>
    <p>My first paragraph.</p>
    <div class="class1">
        <div class="class2">Michaela Doe</div>
        <div class="class2">Hi, I'm here to code</div>
        <div class="class2">456456456</div>
    </div>
    <div class="class1">
        <div class="class2">John Doe</div>
        <div class="class2">Hi, I'm here</div>
        <div class="class2">123456789</div>
    </div>
    <div class="class1">
        <div class="class2">Myself</div>
        <div class="class2">How are you</div>
        <div class="class2">no phone</div>
    </div>
</body>

</html>