{"id":23326209,"url":"https://github.com/nirokay/websitegenerator","last_synced_at":"2025-04-07T06:44:08.794Z","repository":{"id":188313219,"uuid":"678368465","full_name":"nirokay/WebsiteGenerator","owner":"nirokay","description":"Basic library for generating static html/css written in Nim.","archived":false,"fork":false,"pushed_at":"2024-04-10T10:07:27.000Z","size":250,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-10T11:26:45.038Z","etag":null,"topics":["css-generator","html-generator","static-site-generator","website","website-development","website-generation"],"latest_commit_sha":null,"homepage":"https://nirokay.github.io/nim-docs/websitegenerator/websitegenerator.html","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nirokay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-08-14T11:48:59.000Z","updated_at":"2024-04-10T11:26:52.985Z","dependencies_parsed_at":"2023-12-21T12:40:06.915Z","dependency_job_id":"b4c4e841-9525-4779-b98c-ab589c02c7b6","html_url":"https://github.com/nirokay/WebsiteGenerator","commit_stats":null,"previous_names":["nirokay/websitegenerator"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirokay%2FWebsiteGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirokay%2FWebsiteGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirokay%2FWebsiteGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirokay%2FWebsiteGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nirokay","download_url":"https://codeload.github.com/nirokay/WebsiteGenerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608163,"owners_count":20965950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css-generator","html-generator","static-site-generator","website","website-development","website-generation"],"created_at":"2024-12-20T19:15:05.516Z","updated_at":"2025-04-07T06:44:08.789Z","avatar_url":"https://github.com/nirokay.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebsiteGenerator\n\n## About\n\n**websitegenerator** is a library that lets you generate static HTML and CSS files using Nim code.\n\n## Documentation\n\nSee [here](https://nirokay.github.io/nim-docs/websitegenerator/websitegenerator.html) for in-depth\ncode documentation.\n\n## Use cases\n\n### Static site generation\n\nGenerating static sites is the primary focus of **websitegenerator**, especially if you have repetitive layouts\nwith only the inserted data changing across them.\n\n### On-the-fly generation (for small projects)\n\nYou can use procs to template a HTML page or element and respond to HTTP requests with an HTTP-server.\nFor example [TheDictionary](https://github.com/nirokay/TheDictionary/), my attempt at an urban-dictionary\nwebserver clone, uses **websitegenerator** to send back data with very little client-side javascript.\n\n## Examples\n\nSome basic examples are located in [the examples directory](./examples/), so you can quickly know, if you want to use\nthis or not.\n\nAnother larger example with explanations is a runnable example viewable in\n[the docs](https://nirokay.github.io/nim-docs/websitegenerator/websitegenerator.html)!\n\nList of projects/sites using **websitegenerator**:\n\n* [my homepage](https://nirokay.com/) ([source](https://github.com/src.nirokay.com/))\n* [HzgShowAround](https://nirokay.com/HzgShowAround/) ([source](https://github.com/nirokay/HzgShowAround/))\n* TheDictionary ([source](https://github.com/nirokay/TheDictionary/))\n\nIf you use this software to create a project/website: feel free to create a PR with the edited\n`README.md` or message me somewhere, so you project can be included here.\n\n## Flexible syntax\n\n```nim\nimport websitegenerator\n\nvar\n    document: HtmlDocument = newHtmlDocument(\"index.html\")\n    stylesheet: CssStyleSheet = newCssStyleSheet(\"styles.css\")\n\n# CSS: --------------------------------\nstylesheet.add(\n    # CSS-like (sugar) syntax:\n    \"h1\"{\n        \"text-align\" := \"center\"\n    },\n    # Funky syntax:\n    newCssElement(\"p\",\n        [\"color\", $Red]\n    ),\n    # Semi-funky syntax:\n    newCssClass(\"some-class\",\n        color(rgb(69, 69, 69)),\n        backgroundColor($BlueViolet)\n    ),\n    # Can be used together (but why would you want that?):\n    \".another-class\"{\n        textAlign(\"center\"),\n        \"color\" := $Black,\n        [\"background-color\", $White]\n    }\n)\nstylesheet.writeFile() # Writes file to disk\n\n\n# HTML: -------------------------------\ndocument.setStylesheet(stylesheet) # Adds \"styles.css\" to HTML head\ndocument.addToHead(\n    title(\"Crazy Page!\")\n)\n\ndocument.add( # `document.add` and `document.addToBody` are equivalent\n    h1(\"Hello world!\"),\n    newHtmlElement(\"p\", \"This is some text\"),\n    p(\n        \"Elements are joined with \" \u0026 $code(escapeHtmlText \"\u003cbr /\u003e\") \u0026 \" in \" \u0026 $code(\"p\") \u0026 \" tags.\",\n        \"Every newline\\nas well!\"\n    ),\n    img(\"image.png\", \"Could not load image\"), # Some procs have attributes available as args\n    p(\"More text\").addattr(\"id\", \"id-more-text\"), # But you can add attributes manually if needed\n    p(\"Ugly block\")\n        .setId(\"id-ugly-block\") # Procs for HTML attributes also available\n        .addStyle( # Inline CSS is supported\n            \"color\" := $White,\n            \"background-color\" := $Pink\n        )\n)\n\ndocument.writeFile() # Writes file to disk\n```\n\n## Installation\n\n`nimble install websitegenerator`\n\n## Licence\n\nThis projects codebase is distributed under the [GPL-3.0 licence](https://www.gnu.org/licenses/gpl-3.0.html).\nHowever you may use any output from your project (generated HTML and CSS files) according to the MIT licence - basically\nwithout any limitations on source distribution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirokay%2Fwebsitegenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnirokay%2Fwebsitegenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirokay%2Fwebsitegenerator/lists"}