asciidocr 0.1.10

A CLI and library for processing and converting asciidoc files
Documentation
//! Backends serve as the "targets" for the parser, which itself only produces an Asg, or
//! Abstract Syntax Graph. Currently the backends include:
//!
//! - HTMLBook (fairly good support; can be used as a relatively "unadorned" HTML generator)
//! - Docx (experimental and still very much in-progress; but good enough for "simple" documents without tables, images, etc.)
//!

#[cfg(feature = "docx")]
pub mod docx;

pub mod htmls;

use clap::ValueEnum;

#[cfg(feature = "docx")]
use self::docx::document::DocxRenderError;
#[cfg(feature = "docx")]
use docx_rs::DocxError;

#[derive(Debug, ValueEnum, Clone)]
/// Enum containing all available backends for `asciidocr`. Note that some backends may be behind
/// feature flags.
pub enum Backends {
    /// Produces "Htmlbook-like" HTML documents.
    Htmlbook,

    /// Produces the Abstract Syntax Tree generated by the parser as json. When STDIN ("-") is
    /// provided as FILE, this backend serves as an Asciidoc TCK adapter
    Json,

    #[cfg(feature = "docx")]
    /// !Experimental! Produces a "manuscript-styled" DOCX document.
    Docx,
}

#[derive(thiserror::Error, Debug)]
pub enum ConversionError {
    #[cfg(feature = "docx")]
    #[error(transparent)]
    Docx(#[from] DocxError),
    #[cfg(feature = "docx")]
    #[error(transparent)]
    DocxRender(#[from] DocxRenderError),
}