| Age | Commit message (Collapse) | Author |
|
While at it, update the example index by removing unnecessary
external image, and update links to open in new tab/window.
|
|
The function that accept struct XxxOptions should only received
the copy of struct, not pointer.
|
|
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.
|
|
|
|
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]
|
|
The internal/cmd/goembed is replaced as command "embed" of
cmd/ciigo-example.
|
|
Replace any usage of ":=" with explicit variable declaration for better
types clarity.
|
|
While at it, replace any use of ioutil with os/io package.
|
|
See https://kilabit.info/journal/2022/gpl/ for more information.
|
|
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.
|
|
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.
|
|
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).
|
|
|
|
While at it, also move the templates into _example and all assets
into the same directory.
|
|
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().
|
|
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".
|
|
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.
|