Skip to content

Commit 671828d

Browse files
author
bors-servo
authored
Auto merge of #401 - federicomenaquintero:expanded-name-docs, r=jdm
Expanded name docs
2 parents 716fcf9 + 2046558 commit 671828d

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

markup5ever/build.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ fn main() {
7171
writeln!(
7272
generated,
7373
r#"
74-
/// Maps the input of `namespace_prefix!` to the output of `namespace_url!`.
74+
/// Maps the input of [`namespace_prefix!`](macro.namespace_prefix.html) to
75+
/// the output of [`namespace_url!`](macro.namespace_url.html).
76+
///
7577
#[macro_export] macro_rules! ns {{
7678
"#
7779
)

markup5ever/interface/mod.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ impl<'a> fmt::Debug for ExpandedName<'a> {
4343

4444
/// Helper to quickly create an expanded name.
4545
///
46+
/// Can be used with no namespace as `expanded_name!("", "some_name")`
47+
/// or with a namespace as `expanded_name!(ns "some_name")`. In the
48+
/// latter case, `ns` is one of the symbols which the [`ns!`][ns]
49+
/// macro accepts; note the lack of a comma between the `ns` and
50+
/// `"some_name"`.
51+
///
52+
/// [ns]: macro.ns.html
53+
///
4654
/// # Examples
4755
///
4856
/// ```
@@ -57,7 +65,15 @@ impl<'a> fmt::Debug for ExpandedName<'a> {
5765
/// ns: &ns!(),
5866
/// local: &local_name!("div")
5967
/// }
60-
/// )
68+
/// );
69+
///
70+
/// assert_eq!(
71+
/// expanded_name!(html "div"),
72+
/// ExpandedName {
73+
/// ns: &ns!(html),
74+
/// local: &local_name!("div")
75+
/// }
76+
/// );
6177
/// # }
6278
#[macro_export]
6379
macro_rules! expanded_name {

0 commit comments

Comments
 (0)