#5 in #scp-foundation
An RPC server and client for ftml calls. See the relevant crate documentation for more information on "Foundation Text Markup Language".
Currently it does not connect to a DEEPWELL server for necessary external information (other pages, users, etc.), but will in the future.
This crate targets the latest stable Rust. At time of writing, that is 1.40.0
$ cargo build --release $ cargo run --release -- [arguments] # server
If you wish to use its client, import the crate and use it as a library.
Currently, all errors are transmitted as
The current API provided by the RPC server is as follows:
protocol() -> io::Result<String>:
Returns a static protocol version. Currently
ping() -> io::Result<()>:
Determines if the server is reachable.
time() -> io::Result<f64>:
Returns the system time on the server. It may be in any timezone and is not monotonic.
Followed by the three core ftml methods:
prefilter(input: String) -> io::Result<Result<String, String>>:
Preprocesses the text prior to parsing or rendering. This will load any includes or perform typographic transformations. See ftml Usage for more information.
parse(input: String) -> io::Result<Result<String, String>>:
Prefilters and then parses the input string, returning a JSON object corresponding to the syntax tree. This is currently not typed in code, but follows the object pattern in ftml's
render(page_info: PageInfoOwned, input: String) -> io::Result<Result<HtmlOutput, String>>:
Prefilters, parses, and renders the page into HTML. The definition of the
HtmlOutput object is available
here, though most notable are
html field containing partial HTML (i.e. not including tags like
which contains any generated CSS.
The argument of type
in information about the article being rendered.