1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// This file is part of html5ever_ext. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/html5ever_ext/master/COPYRIGHT. No part of html5ever_ext, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
// Copyright © 2017 The developers of html5ever_ext. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/html5ever_ext/master/COPYRIGHT.
//! # html5_ext
//!
//! This is set of unofficial extensions to the [html5ever](https://github.com/servo/html5ever) crate's RcDom and Node structs, including a ***minifying HTML5 serializer*** and support for ***CSS matching**.
//!
//! It re-exports the `css` and `html5ever` crates, and useful DOM types hidden inside the `::html5ever::markup5ever::rcdom` module.
//!
//!
//! ## How Tos
//!
//!
//! ### To load and minify HTML5
//!
//! ```
//! extern crate html5_ext;
//! use ::html5ever_ext::RcDom;
//! use ::html5ever_ext::RcDomExt;
//! use ::html5ever_ext::Minify;
//!
//! let rc_dom = RcDom::from_file_path_verified_and_stripped_of_comments_and_processing_instructions_and_with_a_sane_doc_type("/path/to/document.html").expect("invalid HTML");
//! rc_dom.minify_to_file_path();
//! ```
//!
//! There are additional methods available on `Minify` to minify to a byte array or a generic `Write`-implementing writer.
//!
//! For more control, eg over serializing multiple node graphs, use the struct `UltraMinifyingHtmlSerializer` directly.
//!
//!
//! ### To match CSS selectors
//!
//! ```
//! extern crate html5_ext;
//! use ::html5ever_ext::RcDom;
//! use ::html5ever_ext::RcDomExt;
//! use ::html5ever_ext::parse_css_selector;
//! use ::html5ever_ext::Selectable;
//! use ::html5ever_ext::Minify;
//!
//! let rc_dom = RcDom::from_file_path_verified_and_stripped_of_comments_and_processing_instructions_and_with_a_sane_doc_type("/path/to/document.html").expect("invalid HTML");
//!
//! let selector = parse_css_selector("p.myclass").unwrap();
//!
//! assert!(!rc_dom.matches(&selector));
//!
//! rc_dom.find_all_matching_child_nodes_depth_first_including_this_one(&selector, |node|
//! {
//! eprintln!("{}", node.debug_string());
//!
//! const SHORTCUT: bool = false;
//! SHORTCUT
//! })
//! ```
//!
//! ### To work with Nodes
//!
//! Use the `NodeExt`, `Minify`, `Selectable` and `QualNameExt` traits.
//!
pub extern crate css;
pub extern crate html5ever;
extern crate quick_error;
pub use parse_css_selector;
use NamespaceUrl;
use matches;
use OurSelector;
use OurSelectorImpl;
use Element;
use OpaqueElement;
use SelectorImpl;
use AttrSelectorOperation;
use CaseSensitivity;
use NamespaceConstraint;
use SELECTOR_WHITESPACE;
use ElementSelectorFlags;
use LocalMatchingContext;
use MatchingContext;
use RelevantLinkStatus;
pub use Attribute;
pub use LocalName;
pub use QualName;
use NonAtomic;
use Tendril;
use UTF8;
pub use Node;
pub use NodeData;
use *;
pub use RcDom;
use ResultExt;
use AsciiExt;
use Cell;
use RefCell;
use fmt;
use Debug;
use Formatter;
use io;
use Write;
use uninitialized;
use Deref;
use Path;
use PathBuf;
use Rc;
include!;
include!;
include!;
include!;
include!;
include!;
include!;
include!;
include!;
include!;