aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_utils/to_hast.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-11 16:27:38 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-11 16:27:38 +0200
commite484d1ecc5e405259767c0fd84072226fee40b71 (patch)
tree71d2a2f67870052aa026d0087dfb06cb96c40e17 /tests/test_utils/to_hast.rs
parent73d8609565b808ac73df5ac34e6d4f7f23c25ad6 (diff)
downloadmarkdown-rs-e484d1ecc5e405259767c0fd84072226fee40b71.tar.gz
markdown-rs-e484d1ecc5e405259767c0fd84072226fee40b71.tar.bz2
markdown-rs-e484d1ecc5e405259767c0fd84072226fee40b71.zip
Refactor test utilities to improve names
Diffstat (limited to '')
-rw-r--r--tests/test_utils/mdast_util_to_hast.rs (renamed from tests/test_utils/to_hast.rs)30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/test_utils/to_hast.rs b/tests/test_utils/mdast_util_to_hast.rs
index 1ba8d35..c07d15b 100644
--- a/tests/test_utils/to_hast.rs
+++ b/tests/test_utils/mdast_util_to_hast.rs
@@ -1,3 +1,31 @@
+//! Turn a markdown AST into an HTML AST.
+//!
+//! Port of <https://github.com/syntax-tree/mdast-util-to-hast>, by the same
+//! author:
+//!
+//! (The MIT License)
+//!
+//! Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
+//!
+//! Permission is hereby granted, free of charge, to any person obtaining
+//! a copy of this software and associated documentation files (the
+//! 'Software'), to deal in the Software without restriction, including
+//! without limitation the rights to use, copy, modify, merge, publish,
+//! distribute, sublicense, and/or sell copies of the Software, and to
+//! permit persons to whom the Software is furnished to do so, subject to
+//! the following conditions:
+//!
+//! The above copyright notice and this permission notice shall be
+//! included in all copies or substantial portions of the Software.
+//!
+//! THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+//! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+//! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+//! IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+//! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+//! TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+//! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
use crate::test_utils::hast;
use micromark::{mdast, sanitize, unist::Position};
@@ -34,7 +62,7 @@ enum Result {
}
#[allow(dead_code)]
-pub fn to_hast(mdast: &mdast::Node) -> hast::Node {
+pub fn mdast_util_to_hast(mdast: &mdast::Node) -> hast::Node {
let mut definitions = vec![];
// Collect definitions.