Guidedog 설명서 1.0.0-beta.16
언어
이 페이지의 내용
Guidedog / 문서 1.0.0-beta.16

guidedoc_rst

The reStructuredText reader of Guidedoc: lines, block structure, explicit markup, and the standard Docutils directives, implemented independently from the Docutils markup specification. Inline markup and reference resolution live in guidedoc_rst_inline, which this crate drives.

use guidedoc::{Registry, Workspace, default_request, dump_to_string, read_document};

let mut ws = Workspace::new();
let mut request = default_request("x.rst", "Hello *world*.\n", "rst", "html");
request.read.promote_title = false;
let doc = read_document(&mut ws, &guidedoc_rst::reader(), &request).unwrap();
assert!(dump_to_string(doc).starts_with("document\n  paragraph\n"));

Dialects (the Sphinx layer) add directives and roles through Extension and read with read_with; another markup (MyST) runs the directives through Host, embed_begin, and Parser::run_hosted.

Re-exports

pub use settings::SmartQuotes
pub use guidedoc_rst_inline::Role
pub use guidedoc_rst_inline::RoleBase
pub use guidedoc_rst_inline::RoleCall
pub use guidedoc_rst_inline::standard_role
pub use guidedoc_rst_inline::standard_roles

Modules

Structs

pub struct guidedoc_rst::DirOption<'d>

One option a directive was given: its specification, its value lines (the rest of the marker line, then the continuation lines), and where it was written.

Fields

pub spec: OptSpec

The option’s specification.

pub lines: Vec<Line<'d>>

The value lines, trimmed.

pub span: SourceSpan

The option’s lines in the source.

pub struct guidedoc_rst::Directive<'d>

A directive split into its parts and checked against its rules. Handlers read it; the lines are views of the current source (Parser::src).

Fields

pub name: &'d str

The directive name as written.

pub span: SourceSpan

The whole directive block.

pub name_span: SourceSpan

The name on the marker line.

pub arg: Vec<Line<'d>>

The argument lines, trimmed; empty when there is no argument.

pub arg_block: Vec<Line<'d>>

The argument lines with their relative indentation.

pub options: Vec<DirOption<'d>>

The options given, in order.

pub content: Vec<Line<'d>>

The content lines, without leading and trailing blank lines.

pub sections: bool

The directive stands where sections are allowed.

pub subst: bool

The directive is inside a substitution definition.

pub subst_name: String

The name of the substitution definition it is in, as written.

Implementations

impl<'d> Directive<'d>
pub fn handler(&self) -> Option<&DirectiveHandler<'d>>

Returns the dialect’s handler that runs the directive; None for a standard one.

pub fn option(&self, name: &str) -> Option<&DirOption<'d>>

Returns the option called name the directive was given.

pub fn has_option(&self, name: &str) -> bool

Tells whether the directive was given option name, flags included.

pub fn option_lines(&self, name: &str) -> Option<&[Line<'d>]>

Returns the value lines of option name.

pub fn option_value(&self, name: &str) -> Option<Cow<'d, str>>

Returns option name’s value lines joined by spaces and trimmed; None when the option was not given.

pub fn option_text(&self, name: &str) -> Option<Cow<'d, str>>

Returns option name’s value lines joined by line breaks and trimmed, as text options such as :start-after: match text that spans lines.

pub fn argument(&self) -> Cow<'d, str>

The argument lines joined by spaces.

pub struct guidedoc_rst::DirectiveHandler<'h>

A dialect’s directive: its rules, checked by the reader before it runs, and a tag the dialect chooses to find its own code again in Extension::run_directive.

Fields

pub name: &'h str

The directive’s canonical name (“py:function”), compared case-insensitively.

pub arg: ArgRule

Whether it takes an argument.

pub final_ws: bool

The last argument may contain white space.

pub content: ContentRule

Whether it takes content.

pub options: &'h [OptSpec]

The options it accepts.

pub tag: usize

The dialect’s own identification of the handler, such as a table index.

pub struct guidedoc_rst::DirectiveShape<'h>

How a directive takes its parts, for a host that checks them itself.

Fields

pub arg: ArgRule

Whether it takes an argument.

pub final_ws: bool

The last argument may contain white space.

pub content: ContentRule

Whether it takes content.

pub options: &'h [OptSpec]

Its options.

pub struct guidedoc_rst::HostDirective<'s>

A directive the host has split into its parts.

Fields

pub name: &'s str

The directive name.

pub name_span: SourceSpan

Where the name was written.

pub span: SourceSpan

The whole directive.

pub arg: Vec<Line<'s>>

The argument lines; empty when there is none.

pub options: Vec<HostOption<'s>>

The options, in order.

pub content: Vec<Line<'s>>

The content lines.

pub sections: bool

The directive stands where sections are allowed.

pub struct guidedoc_rst::HostItem<'s>

One item of a host’s bullet list: its content lines and the index in the given lines of the line it starts on.

Fields

pub lines: Vec<Line<'s>>

The item’s content.

pub start: usize

Where the item starts in the lines Host::items was given.

pub struct guidedoc_rst::HostOption<'s>

A directive option as the host wrote it: its name and value lines.

Fields

pub name: &'s str

The option name.

pub value: Vec<Line<'s>>

The value lines.

pub span: SourceSpan

Where it was written.

pub struct guidedoc_rst::Line<'s>

One input line in columns: tabs expanded, trailing white space stripped. Lines are Copy views; cutting one never copies text.

Fields

pub text: &'s str

The line’s text from its current column.

Implementations

impl<'s> Line<'s>
pub fn from_view(view: LineView<'s>) -> Line<'s>

Makes a line of source text that needs no expansion (a host’s view of a line whose tabs it handles itself, or text without tabs).

pub fn is_blank(&self) -> bool

Tells whether the line has no text (white space is stripped when lines are made).

pub fn is_indented(&self) -> bool

Tells whether the line starts with a space.

pub fn cut(self, k: usize) -> Line<'s>

Drops the first k columns (bytes of the expanded text).

pub fn head(self, n: usize) -> Line<'s>

Keeps the first n columns, without trailing spaces.

pub fn start(&self, tab: usize) -> u32

Returns the source offset where the line’s text starts, with tab stops tab.

pub fn end(&self, tab: usize) -> u32

Returns the source offset where the line’s text ends, with tab stops tab.

pub fn view(&self, tab: usize) -> LineView<'s>

Returns a view of the source bytes the line covers, tabs unexpanded, for inline parsing, whose spans then stay exact.

pub struct guidedoc_rst::Parser<'p, 'a>

The block parser: a read context, the reader’s state, and the dialect’s handlers and host. Handlers receive it; ctx.b builds nodes.

Fields

pub ctx: &'p mut ReadContext<'a>

The read context: builder, options, sources, reports.

Implementations

impl<'p, 'a> Parser<'p, 'a>
pub fn add_common(&mut self, id: NodeId, d: &Directive<'_>, class_opt: &str) -> Result<(), Fail>

Adds the :class: (or class_opt) and :name: options as attributes. Directive nodes keep their Name attribute for the directive name, so :name: becomes Custom “name” there.

pub fn directive_node(&mut self, d: &Directive<'_>, name: &str) -> Result<NodeId, Fail>

Opens a generic Directive node named name.

pub fn custom(&mut self, id: NodeId, name: &str, value: &str) -> Result<(), Fail>

Adds a Custom attribute name = value to node id; both are copied.

impl<'p, 'a> Parser<'p, 'a>
pub fn directive_shape(&self, name: &str) -> Option<DirectiveShape<'p>>

Looks directive name up as the reader would, the dialect’s handlers first.

pub fn run_hosted(&mut self, h: &HostDirective<'_>) -> Result<HostedResult, Fail>

Checks and runs a directive written in the host markup. Options are checked as in reStructuredText; a host with other rules checks them first (directive_shape, option_problem) and passes only those it keeps. Fails only when the builder fails.

pub fn host_lines<'s>(&self, views: &[LineView<'s>], buf: &'s mut String) -> Vec<Line<'s>>

Makes lines of a host’s views of source text: tabs are expanded to the parser’s tab stops into buf, as the reader’s own lines are.

pub fn host_views<'s>(&self, lines: &[Line<'s>]) -> Vec<LineView<'s>>

Gives the host the source text of lines, tabs unexpanded.

pub fn lend<R>(&mut self, f: impl FnOnce(&mut ReadContext<'a>, &mut ReaderState) -> R) -> R

Lends the read context and the reader’s state to f. A host that parses nested content with a reader of its own, whose directives run through this reader again, uses it to move the state where those handlers find it (and back) while the context is with its reader.

pub fn embed_end(&mut self) -> Result<(), Fail>

Ends an embedded read: runs the dialect’s end hook, closes sections, reports what was left dangling, and resolves the document as read does. The state’s storage then goes back to the workspace (ReaderState::end).

impl Parser<'_, '_>
pub fn pool_classes(&mut self, s: &str) -> Result<Option<Text>, Fail>

Writes white-space separated class names as identifiers, one space apart, to the text pool; None when a name has no letters or there is none.

pub fn pool_lower(&mut self, s: &str) -> Result<Text, Fail>

Writes s in lower case (ASCII) to the text pool.

pub fn push_lines(&mut self, lines: &[Line<'_>], sep: &str) -> Result<(), Fail>

Pushes lines joined by sep onto the text run being built (between Builder::text_open and text_close).

pub fn pool_lines(&mut self, lines: &[Line<'_>], sep: &str) -> Result<Text, Fail>

Writes lines joined by sep to the text pool.

pub fn code_text(&mut self, lines: &[Line<'_>]) -> Result<Text, Fail>

Writes lines to the text pool, each ending in “\n” (code).

impl<'p, 'a> Parser<'p, 'a>
pub fn b(&mut self) -> &mut Builder<'a>

The builder of the document being read.

pub fn src(&self) -> SourceId

The source the current lines come from.

pub fn tab(&self) -> usize

The tab stops of the current source.

pub fn is_hosted(&self) -> bool

Tells whether the running directive was written in the host markup.

pub fn inline_state(&mut self) -> &mut InlineState

The inline state: custom roles and the default role.

pub fn stack_guard(&self) -> StackGuard

The stack guard of the read, for a handler’s own recursion (a C++ parser).

pub fn apply_host_role(&mut self, name: &str, lines: &[LineView<'_>], content: std::ops::Range<usize>) -> Result<(), Fail>

Runs role name on interpreted text written in the host markup (MyST’s {name} roles), with the dialect’s roles first; see guidedoc_rst_inline::apply_host_role. Fails only when the builder fails.

pub fn take_pending_classes(&mut self) -> Option<Text>

Takes the classes a class directive left for the next element, if any.

pub fn report(&mut self, m: guidedoc::Message, span: SourceSpan, a: Arg, b: Arg)

Reports message m at span with its arguments. Reports never fail the read.

pub fn open(&mut self, kind: NodeKind, span: SourceSpan) -> Result<NodeId, Fail>

Begins an element and gives it the classes of a preceding class directive.

pub fn close(&mut self, id: NodeId) -> Result<(), Fail>

Ends the element open returned id for.

pub fn span_of(&self, first: &Line<'_>, last: &Line<'_>) -> SourceSpan

The source span from the start of first to the end of last, in the current source, clamped to its text.

pub fn line_span(&self, l: &Line<'_>) -> SourceSpan

The source span of one line.

pub fn lines_span(&self, lines: &[Line<'_>]) -> SourceSpan

The source span of lines without trailing blank lines; empty lines give an empty span at the start of the source.

pub fn inline(&mut self, lines: &[Line<'_>]) -> Result<(), Fail>

Parses lines as inline content of the open node, in the markup of the running directive (see Host).

pub fn inline_views(&mut self, views: &[LineView<'_>]) -> Result<(), Fail>

Parses source views as reStructuredText inline content of the open node.

pub fn inline_node(&mut self, kind: NodeKind, lines: &[Line<'_>]) -> Result<(), Fail>

Adds a node of kind holding lines parsed as inline content; nothing for no lines.

pub fn parse_body(&mut self, lines: &[Line<'_>], sections: bool, each: Option<Text>) -> Result<(), Fail>

Parses nested body content of the open node in the markup of the running directive (see Host); outside hosted directives it is parse_blocks.

pub fn parse_blocks(&mut self, lines: &[Line<'_>], sections: bool, each: Option<Text>) -> Result<(), Fail>

Parses body elements as reStructuredText. sections allows titles and transitions; each gives classes to every element parsed at this level (the class directive’s content).

impl Parser<'_, '_>
pub fn enter_source(&mut self, id: SourceId, tab: usize) -> SourceFrame

Makes the lines of source id current, with tab stops tab, for spans and inline parsing; leave_source restores the previous source.

pub fn leave_source(&mut self, frame: SourceFrame)

Makes the source enter_source returned frame for current again.

pub fn parse_source(&mut self, id: SourceId, sections: bool) -> Result<(), Fail>

Parses a whole registered source (ReadContext::add_source) as body content at the current position, as if its lines stood there. sections allows titles.

impl Parser<'_, '_>
pub fn find_role(&mut self, name: &str) -> Result<Option<usize>, Fail>

Returns the index of the role the document defined under name with the role directive, if any. The search spends work budget.

pub fn class_directive(&mut self, d: &Directive<'_>) -> Result<(), Fail>

Runs the class directive: its classes go to the content’s elements or, without content, to the next element; invalid names are reported.

impl Parser<'_, '_>
pub fn place_titled(&mut self, lines: &[Line<'_>]) -> Result<(), Fail>

Prepares for titled content (parse_titled) as Sphinx’s only directive does: when the content’s first title has an adornment the document already uses, the content stands where a title of that level would, so deeper sections close first.

pub fn parse_titled(&mut self, lines: &[Line<'_>]) -> Result<(), Fail>

Parses content in which titles begin sections, in a title context of its own (Sphinx’s nested parse with titles): adornments take levels afresh, the first nesting in the innermost open section, and the sections close when the content ends. The surrounding adornments are kept for what follows.

impl Parser<'_, '_>
pub fn take_table_extra(&mut self) -> Option<TableExtra>

Takes the title and options of the hosted table directive whose content is being parsed, for the first table the host emits; None outside one or once taken.

pub fn table_decorate(&mut self, id: NodeId, span: SourceSpan, cols: usize, widths: &[usize], extra: Option<&mut TableExtra>) -> Result<(), Fail>

Gives an open Table, before its rows, its widths and a table directive’s attributes and title. A host calls it for the table it emits inside a table directive (take_table_extra).

Trait Implementations

impl fmt::Debug for Parser<'_, '_>
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
pub struct guidedoc_rst::ReaderState

The reader’s state of one document: the current source, tab stops, section levels, pending classes, the inline state, and nesting depth. read keeps one for the call; a host markup that embeds the reader (embed_begin) keeps it between calls and views it as a Parser with ReaderState::parser.

Implementations

impl ReaderState
pub fn new(ctx: &mut ReadContext<'_>, settings: &Settings) -> ReaderState

Prepares the state for the main source of ctx with settings, with the storage an earlier read left in the workspace (end gives it back).

pub fn end(&mut self, ctx: &mut ReadContext<'_>)

Gives the state’s storage back to the workspace for the next read; call it once when the read ends (Parser::embed_end and read_inline do). The state stays usable, with empty buffers.

pub fn parser<'p, 'a>(&'p mut self, ctx: &'p mut ReadContext<'a>, ext: Option<&'p dyn Extension>, host: Option<&'p dyn Host>) -> Parser<'p, 'a>

Views the state as a parser over ctx, with a dialect’s handlers and a host.

Trait Implementations

impl fmt::Debug for ReaderState
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
pub struct guidedoc_rst::SourceFrame

Where the parser stood before enter_source.

pub struct guidedoc_rst::Settings

The reader’s settings. They reach read through ReadOptions::extension, made with guidedoc::read_extension(&settings); settings of another type are refused. Start from Settings::default() (Docutils’ defaults): the bibliographic fields are on.

Directive and role handlers (Extension) and a host markup (Host) are not settings: a dialect passes them to read_with and embed_begin.

Fields

pub pep_references: bool

Implicit “PEP nnn” references in running text become links.

pub rfc_references: bool

Implicit “RFC nnn” references in running text become links.

pub pep_base_url: String

“” means https://peps.python.org/.

pub rfc_base_url: String

“” means https://datatracker.ietf.org/doc/html/.

pub trim_footnote_reference_space: bool

White space before a footnote reference is removed.

pub smart_quotes: SmartQuotes

Typographic quotation marks, apostrophes, dashes, and ellipses in text.

pub smart_quotes_locales: String

Quotation marks per language, overriding the built-in ones, as "tag:“”‘’,tag2:«»‹›": primary open and close, then secondary open and close.

pub language: String

BCP 47 tag of the document language: bibliographic field names, generated titles, and quotation marks. “” means “en”.

pub docinfo: bool

A field list first in the document becomes bibliographic data (docinfo).

pub sectsubtitle: bool

A lone subsection title becomes the section’s subtitle.

pub tab_width: usize

Tab stops; zero means ReadOptions::tab_width, which zero makes 8.

pub character_level_inline_markup: bool

Inline markup is recognized inside words (Docutils’ character_level_inline_markup).

Trait Implementations

impl Default for Settings
fn default() -> Self
pub struct guidedoc_rst::OptSpec

One option a directive accepts.

Fields

pub name: &'static str

The option name, compared exactly.

pub kind: OptType

Its value type.

pub choices: &'static str

Space-separated choices, for OptType::Choice.

pub struct guidedoc_rst::TableExtra

What a table directive adds to its table: a title and attributes. A host markup that emits the table of a hosted table directive takes it with Parser::take_table_extra and passes it to Parser::table_decorate.

Fields

pub width_class: &'static str

“colwidths-auto” or “colwidths-given” from :widths:; a host may set it.

Enums

pub enum guidedoc_rst::HostedResult

The outcome of run_hosted.

Variants

Ran

The directive ran.

Unknown

No directive has that name; nothing was reported.

Failed

The arguments, options, or content were refused and reported.

pub enum guidedoc_rst::ArgRule

Whether a directive takes an argument.

Variants

None

No argument; words on the directive line are content.

Optional

An argument may be given.

Required

An argument must be given.

pub enum guidedoc_rst::ContentRule

Whether a directive takes content.

Variants

None

Content is refused.

Optional

Content may be given.

Required

Content must be given.

pub enum guidedoc_rst::OptType

The type of an option’s value, checked before the directive runs.

Variants

Flag

No value.

Text

Any text, possibly empty.

TextRequired

Non-empty text.

Int

A signed integer.

NonnegInt

A nonnegative integer.

PosInt

A positive integer.

OptInt

A nonnegative integer or nothing.

Length

A CSS length (12px, 3em, a bare number).

LengthPercent

A length or a percentage.

Figwidth

A length, a percentage, or image.

Percentage

A percentage (with or without “%”).

Class

Class names.

Name

A reference name (non-empty).

Choice

One of OptSpec::choices.

Encoding

An encoding name.

Char

One character, tab, space, or a character code.

Widths

auto, grid, or positive integers.

Path

A path (non-empty).

Traits

pub trait guidedoc_rst::Extension

A dialect’s directives, roles, and hooks. Methods take &self: a dialect keeps its per-document state in cells, because handlers run re-entrantly (a directive’s content holds more directives).

fn directive(&self, name: &str) -> Option<DirectiveHandler<'_>>

Returns the handler of directive name, or None for one the dialect does not define (the standard directives are consulted next).

fn run_directive(&self, p: &mut Parser<'_, '_>, d: &Directive<'_>) -> Result<(), Fail>

Runs a checked directive whose handler directive returned (d.handler()). Problems are reported; only a builder failure is an Err.

fn role(&self, _ctx: &mut ReadContext<'_>, _call: &RoleCall<'_>) -> bool

Handles interpreted text before the document’s and the standard roles: emits nodes through ctx.b and returns true, or returns false for a role it does not know.

fn begin(&self, _p: &mut Parser<'_, '_>) -> Result<(), Fail>

Runs before the main source’s blocks.

fn has_prologue(&self) -> bool

Tells whether the dialect has a prologue (prologue). With one, the main source’s leading field lines are read first, on their own, as Sphinx inserts rst_prolog after a document’s bibliographic fields.

fn prologue(&self, _p: &mut Parser<'_, '_>) -> Result<(), Fail>

Runs after the main source’s leading field lines (see has_prologue).

fn end(&self, _p: &mut Parser<'_, '_>) -> Result<(), Fail>

Runs after the main source’s blocks, before sections close (an epilogue).

fn substitution(&self, _name: &str) -> Option<String>

Supplies a default substitution, such as Sphinx’s |version|: resolution asks it for every reference whose name no definition in the document has.

pub trait guidedoc_rst::Host

The host markup’s side of hosted directives. Lines are views of the current source (Parser::src), as the block parser’s are, so every node keeps exact spans. Methods take &self: a host keeps its parser state in cells, as they run re-entrantly.

fn body(&self, p: &mut Parser<'_, '_>, lines: &[Line<'_>], sections: bool, each: Option<Text>) -> Result<(), Fail>

Parses nested body content of the open node; sections allows headings to make sections, and each, when set, gives these classes to every top-level element (the class directive).

fn inline(&self, p: &mut Parser<'_, '_>, lines: &[Line<'_>]) -> Result<(), Fail>

Parses inline content of the open node.

fn items<'s>(&self, p: &mut Parser<'_, '_>, lines: &[Line<'s>]) -> Option<Vec<HostItem<'s>>>

Splits lines that hold one bullet list, in the host’s list syntax, into its items (list-table); None when the lines are not one bullet list.

Functions

pub fn guidedoc_rst::find_handler<'h>(table: &'h [DirectiveHandler<'h>], name: &str) -> Option<&'h DirectiveHandler<'h>>

Returns the handler of table named name, compared case-insensitively.

pub fn guidedoc_rst::embed_begin(ctx: &mut ReadContext<'_>, settings: &Settings, ext: Option<&dyn Extension>) -> Result<ReaderState, Fail>

Prepares the reader for a host that reads the main source itself: the state for ctx with settings, after the dialect’s begin hook ran. The host views the state as a parser (ReaderState::parser) for every call and ends with Parser::embed_end. Fails only when the builder fails.

pub fn guidedoc_rst::path_of(lines: &[Line<'_>]) -> String

Joins path lines without white space, as the specification treats paths.

pub fn guidedoc_rst::dedent(lines: &mut [Line<'_>])

Strips the least indentation of the non-blank lines, in place.

pub fn guidedoc_rst::expand_views<'s>(views: &[LineView<'s>], tab: usize, buf: &'s mut String) -> Vec<Line<'s>>

Makes lines of a host’s views of source text, expanding tabs into buf as split_lines does.

pub fn guidedoc_rst::indent_of(s: &str) -> usize

Counts the spaces s starts with.

pub fn guidedoc_rst::join_lines<'s>(lines: &[Line<'s>], sep: &str) -> Cow<'s, str>

Joins the lines’ text with sep: borrowed for a single line, else a copy.

pub fn guidedoc_rst::trim_blank_end<'l, 's>(lines: &'l [Line<'s>]) -> &'l [Line<'s>]

Returns lines without trailing blank lines.

pub fn guidedoc_rst::trim_blank_start<'l, 's>(lines: &'l [Line<'s>]) -> &'l [Line<'s>]

Returns lines without leading blank lines.

pub fn guidedoc_rst::bullet_width(t: &str) -> usize

Returns the byte length of a bullet that starts t, or 0.

pub fn guidedoc_rst::option_problem(s: &OptSpec, v: &str) -> Option<&'static str>

Checks value v against the option’s type: None when it is valid, else why not.

pub fn guidedoc_rst::read(ctx: &mut ReadContext<'_>) -> Result<(), Fail>

Reads ctx.source as reStructuredText into ctx.b (guidedoc::ReadFn). Problems go to the reports; it fails when the builder fails (a limit, capacity) or reference resolution does.

pub fn guidedoc_rst::read_inline(ctx: &mut ReadContext<'_>, span: SourceSpan) -> Result<(), Fail>

Parses a span of ctx.source as inline content of the builder’s open node, as Sphinx parses a translated message (guidedoc::ReadInlineFn). Each line’s leading white space is dropped. References are left for the caller to resolve.

pub fn guidedoc_rst::read_inline_with(ctx: &mut ReadContext<'_>, span: SourceSpan, settings: &Settings, ext: Option<&dyn Extension>) -> Result<(), Fail>

read_inline with explicit settings and a dialect’s roles.

pub fn guidedoc_rst::read_with(ctx: &mut ReadContext<'_>, settings: &Settings, ext: Option<&dyn Extension>) -> Result<(), Fail>

Reads ctx.source with explicit settings and a dialect’s handlers (the Sphinx layer’s entry point). The extension’s hooks run at their points of the read: begin, prologue (after the leading field lines), end, then resolution with its default substitutions.

pub const fn guidedoc_rst::reader() -> Reader

Returns the “rst” reader descriptor, for a guidedoc::Registry.

pub fn guidedoc_rst::default_settings() -> Settings

Returns Docutils’ defaults: bibliographic fields on, everything else off or empty (Settings::default()).

pub const fn guidedoc_rst::choice(name: &'static str, choices: &'static str) -> OptSpec

Shorthand for a choice option.

pub fn guidedoc_rst::equal_fold(a: &str, b: &str) -> bool

Compares ASCII case-insensitively, as directive and role names are compared.

pub fn guidedoc_rst::find_standard_directive(name: &str) -> Option<DirectiveHandler<'static>>

Returns the standard directive called name, compared case-insensitively, as the handler the reader checks it with; None for any other name.

pub const fn guidedoc_rst::opt(name: &'static str, kind: OptType) -> OptSpec

Shorthand for an option specification without choices.

pub fn guidedoc_rst::standard_directives() -> impl Iterator<Item = DirectiveHandler<'static>>

Returns the standard (Docutils) directives in the order the reader lists them, as the handlers the reader checks them with. The tag of each is its index in that order. A dialect such as the Sphinx layer may redefine some of them.

pub fn guidedoc_rst::column_width(s: &str) -> usize

Returns the display width of s in columns, as Docutils measures a section title against its underline: East Asian wide and fullwidth characters count two columns, combining marks none, every other character one.

Constants

pub const guidedoc_rst::CONFORMANCE: Conformance = Conformance::Partial

How complete the reader is.

pub const guidedoc_rst::VERSION: &str = env!("CARGO_PKG_VERSION")

The reader’s version: the project version.