Modify Documents#
API#
A rivt file is a Python file (utf-8 ) with the import statement
import rivtlib.rivtapi as rv
which provides four primary API functions and formatting commands and tags. The API functions take a triple quoted string as the argument.
When running in an IDE (e.g. VSCode) the file may be executed interactively. Interactive output is formatted as utf-8 text for speed and compatiblility. API functions may be grouped and executed step-wise using the standard cell decorator # %%. Document and report files are generated by the functions rv.write_public() and rv.write_private() which output files in GitHub Flavored Markdown (GFM) and PDF.
API |
name |
purpose |
---|---|---|
rv.R(str) |
rivtinit |
repository and report settings |
rv.I(str) |
insert |
static text, images and tables |
rv.V(str) |
rivtinit |
values |
rv.T(str) |
tools |
Python functions and scripts |
Each API function defines a document section. The first line of each function includes a section label that becomes a section title, followed by formatting parameters. New sections may be suppressed by prepending a double hyphen to the label.
The section body can contain any utf-8 text. Commands and tags applicable to each function are defined here and here.
The API function names start in column one. All other content is indented 4 spaces to facilitate section folding, bookmarking and legibility. API functions can be written in any order and frequency except for rivtinit, which occurs only once as the initial function in the file. A rivt file is a Python file that follows pep8 and ruff conventions.
rivt markup uses a syntax of commands for file operations and tags for text formatting. Any text not defined with commands or tags is passed through as output. Commands and tags are processed in part by the docutils library and restructuredText.
Commands#
Commands read and write external files and are marked by double bars (||) at the beginning of a line. Command parameters are separated by a single bar (|). In the summary below parameter options are separated with semi-colons, parameter list elements are separated with commas, and options are in parenthesis.
File locations are specified using shortene, relative paths that include the name of the file and the name of its containing folder. Folder organization is described here
command [applicable API] |
---|
|| text | relative path | rivt; plain [R I V] |
The text command inserts and formats plain text files or files with rivt tags. |
|| append | relative path | cover.pdf [R] |
The append command attaches PDF files to the end of the doc. |
|| image | relative path, (2nd path) | width, (width) [I] |
The image command inserts and formats png or jpg files. |
|| table | relative path | max col width, align [I] |
The table command inserts and formats tabular data from csv or xls files. |
|| declare | relative path | print; noprint [V] |
The declare command imports values from a csv file written by rivt. Used for passing calculation results between documents. |
GitHub#
some text
Installation#
VSCode + extensions
LaTeX
Github account
rivt-doc is available for every OS platform and installs either into a single portable folder via a zip file, or as a collection of system programs. It also runs in the cloud at rivt-online and may be installed on GitHub CodeSpaces or other cloud service providers.