ftml/render/debug.rs
1/*
2 * render/debug.rs
3 *
4 * ftml - Library to parse Wikidot text
5 * Copyright (C) 2019-2025 Wikijump Team
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21//! A simple renderer that outputs the `SyntaxTree` using Rust's debug formatter.
22
23use super::prelude::*;
24
25#[derive(Debug)]
26pub struct DebugRender;
27
28impl Render for DebugRender {
29 type Output = String;
30
31 #[inline]
32 fn render(
33 &self,
34 tree: &SyntaxTree,
35 page_info: &PageInfo,
36 settings: &WikitextSettings,
37 ) -> String {
38 debug!("Running debug logger on syntax tree");
39 format!("{settings:#?}\n{page_info:#?}\n{tree:#?}")
40 }
41}