Struct parsoid::Wikicode [−][src]
Container for HTML, usually represents the entire page
Implementations
impl Wikicode
[src]
pub fn new(body: &str) -> Self
[src]
Create a new Wikicode
instance from raw Parsoid HTML.
pub fn new_node(tag: &str) -> Self
[src]
Create a new HTML node with the given tag
let node = Wikicode::new_node("b"); // Append your list items node.append(&Wikicode::new_text("bolded text")); assert_eq!(&node.to_string(), "<b>bolded text</b>")
pub fn new_text(text: &str) -> Self
[src]
Create a text node with the given contents
let node = Wikicode::new_text("foo bar"); assert_eq!(&node.to_string(), "foo bar"); // Tags will be escaped let weird_node = Wikicode::new_text("foo <bar>"); assert_eq!(&weird_node.to_string(), "foo <bar>");
pub fn set_etag(&mut self, etag: &str)
[src]
Set the etag that came with this request. This allows Parsoid to preserve formatting and avoid dirty diffs when converting modified HTML back to wikitext.
pub fn get_etag(&self) -> Option<&str>
[src]
Get the etag that was set on this Wikicode instance.
pub fn revision_id(&self) -> Option<u32>
[src]
Get the revision id associated with the Parsoid HTML, if it has one.
pub fn title(&self) -> Option<String>
[src]
Get the title associated with the Parsoid HTML, if it has one.
pub fn get_redirect(&self) -> Option<Redirect>
[src]
pub fn text_contents(&self) -> String
[src]
Get a plain text representation of the Parsoid HTML with all markup stripped.
pub fn filter_comments(&self) -> Vec<Comment>
[src]
Get a list of all comments (<!-- example -->
)
Methods from Deref<Target = NodeRef>
pub fn inclusive_ancestors(&self) -> Ancestors
[src]
Return an iterator of references to this node and its ancestors.
pub fn ancestors(&self) -> Ancestors
[src]
Return an iterator of references to this node’s ancestors.
pub fn inclusive_preceding_siblings(&self) -> Rev<Siblings>
[src]
Return an iterator of references to this node and the siblings before it.
pub fn preceding_siblings(&self) -> Rev<Siblings>
[src]
Return an iterator of references to this node’s siblings before it.
pub fn inclusive_following_siblings(&self) -> Siblings
[src]
Return an iterator of references to this node and the siblings after it.
pub fn following_siblings(&self) -> Siblings
[src]
Return an iterator of references to this node’s siblings after it.
pub fn children(&self) -> Siblings
[src]
Return an iterator of references to this node’s children.
pub fn inclusive_descendants(&self) -> Descendants
[src]
Return an iterator of references to this node and its descendants, in tree order.
Parent nodes appear before the descendants.
Note: this is the NodeEdge::Start
items from traverse()
.
pub fn descendants(&self) -> Descendants
[src]
Return an iterator of references to this node’s descendants, in tree order.
Parent nodes appear before the descendants.
Note: this is the NodeEdge::Start
items from traverse()
.
pub fn traverse_inclusive(&self) -> Traverse
[src]
Return an iterator of the start and end edges of this node and its descendants, in tree order.
pub fn traverse(&self) -> Traverse
[src]
Return an iterator of the start and end edges of this node’s descendants, in tree order.
pub fn select(
&self,
selectors: &str
) -> Result<Select<Elements<Descendants>, Selectors>, ()>
[src]
&self,
selectors: &str
) -> Result<Select<Elements<Descendants>, Selectors>, ()>
Return an iterator of the inclusive descendants element that match the given selector list.
pub fn select_first(
&self,
selectors: &str
) -> Result<NodeDataRef<ElementData>, ()>
[src]
&self,
selectors: &str
) -> Result<NodeDataRef<ElementData>, ()>
Return the first inclusive descendants element that match the given selector list.
pub fn serialize<W>(&self, writer: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
Serialize this node and its descendants in HTML syntax to the given stream.
pub fn serialize_to_file<P>(&self, path: P) -> Result<(), Error> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Serialize this node and its descendants in HTML syntax to a new file at the given path.
pub fn text_contents(&self) -> String
[src]
Return the concatenation of all text nodes in this subtree.
pub fn append(&self, new_child: NodeRef)
[src]
Append a new child to this node, after existing children.
The new child is detached from its previous position.
pub fn prepend(&self, new_child: NodeRef)
[src]
Prepend a new child to this node, before existing children.
The new child is detached from its previous position.
pub fn insert_after(&self, new_sibling: NodeRef)
[src]
Insert a new sibling after this node.
The new sibling is detached from its previous position.
pub fn insert_before(&self, new_sibling: NodeRef)
[src]
Insert a new sibling before this node.
The new sibling is detached from its previous position.
Methods from Deref<Target = Node>
pub fn data(&self) -> &NodeData
[src]
Return a reference to this node’s node-type-specific data.
pub fn as_element(&self) -> Option<&ElementData>
[src]
If this node is an element, return a reference to element-specific data.
pub fn as_text(&self) -> Option<&RefCell<String>>
[src]
If this node is a text node, return a reference to its contents.
pub fn as_comment(&self) -> Option<&RefCell<String>>
[src]
If this node is a comment, return a reference to its contents.
pub fn as_doctype(&self) -> Option<&Doctype>
[src]
If this node is a document, return a reference to doctype-specific data.
pub fn as_document(&self) -> Option<&DocumentData>
[src]
If this node is a document, return a reference to document-specific data.
pub fn parent(&self) -> Option<NodeRef>
[src]
Return a reference to the parent node, unless this node is the root of the tree.
pub fn first_child(&self) -> Option<NodeRef>
[src]
Return a reference to the first child of this node, unless it has no child.
pub fn last_child(&self) -> Option<NodeRef>
[src]
Return a reference to the last child of this node, unless it has no child.
pub fn previous_sibling(&self) -> Option<NodeRef>
[src]
Return a reference to the previous sibling of this node, unless it is a first child.
pub fn next_sibling(&self) -> Option<NodeRef>
[src]
Return a reference to the next sibling of this node, unless it is a last child.
pub fn detach(&self)
[src]
Detach a node from its parent and siblings. Children are not affected.
To remove a node and its descendants, detach it and drop any strong reference to it.
Trait Implementations
impl Clone for Wikicode
[src]
impl Debug for Wikicode
[src]
impl Deref for Wikicode
[src]
impl Eq for Wikicode
[src]
impl From<Wikinode> for Wikicode
[src]
impl PartialEq<Wikicode> for Wikicode
[src]
impl StructuralEq for Wikicode
[src]
impl StructuralPartialEq for Wikicode
[src]
impl WikinodeIterator for Wikicode
[src]
fn as_node(&self) -> &NodeRef
[src]
fn append(&self, code: &NodeRef)
[src]
fn prepend(&self, code: &NodeRef)
[src]
fn insert_after(&self, code: &NodeRef)
[src]
fn insert_before(&self, code: &NodeRef)
[src]
fn select(&self, selector: &str) -> Vec<Wikinode>
[src]
fn select_first(&self, selector: &str) -> Option<Wikinode>
[src]
fn filter_links(&self) -> Vec<WikiLink>
[src]
fn filter_external_links(&self) -> Vec<ExtLink>
[src]
fn filter_categories(&self) -> Vec<Category>
[src]
fn filter_templates(&self) -> Result<Vec<Template>>
[src]
fn filter_parser_functions(&self) -> Result<Vec<Template>>
[src]
fn iter_sections(&self) -> Vec<Section>
[src]
fn inclusive_ancestors(&self) -> WikinodeMap<Ancestors>
[src]
fn ancestors(&self) -> WikinodeMap<Ancestors>
[src]
fn inclusive_preceding_siblings(&self) -> WikinodeMap<Rev<Siblings>>
[src]
fn preceding_simblings(&self) -> WikinodeMap<Rev<Siblings>>
[src]
fn inclusive_following_siblings(&self) -> WikinodeMap<Siblings>
[src]
fn following_siblings(&self) -> WikinodeMap<Siblings>
[src]
fn children(&self) -> WikinodeMap<Siblings>
[src]
fn inclusive_descendants(&self) -> WikinodeMap<Descendants>
[src]
fn descendants(&self) -> WikinodeMap<Descendants>
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Wikicode
[src]
impl !Send for Wikicode
[src]
impl !Sync for Wikicode
[src]
impl Unpin for Wikicode
[src]
impl !UnwindSafe for Wikicode
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,