File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
html5ever/src/tree_builder Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,20 @@ fn current_node<Handle>(open_elems: &[Handle]) -> &Handle {
33
33
open_elems. last ( ) . expect ( "no current element" )
34
34
}
35
35
36
+ /// Helper macro that generates a [pattern](https://doc.rust-lang.org/reference/patterns.html) representing
37
+ /// a [`Tag`] to make matching on [`Tag`]s less verbose.
38
+ ///
39
+ /// This macro accepts 4 forms:
40
+ ///
41
+ /// - `tag!(<div>)` where `div` can be any valid tag name. This matches a start tag where the tag name is "div".
42
+ /// If the tag name contains characters other than [a-zA-Z0-9_] then it should be quoted a `<"div">`.
43
+ /// - `tag!(</div>)` where `div` can be any valid tag name. This matches a end tag where the tag name is "div".
44
+ /// If the tag name contains characters other than [a-zA-Z0-9_] then it should be quoted a `</"div">`.
45
+ /// - `tag!(<>)`. This matches any start tag (regardless of tag name).
46
+ /// - `tag!(</>)`. This matches any end tag (regardless of tag name).
47
+ ///
48
+ /// Additionally any of the above can be freely combined with `|` to create an "or" match pattern.
49
+ /// For example `tag!(<head> | </>)` will match a "head" start tag or any end tag.
36
50
#[ rustfmt:: skip]
37
51
macro_rules! tag {
38
52
// Any start tag
You can’t perform that action at this time.
0 commit comments