{"id":15646330,"url":"https://github.com/yogthos/doc-builder","last_synced_at":"2025-10-26T15:40:36.199Z","repository":{"id":136167187,"uuid":"234175653","full_name":"yogthos/doc-builder","owner":"yogthos","description":"data driven HTML/PDF document builder using Hiccup and EDN","archived":false,"fork":false,"pushed_at":"2024-10-13T19:35:46.000Z","size":318,"stargazers_count":48,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-11T08:51:34.495Z","etag":null,"topics":["clojurescript","hiccup","template-engine"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yogthos.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,"publiccode":null,"codemeta":null}},"created_at":"2020-01-15T21:19:51.000Z","updated_at":"2024-10-13T19:35:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ee8acee-6b2c-4e5d-86b4-85c4b0640560","html_url":"https://github.com/yogthos/doc-builder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogthos%2Fdoc-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogthos%2Fdoc-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogthos%2Fdoc-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogthos%2Fdoc-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yogthos","download_url":"https://codeload.github.com/yogthos/doc-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229927102,"owners_count":18145865,"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":["clojurescript","hiccup","template-engine"],"created_at":"2024-10-03T12:12:27.278Z","updated_at":"2025-10-26T15:40:36.095Z","avatar_url":"https://github.com/yogthos.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# doc-builder\n\nA simple data driven document builder for ClojureScript. A document is\ndescribed using two files. One file conains HTML markup for the document\nin Hiccup format, and the other contains document data in EDN format. The library will inject the EDN data into the markup and compile it to\neither HTML or PDF formats.\n\n[![NPM](https://nodei.co/npm/@yogthos/doc-builder.png?mini=true)](https://www.npmjs.com/package/@yogthos/doc-builder)\n\n## Overview\n\nThe document data should be placed in an EDN file in the `:source` directory.\nSee `documents/sample.edn` for an example.\n\nThe content of the data file is referenced by the template using a namespaced keyword in the following format:\n\n```clojure\n:data/path.to.field\n```\nThe keyword represents a `get-in` path to provide support for accessing nested fields in the document. The above will be translated into `[:path :to :field]` when the template is compiled.\n\nWhen the template is loaded, the values from the data file will be injected into it.\nTemplates can contain code referencing functions from Clojure core, e,g:\n\n```clojure\n[:div.row\n (for [{:keys [network username url]} :data/basics.profiles]\n   [:div.col-sm-6\n    [:strong.network network]\n    [:div.username\n    [:div.url\n    [:a {:href url} username]]]])]\n```\n\nCorresponding data payload should look as follows:\n\n```clojure\n{:basics\n {:network  \"Mastodon Social\"\n  :username \"yogthos\"\n  :url      \"https://mastodon.social/@yogthos\"}}\n```\n\nTemplates use the following directory structure:\n\n```\ntemplates\n  \u003ctemplate name\u003e\n    template.edn\n    \u003crelated files\u003e\n```\n\nTemplates can reference CSS in files from the template directory, e.g:\n\n```clojure\n[:page/css\n   \"css/bootstrap.min.css\"\n   \"css/octicons.min.css\"\n   \"css/resume.css\"]\n```\n\nTemplates can reference images in files relative to the source directory, e.g:\n\n```clojure\n[:page/image {:src :data/basics.picture :width \"100px\"}]\n```\n\nThe image will be injected into the document as a base 64 string.\n\nSee the `default` template for a complete example.\n\n### Usage\n\n1. check out this project locally\n3. run `npm install -g @yogthos/doc-builder`\n3. update `documents/sample.edn` with your data\n4. update `config.edn` as needed, sample config:\n\n\n```clojure\n{;name of the template relative to the templates directory\n :template :default\n ;formats to output \n :formats  [:pdf :html]\n ;puppeteer options, format defaults to Letter\n :pdf-opts {:format \"A4\"} \n ;document template folder\n :source   \"documents\"\n ;output folder\n :target   \"build\"}\n```\n\n5. build the resume by passing one or more documents following the `--docs` flag:\n\n```\ndoc-builder --docs sample.edn\n```\n\nIt's also possible to specify the template using the `--template` flag. This will\noverride the template specified in the config:\n\n\n```\ndoc-builder --docs sample.edn --template :resume\n```\n\n### Development mode\n\n* run `lein cljsbuild watch release` to start cljs compiler\n* run the compiled script with `node doc-builder.js --docs sample.edn`\n* compiling for release `lein cljsbuild once release`\n\n## License\n\nCopyright © 2020 Dmitri Sotnikov\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-2.0.\n\nThis Source Code may also be made available under the following Secondary\nLicenses when the conditions for such availability set forth in the Eclipse\nPublic License, v. 2.0 are satisfied: GNU General Public License as published by\nthe Free Software Foundation, either version 2 of the License, or (at your\noption) any later version, with the GNU Classpath Exception which is available\nat https://www.gnu.org/software/classpath/license.html.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogthos%2Fdoc-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyogthos%2Fdoc-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogthos%2Fdoc-builder/lists"}