asciidoc

package
v0.0.0-...-a3e6692 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: CC0-1.0 Imports: 21 Imported by: 0

Documentation

Overview

Package asciidoc converts AsciiDoc to HTML by sending the AsciiDoc to a Node.js process that uses the Asciidoctor.js Processor API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(cnv *Converter, rootDir string) error

Convert AsciiDoc files with the '.asciidoc' extension to HTML if they are found in the filesystem rooted at the given directory.

Skip conversion of AsciiDoc files with an existing output file modified later than itself. Generally, conversion overwrites existing output files.

An HTML output file will take the same filename as the AsciiDoc input file but with a .html extension and will be a sibling of the input file.

func IsShutdownError

func IsShutdownError(err error) bool

IsShutdownError reports whether the given conversion error is due to a shut down converter.

Types

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

Converter is an AsciiDoc to HTML converter.

func NewConverter

func NewConverter(l *log.Logger) (*Converter, error)

NewConverter constructs a new Converter.

A nil error return value indicates a successful start. A converter that encounters an internal error after a successful start writes internal errors to the given log. Conversion errors are not written to the log.

The working directory is temporarily changed during execution and may be left in an undefined state for the failed start case.

func (*Converter) Convert

func (cvr *Converter) Convert(asciidoc string) (string, error)

Convert the AsciiDoc to HTML.

If the returned error is neither nil nor a shutdown error, as indicated by IsShutdownError, then it is an AsciiDoc conversion error.

If the returned error is a shutdown error, as indicated by IsShutdownError, then the Converter log contains the underlying error if the Converter creation was successful and the shutdown was not graceful.

func (*Converter) Shutdown

func (cvr *Converter) Shutdown()

Shutdown the converter gracefully and release its resources.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL