{"id":16214811,"url":"https://github.com/lecrapouille/websitegenerator","last_synced_at":"2026-02-22T16:33:29.812Z","repository":{"id":115857470,"uuid":"72025821","full_name":"Lecrapouille/WebSiteGenerator","owner":"Lecrapouille","description":"[Tool][Stable version] HTML websites generation based on gnu M4 macros","archived":false,"fork":false,"pushed_at":"2020-04-30T18:08:19.000Z","size":863,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T21:28:17.640Z","etag":null,"topics":["code-generator","html","m4","m4-macros","website"],"latest_commit_sha":null,"homepage":"","language":"M4","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lecrapouille.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":"2016-10-26T17:10:54.000Z","updated_at":"2025-04-07T13:16:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"5126fa1c-f0c8-438c-ac03-5dac438eb960","html_url":"https://github.com/Lecrapouille/WebSiteGenerator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Lecrapouille/WebSiteGenerator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FWebSiteGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FWebSiteGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FWebSiteGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FWebSiteGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lecrapouille","download_url":"https://codeload.github.com/Lecrapouille/WebSiteGenerator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lecrapouille%2FWebSiteGenerator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29718431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T15:10:41.462Z","status":"ssl_error","status_checked_at":"2026-02-22T15:10:04.636Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["code-generator","html","m4","m4-macros","website"],"created_at":"2024-10-10T11:13:05.748Z","updated_at":"2026-02-22T16:33:29.771Z","avatar_url":"https://github.com/Lecrapouille.png","language":"M4","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTML website generator from m4 files\n\n### Introduction\n\nIf you are bored to load heavy website pages (with ~~load of~~ lot of\nadds), you may be interested by this basic\n[M4](https://www.gnu.org/software/m4/m4.html) tool for generating\nlight and static web pages. I'm using it for my [personal\nwebsite](http://q.quadrat.free.fr/index-fr.html).  So why not update\nthis tool for generating your web pages ?\n\nM4 is a complete macro processing tool: it substitutes piece of text\nby another piece of text. M4 manages loops, recursion, postponing\nsubstitutions ... and therefore substitute simple m4 code into\ncomplex-to-maintain code in targeted language. In our case, M4 allows\nme to easily write text of my articles without HTML markups; its job\nconsists to add all these ugly HTML and CSS markups around my text for\ncreating with the same consistency all pages of website.  I'm no\nlonger get lost with diving on unbalanced HTML markups (because they\nare not yet created when writing my articles) or using a commercial\nand complex web tool generator producing overkill HTML code, or\nforgetting to change HTML code in one page. All is generated\nautomatically (even accent conversions). In a second hand, from the\nsame articles and adapting the M4 macros, you could generate other\ndocuments in another language like LaTeX.\n\nYou'll probably make the link with some existing Linux tools for\ngenerating man pages (which I have never made personally) or markdown\nlanguage. I wrote this tool when markdown was not yet as popular as\nnowadays and yes markdown is more friendly than my script but my\nscript can evolve and can be customized. Therefore, thanks to M4, you\nwrite in almost pure human text, and you obtain at final an ugly HTML\ncode too complex to be maintained or easily understandable (and we,\nafter all who really care about beauty of generated code).\n\nBeware M4 is both a powerful tool but also a very very difficult tool\nto use and in addition, everybody seems disliking this tool: there is\nno wrappers or high level routines existing other projects, I\npersonally got lot of headaches debugging some of my macros !\n\n### Architecture\n\nFiles extension convention (this is not conventional but very useful):\n* .m4x: is used for files containing macros definitions (x for executable).\n* .m4: is used for input files to be macro-processed. So all my website\narticles to be parsed into html code.\n\nProject directories overview:\n* WebSiteGenerator/\n* Makefile: entry point calling html-generator/Makefile.generic for generating websites.\n* html-generator/ m4x for creating html code.\n* html-generator/Makefile.generic generic makefile for compiling a webpage.\n* html-generator/theme contain a generic website layout will be used if you have not created your personal one.\n* html-generator/emacs for converting accents to html code.\n\nAdd your websites next to WebSiteGenerator modify the file\nwebsites.list. A real example is given\n[here](https://github.com/Lecrapouille/MyWebSiteSrc).\n\n```\nMyWebSites/\n├── Makefile                    Entry point (nothing to change)\n├── WebSiteGenerator/           M4x code and makefiles (nothing to change)\n│   └── html-generator\n├── WebSiteNumber1/             Your first webpage\n│   ├── en/                     Your first tongue\n│   │   └── article1-en.m4\n│   ├── fr/                     Your second tongue\n│   │   └── article1-fr.m4\n│   ├── icons/\n│   └── layout/                 Will replace WebSiteGenerator/html-generator/theme\n│       ├── css/\n│       └── layout.m4x\n├── WebsiteNumber2/             Your second webpage\n│   └── en/\n│       └── index-en.m4\n└── websites.list               Adapt it for referencing websites to generate\n```\n\n### Steps for producing the website\n```sh\nmake\n```\n\nThe index-fr.html page has been opened. If this is not the case do:\n```sh\ncd build/YourWebSite/\nfirefox index-fr.html\n```\n\n### Prerequisite\n\nInstall the following *nix tools:\n* gnu M4\n* makefile\n* emacs\n\n### Basic test\n\nAs example of the power of M4, lets create a file in YourWebSite/fr named foo-fr.m4 with the content:\n```\nLANG\nTRANS_UPDATED\n```\n\nUpdate websites.list and run the Makefile and you'll see in the build/YourWebSite/ directory a\nfile named foo-fr.html containing something equivalent to:\n```\nfr\nMise \u0026agrave; jour le : Lun 11 sep 17 (12h09)\n````\n\n### My list of useful macros\n\nQuick overview of what can be generated:\n* section, subsection with anchors and links.\n* table of contents from sections\n* table, list\n* colorful code source (C, Forth)\n\n#### Meta\n\n```\nTITLE(My Project)\nAUTHOR(John Doe,my copy-left)\nKEYWORDS(word1,word2,...)\nDESCRIPTION(bla bla)\n```\n\n#### Links\n\n* External link `EXTLINK(https://github.com,link here)`.\n* Internal link `ILINK(anchor_name,link here)`.\n* Basic link `LINK(https://github.com,link here)`.\n* Website link `MYLINK(my_page,link here)`.\n\n#### Translation\n\n```\ndefine([TRANS_SENTENCE],[TRANSLATE([Table des matières],[Table of contents])])\nTRANS_SENTENCE\n```\n\n#### SECTION\n\n```\nSECTION(my_icon,title,anchor,link)\nSUBSECTION(my_icon,title,anchor,link)\nSUBSUBSECTION(my_icon,title,anchor,link)\n```\n\nlink is optional, it is used for index.html page. anchor is used for\nthe table of contents which is automatically created: TABLE_OF_CONTENTS\n\n#### Picture\n\n```\nPICTURE(foo.jpg)\nCAPTION_PICTURE(foo.jpg,caption)\n```\n\n#### A HTML table\n\nThe first parameter is the number of columns.\n```\nTABLE(2,  A,B,  C,D,  E,F)\nTABLE(3,PICTURE(foo.jpg),PICTURE(bar.gif),PICTURE(foobar.png))\n```\n\n#### A HTML lists\n\n```\nLIST(a,b,LIST(b1,b2),c)\n```\n\nBeware when mixing LIST together. Compare the two codes:\n```\nENUM(a,b[]LIST(1,2,3),c,d)\n```\nWith:\n```\nENUM(a,b,LIST(1,2,3),c,d)\n```\n\n#### HTML paragraph\n\nOk this is not done and you will have to call `\u003cp\u003e` and `\u003c/p\u003e`.\n\n### Remarks\n\n* Beware of extra new lines generated. M4 language is pain for\n  that. That is why you'll not see extra lines in m4x and macros\n  finishing with the `dnl` token. I add some shell commands in the\n  Makefile to kill them.\n\n* Be sure m4x files are coded in iso-latin-1 but not UTF-8 else Emacs\n  script will not correctly convert accents. For example in Emacs type\n  `M-x set-buffer-file-coding-system`.\n\n* Beware of the punctuation mark ',' which can conflicting with m4\n  parameter separator. You have to replace your comma by `[,]` or add\n  brackets surrounding the critical sentence. Test this code:\n\n```\nLIST(1,2,3)\nLIST([1,2,3])\n```\n\n### Copying/License\n\n* The emacs/html-accent.el file does not belong to me, see its licence inside the file.\n* .m4x files (I'm the author) are in public domain use and adapt them in the way you want.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flecrapouille%2Fwebsitegenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flecrapouille%2Fwebsitegenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flecrapouille%2Fwebsitegenerator/lists"}