TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
render.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
#pragma once
3
// Renders the run report (doc 18 D3, D136) from a route summary (`route --json`, with the sections `route --report`
4
// adds). The renderer reads nothing but the summary and does no arithmetic: every number and every name it prints is a
5
// field of the JSON, and the HTML marks each with its JSON pointer (`data-src`), so a reader can trace any figure.
6
#include <string>
7
8
#include <nlohmann/json.hpp>
9
10
namespace
tmk::report
{
11
12
enum class
Format
{
Html
,
Markdown
};
13
14
// Markdown for a path ending in .md or .markdown, else HTML.
15
Format
format_for_path
(
const
std::string& path);
16
17
// A JSON value as the report prints it: integers as they are, other numbers to three decimals without trailing zeros,
18
// true/false as yes/no, null as n/a, strings as they are.
19
std::string
value_text
(
const
nlohmann::json& v);
20
21
// The report of `summary`. `json_name` is the summary file the report points at for its sources (shown as written).
22
std::string
render
(
const
nlohmann::json& summary,
Format
format,
const
std::string& json_name);
23
24
}
// namespace tmk::report
tmk::report
Definition
render.hpp:10
tmk::report::value_text
std::string value_text(const nlohmann::json &v)
A JSON value as the report prints it: integers as they are, other numbers to three decimals without t...
tmk::report::Format
Format
Definition
render.hpp:12
tmk::report::Format::Markdown
@ Markdown
Definition
render.hpp:12
tmk::report::Format::Html
@ Html
Definition
render.hpp:12
tmk::report::render
std::string render(const nlohmann::json &summary, Format format, const std::string &json_name)
The report of summary. json_name is the summary file the report points at for its sources (shown as w...
tmk::report::format_for_path
Format format_for_path(const std::string &path)
Markdown for a path ending in .md or .markdown, else HTML.
report
render.hpp
Generated by
1.15.0