Skip to content

nirokay/CatTag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CatTag

Warning

This project is still in heavy development.

About

A static HTML/XML and CSS generator from Nim code. For cats (humans are tolerated).

This is the successor to my other/old HTML/XML/CSS generator websitegenerator rewritten (more like reimplemented with major changes, so like, idk how you would call that... remade?) and enhanced.

Installation

Include the following line in your .nimble file: requires "https://github.com/nirokay/CatTag"

or

git clone https://github.com/nirokay/CatTag && cd CatTag && nimble install and include required "cattag" in your .nimble file.

Examples

Feel free to explore the examples subdirectory!

Basic example

This is a very basic example, only showing off HTML generation.

import cattag

var html: HtmlDocument = newHtmlDocument("index.html")

html.add(
    h1(html"Cats"),
    p(html"Cool stuff about cats."),
    h2(html"Facts"),
    ul(
        li(html"cats are cool!"),
        li(html"cats are the best")
    )
)

html.writeFile()
<!DOCTYPE html>
<html>
    <head></head>
    <body>
        <h1>Cats</h1>
        <p>Cool stuff about cats.</p>
        <h2>Facts</h2>
        <ul>
            <li>cats are cool!</li>
            <li>cats are the best</li>
        </ul>
    </body>
</html>

Roadmap

Planned features

  • HTML/XML Generation
  • CSS Generation
  • HTML/XML sugar syntax
  • CSS sugar syntax
  • HTML QoL attribute constants (class, lang, id, ...)
  • HTML QoL procs (p("text") for newHtmlElement("p", "text"))
  • CSS QoL property constants (text-align, background-color, ...)
  • CSS QoL property and property value constants (center, Red, ...)
  • CSS QoL procs
  • DOM procs
  • HtmlElement.style field stuff (usage similar to typescript element style manipulation)

Distant future ideas

  • HTML/XML Parsing
  • CSS Parsing

License

This project is licenced under the GPL-3.0 license.