Documentation ¶
Overview ¶
Package ciigo is a program to write static web server with embedded files using the asciidoc markup languages.
For more information see the README file at the page repository https://sr.ht/~shulhan/ciigo.
Index ¶
Constants ¶
const (
// DefaultRoot define default Root value for GenerateOptions.
DefaultRoot = "."
)
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
func Convert(opts *ConvertOptions) (err error)
Convert all markup files inside directory "dir" recursively into HTML files using ConvertOptions HtmlTemplate file as base template. If HtmlTemplate is empty it will default to use embedded HTML template. See template_index_html.go for template format.
func GoEmbed ¶ added in v0.7.0
func GoEmbed(opts *EmbedOptions) (err error)
GoEmbed generate a static Go file that embed all files inside Root except the one that being excluded explicitly by ConvertOptions Exclude.
It convert all markup files inside directory "dir" into HTML files, recursively, and then embed them into Go file defined by EmbedOptions.GoFileName.
If HtmlTemplate option is empty it default to use embedded HTML template. See template_index_html.go for template format.
func Serve ¶
func Serve(opts *ServeOptions) (err error)
Serve the content at directory "dir" using HTTP server at specific "address".
func Watch ¶ added in v0.5.0
func Watch(opts *ConvertOptions) (err error)
Watch any changes on markup files on directory Root recursively and changes on the HTML template file. If there is new or modified markup files it will convert them into HTML files using HTML template automatically.
If the HTML template file modified, it will re-convert all markup files. If the HTML template file deleted, it will replace them with internal, default HTML template.
Types ¶
type ConvertOptions ¶ added in v0.6.0
type ConvertOptions struct { // Root directory where its content will be embedded into Go source // code. // Default to DefaultRoot if its empty. Root string // Exclude define regular expresion to exclude certain paths from // being scanned. Exclude string // HtmlTemplate the HTML template to be used when converting markup // file into HTML. // If empty it will default to use embedded HTML template. // See template_index_html.go for template format. HtmlTemplate string // contains filtered or unexported fields }
ConvertOptions define the options to use on Convert function.
type EmbedOptions ¶ added in v0.7.0
type EmbedOptions struct { ConvertOptions memfs.EmbedOptions }
EmbedOptions define the options for calling GoEmbed function.
type ServeOptions ¶ added in v0.6.0
type ServeOptions struct { // Mfs contains pointer to variable generated from Generate. // This option is used to use embedded files for serving on HTTP. Mfs *memfs.MemFS // Address to listen and serve for HTTP request. Address string ConvertOptions // IsDevelopment if set to true, it will serve the ConvertOptions.Root // directory directly and watch all asciidoc files for changes and // convert it. // This is like running Watch, Convert and Serve at the same time. IsDevelopment bool }
ServeOptions contains the options to use on Serve function.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
ciigo
ciigo is a CLI to convert, embed, and/or serve a directory that contains markup files, as HTML files.
|
ciigo is a CLI to convert, embed, and/or serve a directory that contains markup files, as HTML files. |
ciigo-example
Program ciigo-example provide an example on how to build a binary that include the static, generated .go file.
|
Program ciigo-example provide an example on how to build a binary that include the static, generated .go file. |
internal
|
|