(w: &mut W, source_tree: &SourceTree)
| 228 | } |
| 229 | |
| 230 | fn 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 | |
| 258 | fn write_repr_lr<W: Write>(w: &mut W, tokens: &lr::Tokens) -> Result { |
| 259 | writeln!(w, r#"<table class="lr repr">"#)?; |
no test coverage detected