{"id":21526490,"url":"https://github.com/zk33/negi","last_synced_at":"2025-10-27T13:44:42.448Z","repository":{"id":7663493,"uuid":"9025156","full_name":"zk33/negi","owner":"zk33","description":"static html build tool","archived":false,"fork":false,"pushed_at":"2014-05-04T13:31:23.000Z","size":164,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T05:41:57.277Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zk33.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}},"created_at":"2013-03-26T07:26:45.000Z","updated_at":"2017-03-08T02:44:25.000Z","dependencies_parsed_at":"2022-09-12T15:30:57.454Z","dependency_job_id":null,"html_url":"https://github.com/zk33/negi","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/zk33%2Fnegi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk33%2Fnegi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk33%2Fnegi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk33%2Fnegi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zk33","download_url":"https://codeload.github.com/zk33/negi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244089554,"owners_count":20396273,"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":[],"created_at":"2024-11-24T01:45:17.704Z","updated_at":"2025-10-27T13:44:37.415Z","avatar_url":"https://github.com/zk33.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Negi\n====\n\nNegi(禰宜) is a command line tool for building static html file.\nNegi combines Jinja2 template and JSON data, and builds html(or other format) files.\n\n\nRequirements\n------------\npython2.7+\n\nDependencies\n------------\n* [Jinja2](http://jinja.pocoo.org/docs/)\n* [aaaargh](https://github.com/wbolster/aaargh)\n\n\nInstall\n-------\n\n```\npython setup.py install\n```\n\nUsage\n-----\nSetup directories like:\n\n```\nproject_dir/\n    data/   : JSON data directory\n    dist/   : Output directory\n    templates/      :Jinja2 Template directory\n```\n\nThen, on your project_dir, hit command:\n\n```\nnegi build\n```\n\nYou can change directories via command line options. See `negi build -h`.\n\nData(JSON) file structure\n---------\n\n```\ndata/\n    __init__.json           : Loaded first. You can define global params of this directory and pages of this directory. \n    _paramname.json         : Used as global parameter named as \"paramname\"\n    pagename.json           : Renderd as /pagename.html or definition for html files of /pagename/ directory (if has \"_content\" parameter in file)\n    pagename_paramname.json : Used as parameter of /pagename.html\n    _paramtext.txt          : You can use other format files. (simply used as text parameter)\n    sub_dir/\n        __init__.json       : Define global params for files under \"sub_dir\" directory and pages of this directory.\n        index.json          : Renderd as /sub_dir/index.html with parameter of this file\n```\n\n\nJSON data structure\n---------------\n\n```\n{\n    \"IMG_PATH\":\"/img\",              // global \"IMG_PATH\" parameter\n    \"title\":\"site title\",           // global \"title\" parameter\n    \"_contents\":{                   // \"_contents\" is special param to define pages of this directory.\n        \"index\":{                   // meaning create \"index.html\" to this directory.\n            \"title\":\"index\"         // override global \"title\" parameter\n        },\n        \"contact\":{\n            \"title\":\"contact\",\n            \"_ext\":\"cgi\"            // set \"_ext\" param to change extension (\"contact.html\" -\u003e \"contact.cgi\")\n        }\n    }\n}\n```\nAll parameter (except \"_contents\") automatically inherited from parent directory.\n\n\nRule of finding template\n------------\n\nTemplates automatically assigned based on output file path. \n\n### Basic Rule\n\n1. search same directory/same name template file: `/foo/bar.html -\u003e /foo/bar.html`\n1. search underscore-joined template: `/foo/bar.html -\u003e foo\\_bar.html`\n1. search `__base__.html` in same directory: `/foo/bar.html -\u003e foo/__base__.html`\n1. up to parent directory and do same.\n\n\n#### Example: Output path = /index.html\n\nSearch template directory:\n```\n/index.html\n/__base__.html\n```\nand use template found first.\n\n\n### Example: Output path = /spam/egg/ham.php\n\nSearch template directory:\n```\n/spam/egg/ham.php\n/spam/egg/ham.html\n/spam_egg_ham.php\n/spam_egg_ham.html\n/spam/egg/__base__.php\n/spam/egg/__base__.html\n/spam/egg.php\n/spam/egg.html\n/spam_egg.php\n/spam_egg.html\n/spam/__base__.php\n/spam/__base__.html\n/spam.php\n/spam.html\n/__base__.php\n/__base__.html\n```\nand use template found first\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzk33%2Fnegi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzk33%2Fnegi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzk33%2Fnegi/lists"}