Skip to contents

Returns {svg, animations, diagnostics, warnings}warnings carries structured compiler warnings for accepted-but-ignored input (unknown attribute words, unknown animate effects), each with the same fields as the rpic_error diagnostic. On a pic error the JSON is {error, error_info} instead (no condition is raised — the error travels in-band).

Usage

rpic_manifest(src, circuits = FALSE, texlabels = FALSE)

Arguments

src

pic source code.

circuits

load the native circuit-element library (or write copy "circuits" in the source itself).

texlabels

typeset fully $...$-delimited labels as TeX math (initializer only — the source can still set texlabels = 0).

Value

a JSON string; parse with e.g. jsonlite::fromJSON().

Examples

rpic_manifest('box; animate last box with "pop"')
#> [1] "{\"svg\":\"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"75.2\\\" height=\\\"51.2\\\" viewBox=\\\"0 0 75.2 51.2\\\" font-family=\\\"sans-serif\\\" font-size=\\\"14.666667\\\" fill=\\\"none\\\">\\n<g id=\\\"s0\\\">\\n<rect x=\\\"1.066667\\\" y=\\\"0.533333\\\" width=\\\"72\\\" height=\\\"48\\\" fill=\\\"none\\\" stroke=\\\"black\\\" stroke-width=\\\"1.066667\\\"/>\\n</g>\\n</svg>\\n\",\"animations\":[{\"id\":\"s0\",\"effect\":\"pop\",\"start\":0,\"duration\":0.6}],\"diagnostics\":[],\"warnings\":[]}"