- Rust 92.5%
- PowerShell 7.5%
Content Scripts render to <name>.ContentScript.md with the Groovy body in a ```groovy block. From extendeddata: scheduling becomes a Setting/Value table, and the staticVars source (a json(...) block) is unwrapped into a ```json block. The XMLexport URL now uses versioninfo=current. |
||
|---|---|---|
| .github/workflows | ||
| src | ||
| .gitignore | ||
| build.rs | ||
| Cargo.lock | ||
| Cargo.toml | ||
| download_xml.ps1 | ||
| README.md | ||
| sample.config.yml | ||
| sample.env | ||
OpenText Content Server → Markdown export
Exports OpenText Content Server WebReports (subtype 30303) and LiveReports (subtype 299) to Markdown, preserving the folder tree, the report SQL / HTML body, inputs, params and constants, and cross-linking related reports with Obsidian-style wikilinks.
It reads an OTCS XMLexport of a folder (which returns the whole subtree in a
single call) and renders one .md per report.
Install
Grab a prebuilt binary from the Releases page, or build from source with a Rust toolchain:
cargo build --release
./target/release/otcs-export # otcs-export.exe on Windows
The result is a single self-contained binary (~1.6 MB) with no runtime
dependencies. It reads config.yml / .env from the current working
directory.
To bake the commit/branch into the version footer (otherwise it falls back to
live git, or to the bare semver outside a checkout):
OTCS_GIT_COMMIT=$(git rev-parse HEAD) \
OTCS_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
cargo build --release
The semver is VERSION in src/buildinfo.rs.
Note: LiveReport SQL is reformatted with the
sqlformatcrate;%Nparameter tokens are preserved.
Configure
Configuration comes from (highest precedence first):
- Environment variables —
OTCS_BASE_URL,OTCS_COOKIE,INPUTS,OUT_DIR. config.yml(preferred — supports comments). Copysample.config.yml..env. Copysample.env.
| config.yml | .env / env var | meaning |
|---|---|---|
otcs_base_url |
OTCS_BASE_URL |
cs.exe endpoint root |
otcs_cookie |
OTCS_COOKIE |
LLCookie value or full Cookie header |
inputs |
INPUTS |
node IDs and/or local:// paths (YAML list or CSV) |
out_dir |
OUT_DIR |
output directory (per-input subfolder <id>/) |
Inputs
Each input is either a numeric OTCS node id (fetched live) or a local://
path read from disk:
local://./file.xml single file (relative)
local:///abs/file.xml single file (absolute)
local://./input every *.xml in a folder
Output for each input is written to out_dir/<id>/, mirroring the OTCS folder
structure beneath it.
Downloading XML separately
download_xml.ps1 fetches the XMLexport for every numeric id in your config
and writes ./xml/<id>.xml, so you can then point inputs at
local://./xml. It reads the same config.yml / .env.
pwsh ./download_xml.ps1
Auth note
The OTCS REST API accepts the OTCSTicket header, but classic
cs.exe?func=ll URLs (used by XMLexport) need the session cookie on
OTDS-protected instances. Copy the LLCookie value (or the full Cookie
header) from a logged-in browser session into otcs_cookie / OTCS_COOKIE.
Versioning
VERSION in src/buildinfo.rs holds the semver. Bump it and tag the commit
vX.Y.Z; CI verifies the tag matches, bakes the commit/branch into the binary,
and publishes a release with Linux and Windows binaries. Every exported file
carries a footer with the exact semver-[commit (branch)](link) that produced
it.