aboutsummaryrefslogtreecommitdiff
path: root/cmd/ciigo-example
AgeCommit message (Collapse)Author
2025-01-07all: move example for ciigo as library to internal/cmd/ciigo-exampleShulhan
While at it, update the example index by removing unnecessary external image, and update links to open in new tab/window.
2024-10-06all: refactoring functions to accept non pointer struct optionShulhan
The function that accept struct XxxOptions should only received the copy of struct, not pointer.
2024-05-12_example: fix SPDX header on template fileShulhan
The comment for HTML should end with "-->" not "--!>". While at it, set embedded Go file store the file without modification time to make the output (cmd/ciigo-example/static.go) does not changes on new clone.
2024-05-10all: update module pakakeh.go to latest releaseShulhan
2024-04-11all: fix HTML files always generated when HTMLTemplate is not setShulhan
If the path to HTMLTemplate option is not set, GoEmbed should convert to HTML only if markup file is newer than HTML file or when HTML file not exist.
2024-04-04Release ciigo v0.12.0 (2024-04-04)v0.12.0Shulhan
=== New features * all: add server option to automatically generate index HTML If the requested path is directory and no "index.html" file exist in that directory, ciigo server will render list of files as "index.html" automatically. === Chores * all: replace module "share" with "pakakeh.go" The "share" module has been moved to new repository with new name at "https://sr.ht/~shulhan/pakakeh.go".
2024-03-15go.mod: update module "pakakeh.go" to tipShulhan
2024-03-05all: replace module "share" with "pakakeh.go"Shulhan
2023-12-10all: fix all warnings reported by linter reviveShulhan
Unfortunately, this breaks some API and exported fields, but its better than creating revive.toml file to add an exception. Some breaking changes, * Field [ConvertOptions.HtmlTemplate] become [ConvertOptions.HTMLTemplate] * Method [Converter.SetHtmlTemplateFile] become [Converter.SetHTMLTemplateFile] * Method [Converter.ToHtmlFile] become [Converter.ToHTMLFile]
2023-11-07go.mod: update share module to v0.50.1Shulhan
This release bring many enhancements to "lib/memfs", a library for caching file system in memory. === Enhancements * lib/memfs: return nil in AddChild if file not exist * lib/memfs: quote the path in the returned error * lib/memfs: add method Child to Node * lib/memfs: call the Init method in the embedded file * lib/memfs: include empty directory * lib/memfs: re-scan directory content on Node’s Update
2023-05-14all: bring back support for MarkdownShulhan
I use two remote repositories: GitHub and SourceHut. GitHub support rendering README using asciidoc while SourceHut not. This cause the repository that use README.adoc rendered as text in SourceHut which make the repository page less readable. Also, the pkg.go.dev now render README but only support Markdown. Since we cannot control the SourceHut and go.dev, the only option is to support converting Markdown in ciigo so I can write README using Markdown and the rest of documentation using Asciidoc.
2022-09-06all: update all dependenciesShulhan
The latest asciidoctor-go module fix parsing list description inside include directive.
2022-08-01all: merge internal/cmd/goembed to cmd/ciigo-exampleShulhan
The internal/cmd/goembed is replaced as command "embed" of cmd/ciigo-example.
2022-08-01all: clean up codesShulhan
Replace any usage of ":=" with explicit variable declaration for better types clarity.
2022-07-09all: update share module to v0.39.1-0.20220709072157-a39d5d2246f8Shulhan
This changes update the embedded Go file on cmd/ciigo-example and rename field Development on MemFS Options.
2022-05-19all: reformat all files using latest goimportsShulhan
While at it, replace any use of ioutil with os/io package.
2022-03-09all: update the watcher affected by changes on share moduleShulhan
In the share module, the DirWatcher and Watcher has been moved to package memfs and the way to consumed the changes is not through callback again but through channel.
2022-03-04all: re-convert markup files if HTML template is newer on GoEmbedShulhan
Calling GoEmbed with updated HTML template will reconvert all markup files automatically, as long as the generated Go file is older than the HTML template file.
2022-03-04all: re-licensing ciigo under GPL-3.0 or laterShulhan
See https://kilabit.info/journal/2022/gpl/ for more information.
2021-12-20go.mod: update to latest share moduleShulhan
2021-10-10all: refactoring with latest share moduleShulhan
The lates share module use the term GoEmbed to generate Go source file. In order for this repo in sync with upstream terminology and to minimize confusion, we changes the exported function and command name from "generate" to "embed", this includes * Command "ciigo generate" become "ciigo embed" * Exported function to generate Go renamed from "Generate" to "GoEmbed". This include the parameter GenerateOptions which renamed to EmbedOptions. * The internal command to generate example renamed from "generate" to "goembed"
2021-04-03all: change the Serve signature to ServeOptionsShulhan
Previously, we pass four parameters to Serve function: the instance to memfs.MemFS, the root directory, the address to listen, and path to HTML template. In case we need to add new parameter in the future, the Serve function signature will changes and this is not good for consumer of API. This commit changes the Serve function parameters to ServeOptions so we can add optional parameter in the future without changes to its signature.
2021-02-21all: return error instead of call log.Fatal on non main packagesShulhan
The library, non-main packages, should never call Fatal or panic, its up to the main package or the caller on how to handle it. While at it, fix the returned error to use log prefix and the error value, remove the "ciigo: " prefix.
2021-01-10all: refactoring due to change on memfs packageShulhan
This changes affect exported function Generate and Serve. Previously, the Generate() function accept three options: dir, out, and htmlTemplate; this commit changes the parameter into single struct Options with two additional options: GenPackageName and GenVarName. The GenPackageName allow to set the package name in Go generate source code, default to "main" if not set. The GenVarName set the instance of memfs.MemFS where the embedded files will be stored. On the Serve() function, we add parameter to pass the instance of memfs.MemFS (the one that passed on GenVarName).
2020-12-26go.mod: update with latest asciidoctor-goShulhan
* inline_parser: add zero-width space after ellipsis character * all: add predefined attributes for character replacements * parser: wrap value of email ref name with "mailto:[<value>]" * all: remove parameter isForToC on method element.toHTML * document: rename ToEmbeddedHTML to ToHTMLEmbedded * document: group exported fields for document readibility * all: move some list ordered class names to constants * all: rename file adoc_table to element_table * all: rename type adocTable to elementTable * README: add subsection for list of TODO for Include Directive * Makefile: add task to run test * all: rename the file adoc_node to element * all: rename adocNode to element * all: add unit test for paragraph lead style * all: do not wrap document with content and preamble on ToEmbeddedHTML * all: use consistent names for parser * all: fix list description item than span on multiple lines * all: fix parsing list with open block
2020-11-26all: remove the Author and DateShulhan
Since the generate HTML already render the authors and date, there is no need to save the values in the fileHTML. Also, update the default embedded HTML template with latest format.
2020-11-26htmlgenerator: use the ToHTMLBody instead of ToEmbeddedHTMLShulhan
The ToHTMLBody generate table of contents at the top, while ToEmbeddedHTML require ":toc:" to set to "preamble" or "macro" to get it rendered.
2020-11-24README: reformat to markdown to make it readable by sourcehutShulhan
While at it simplify the example of index.adoc.
2020-11-11all: migrate the repo and Go module to git.sr.ht/~shulhan/ciigoShulhan
2020-11-04htmlgenerator: convert the document with body onlyShulhan
2020-11-04all: update with latest asciidoctor moduleShulhan
2020-11-03all: replace libasciidoc with asciidoctor-goShulhan
2020-10-07all: update to libasciidoc v0.5.1Shulhan
The latest release of libasciidoc changes the API to convert adoc content to HTML. Instead of one call, we need to call ParseDocument first to get the document metadata (Attributes) and then call Convert() to convert it to HTML.
2020-05-07go.mod: update with latest share moduleShulhan
2020-05-07all: rename the "content" directory to "_example"Shulhan
While at it, also move the templates into _example and all assets into the same directory.
2020-05-01all: simplify serving content using function ServeShulhan
Previously to serve the generated content we call two fucntions: NewServer() and Server.Start(). This changes unexported the internal server, and expose only the Serve() function with the same parameter as NewServer().
2020-05-01all: move the file to generate static assets to internal/cmd/generateShulhan
2020-03-30ciigo-example: update generated static.go fileShulhan
2019-12-26go.mod: update required Go to 1.13 and upgrade some dependenciesShulhan
2019-09-27all: include the template file in generated Go codeShulhan
The internal search template require the HTML generator to be initialized with HTML template that provide when running "go generate". Without the template, the internal search function will not work.
2019-09-25content: fix and update documentationShulhan
2019-09-25all: implement search functionalityShulhan
The search function is available through internal API "/_internal/search" with single parameter "q" that contains one or more words to search.
2019-08-14filehtml: unpack the author and date from document metadataShulhan
2019-08-14cmd/ciigo: a CLI to convert, generate, and serve markup filesShulhan
Here are the usage of CLI, ciigo [-template <file>] convert <dir> Scan the "dir" recursively to find markup files (.adoc or .md) and convert them into HTML files. The template "file" is optional, default to "templates/html.tmpl" in the current directory. ciigo [-template <file>] [-out <file>] generate <dir> Convert all markup files inside directory "dir" recursively and then embed them into ".go" source file. The output file is optional, default to "ciigo_static.go" in current directory. ciigo [-template <file>] [-address <ip:port>] serve <dir> Serve all files inside directory "dir" using HTTP server, watch changes on markup files and convert them to HTML files automatically. If the address is not set, its default to ":8080".
2019-08-06cmd/ciigo: move to ciigo-exampleShulhan
The "cmd/ciigo-example" will be used to test and give an example of how to build a binary that contains static, generated .go source file.