aboutsummaryrefslogtreecommitdiff
path: root/watcher_test.go
AgeCommit message (Collapse)Author
2026-01-24all: conform with Lighthouse recommendationsShulhan
The foreground color changes to conform with color-contrast ratio threshold, with score AAA. [1] Add ARIA role to each section of pages: banner for topbar, main for page, and contentinfo for footer. This is to make the webpage more robust and functional no matter what screen reader technology is used. [2] For touch devices, increase the line height on Table of Contents. This is to help users who may have difficulty in confidently targeting or operating small controls. [3] [1]: https://dequeuniversity.com/rules/axe/4.11/color-contrast [2]: https://dequeuniversity.com/rules/axe/4.11/landmark-one-main [3]: https://dequeuniversity.com/rules/axe/4.11/target-size
2026-01-24_static: simplify the topbar sectionShulhan
Instead of splitting the topbar into top-heading and menu, breaking it down by class item.
2026-01-24all: embed CSS and index HTML template using memfsShulhan
Previously, with direct embed, every time we change the CSS or index template, we need to restart the "ciigo serve" command. Using memfs make us easy to update and see the changes directly, without restarting the server.
2025-01-07all: auto convert markup when HTTP client request GET to HTML fileShulhan
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.
2025-01-07all: refactoring to use [watchfs/v2]Shulhan
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.
2024-09-28all: introduce new type CiigoShulhan
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.
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-09all: simplify test for Watcher by using TempDirShulhan
By using TempDir we did not need to remove and create directory when the testing started. While at it, set the default DirWatcher delay to 100ms and decrease each "time.Sleep" duration on tests to make test finish faster.
2023-11-09all: add method to stop watcherShulhan
With the latest update on lib/memfs, we can stop the watcher internally.
2023-05-14all: rewrite watcher tests using lib/test.DataShulhan
Instead of using another template, use the embedded template when generating HTML. In this way we can see how the generated HTML looks like.
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.
2023-03-03all: update asciidoctor-go and share module to latest versionShulhan
Changes on the asciidoctor-go v0.4.1, === Bug fixes * all: fix empty line printed on ToHTMLBody or ToHTMLEmbedded * all: ignore parsing block image in paragraph === Enhancements * all: handle empty preamble
2022-08-20all: try to fix test that sometimes fail inside containerShulhan
When the test running we create directory testdata/watcher, create a new file testdata/watcher/index.adoc and expect that the modify time for testdata/watcher is changes. Except that sometimes it is not. The modification time of directory watcher before and after the file created most of times equal and this cause the test wait indifinitely and fail. This changes add 1 second delay before creating file inside directory to make sure that the modification time changes.
2022-08-07all: remove delay for testing WatchShulhan
The delay sometimes cause the test locked and hung.
2022-08-06all: cleaning up codesShulhan
2022-08-01all: clean up codesShulhan
Replace any usage of ":=" with explicit variable declaration for better types clarity.
2022-08-01all: export convert method in Converter as ToHtmlFileShulhan
This is the first public API provided for Converter, as promised in the previous commit.
2022-08-01all: export internal htmlGenerator as ConverterShulhan
The purpose of Converter is to provide a single, reusable converter for AsciiDoc file or content.
2022-05-19all: reformat all files using latest goimportsShulhan
While at it, replace any use of ioutil with os/io package.
2022-03-04all: re-licensing ciigo under GPL-3.0 or laterShulhan
See https://kilabit.info/journal/2022/gpl/ for more information.
2021-10-17all: fix empty fileMarkups on watcherShulhan
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.
2021-10-08all: update share module to latest versionShulhan
This update affect the Watcher due to changes on FileState.
2021-04-06go.mod: set the minimum Go to 1.16 and update the dependenciesShulhan
2021-04-03all: add option to exclude certain paths using regular expressionShulhan
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.
2021-02-21all: rewrite to use the watcherShulhan
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.
2021-02-21all: implement Watch functionalityShulhan
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.