| Age | Commit message (Collapse) | Author |
|
In development mode, where [ServeOptions.IsDevelopment] is set to true
or when running "ciigo serve", the ciigo HTTP server will check if the
new markup file is newer than HTML file when user press refresh or
reload on the browser.
If its newer, it will convert the markup file and return the new content
of HTML file.
|
|
The [watchfs/v2] bring new enhancements that watching only single file
instead of all markup files for changes.
This minimize number of goroutine calling os.Stat on each markup
files being watched on directory.
|
|
The Ciigo type provides customizable and reusable instance of ciigo for
embedding, converting, and/or serving HTTP server.
This type is introduced so one can add HTTP handler or endpoint along with
serving the files.
|
|
|
|
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]
|
|
|
|
With the latest update on lib/memfs, we can stop the watcher internally.
|
|
This is to provide the timestamp to each log output.
|
|
Instead of using another template, use the embedded template when
generating HTML.
In this way we can see how the generated HTML looks like.
|
|
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.
|
|
|
|
Replace any usage of ":=" with explicit variable declaration for better
types clarity.
|
|
The SetHtmlTemplateFile set or changes the HTML template used by
Converter to convert AsciiDoc to HTML.
|
|
This is the first public API provided for Converter, as promised in the
previous commit.
|
|
The purpose of Converter is to provide a single, reusable converter
for AsciiDoc file or content.
|
|
While at it, replace any use of ioutil with os/io package.
|
|
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.
|
|
See https://kilabit.info/journal/2022/gpl/ for more information.
|
|
Changes,
* fileMarkup: realign from 56 to 48 bytes (-8 bytes)
* htmlGenerator: realign from 32 to 24 bytes (-8 bytes)
* watcher: realign from 48 to 40 bytes (-8 bytes)
|
|
In commit 06d03f6afe37 we skip converting files if the generated HTML
is newer than adoc file.
This cause an issue where the template file changes during Watch or
Serve, but the HTML files is not regenerated.
|
|
Previously, when user call ciigo.Watch(), and the markup file changes,
the onChangeFileMarkup method will print an error "xyz not found" which
cause the markup file not converted.
This is caused by watcher.fileMarkups is empty.
This changes fix this issue by initializing the fileMarkups field using
listFileMarkups, so the next callback to onChangeFileMarkup can detect
the changed file and convert it.
|
|
This update affect the Watcher due to changes on FileState.
|
|
|
|
The ConvertOptions now has the Exclude field that can contains regular
expression. If the Exclude is not empty, it will be compiled and use
in Convert, Generate, Watch, and Serve; to ignore specific paths
being scanned.
|
|
By default, any hidden files on Unix like system, which start with dot '.'
should not be watched for any changes. So does "node_modules" from npm
and "vendor" directory which may contains many unrelated files.
|
|
Previously, we pass the directory to be scanned for asciidoc markup files
and path to HTML template on Convert function. Adding new option to
Convert will cause changes on the Convert signature.
To prevent this, we changes the Convert signature from multiple parameters
into single parameter ConvertOptions.
While at it, change the variable name HTMLTemplate to HtmlTemplate.
|
|
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.
|
|
Now that we have the watcher which task are to watch the asciidoc
files and template files, we can use it in server to minimize duplicate
code.
This changes refactoring the htmlGenerator to initialize the HTML
template from internal or memfs, so the caller did not need to check by
itself.
|
|
The Watch function, watch any changes on asciidoc files on directory
"dir" recursively and changes on the HTML template file.
If there is new or modified asciidoc files it will convert them into HTML
files using HTML template automatically.
If the HTML template file modified, it will re-convert all asciidoc files.
If the HTML template file deleted, it will replace them with internal,
default HTML template.
|