doc/rst

reStructuredText file support

Script Overview

The rst library provides support for reStructuredText file generation. The following document was referenced often during implementation:

http://http://docutils.sourceforge.net/rst.html
Dependency Graph

doc/rst: Library Dependencies

View color source code (raw) for this file

View reStructuredText (rst) source code for this page

Native dependencies

Configuration

Block Directive Settings

$rst_code_line_start

If not null, this setting both (a) specifies the starting number to use when prefixing the lines of a code block and (b) enables line numbering in a code block.

Default: null

$rst_admonitions[]

List of supported admonitions

Default: attention caution danger error hint important note tip warning admonition

$rst_image_element

Name of the image directive to generate

Default: image

$rst_image_strict

If set to true, invalid image options generate an error; otherwise, they are ignored.

Default: image

HTML Settings

$rst_html_stylesheets[]

List of HTML stylesheets

Text reflowing

rst_indent

Increments indent and calls another generation function

rst_reflow

Rewraps text with current indent level and column limit

save last word for later

do not emit until we spill

Document

Headers

Blocks

Inline

Lists

Directives

rst_directive()

Generates a directive of the given type ($1) and using the given data ($2).

$1 - The type of directive to emit (e.g. image).

$2 - Directive data (optional). The format depends on the type of
directive ($1).

$@ - Directive body

rst_directive_line()

Prints a single line ($1) of a directive body, indented to align with the directive name.

Directive Options

rst_is_directive_opt()

Checks whether a string ($1) is a directive option.

Returns: Success if the string is a valid directive option

rst_directive_opt_add()

Adds a directive option ($1) and value ($@) pair to $rst_directive_opts[].

$1 - Option name

$@ - Option values (optional)

rst_directive_opt_print()

Prints a directive option ($1) and value ($2).

Topic, Sidebar, Code

rst_topic()

Generates a topic directive

$1 - Topic Title

$@ - Topic Body

rst_sidebar()

Generates a sidebar.

$1 - Title

$2 - Subtitle (may be a null string)

$@ - Sidebar body

rst_block_code()

Generates a code block.

$1 - Code language (see dev/tool/pygmentize)

$@ - Code block body

Admonisions

For a list of supported admonisions, see $rst_admonitions[].

rst_is_admonition()

Checks whether a string ($1) is a valid keyword.

rst_admonition()

Produces the given type ($1) of admonition directive.

$1 - Type of Admonition. See $rst_admonitions[].

Images and Figures

rst_image()

Generates an image directive for the given url ($1) and image options ($@). The following options are supported:

  • :alt:: Alternative image text.
  • :align:: Conrols the alignment of the image.
  • :height:, width: Control the dimensions of the image.
  • :scale:: Control the scale of the image (0-100).
  • :target:: Makes the image into a hyperlink reference.

The type of directive generated is controlled by the value of $rst_image_element. The default value of image generates canonical image directives.

If $rst_image_strict is true, an invalid option will produce an error. Otherwise, option processing will end. The invalid option, along with any other options, will be emitted as part of the directive body.

Note: The value of $rst_image_strict does not impact validation of an option's values. If an invalid value is given for the scale or align options, an error will always be produced.

The rst_figure() function overrides these two settings and calls this function.

$1 - The URL location of the image

$@ - Image options (optional)

rst_is_image_align()

Checks whether a string ($1) is a valid image alignment option value.

$1 - Align option value

Returns: Success if the value is valid.

rst_image_error()

Reports an error found when parsing an image option ($1) or option value ($2).

$1 - The option that generated the error (optional)

$2 - The value of the option

$3 - The type of option error (optional)

rst_figure()

Generates a figure. See the rst_image() function for usage information.

TODO: Tables

Rendering


View the Developer Guide Index

View the Reference Manual Index


Generated on Sat Jul 8 19:41:28 PDT 2017 by mcsh d14 v0.22.0.