MCPcopy Create free account
hub / github.com/PRQL/prql / write_repr_prql

Function write_repr_prql

prqlc/prqlc/src/debug/render_html.rs:230–256  ·  view source on GitHub ↗
(w: &mut W, source_tree: &SourceTree)

Source from the content-addressed store, hash-verified

228}
229
230fn write_repr_prql<W: Write>(w: &mut W, source_tree: &SourceTree) -> Result {
231 writeln!(w, r#"<div class="prql repr">"#)?;
232
233 write_key_values(w, &[("root", &source_tree.root)])?;
234
235 let reverse_ids: HashMap<_, _> = source_tree
236 .source_ids
237 .iter()
238 .map(|(id, path)| (path, id))
239 .collect();
240
241 for (path, source) in &source_tree.sources {
242 writeln!(w, r#"<div class="source indent">"#)?;
243
244 let source_id = reverse_ids.get(path).unwrap();
245 write_key_values(w, &[("path", &path), ("source_id", source_id)])?;
246
247 let source_escaped = escape_html(source);
248 writeln!(
249 w,
250 r#"<code id="source-{source_id}">{source_escaped}</code>"#
251 )?;
252 writeln!(w, "</div>")?; // source
253 }
254
255 writeln!(w, "</div>")
256}
257
258fn write_repr_lr<W: Write>(w: &mut W, tokens: &lr::Tokens) -> Result {
259 writeln!(w, r#"<table class="lr repr">"#)?;

Callers 1

write_titled_entryFunction · 0.85

Calls 6

write_key_valuesFunction · 0.85
escape_htmlFunction · 0.85
mapMethod · 0.80
iterMethod · 0.80
collectMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected