pub struct Wikicode { /* private fields */ }
Expand description

Container for HTML, usually represents the entire page

Implementations

Create a new Wikicode instance from raw Parsoid HTML.

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>")

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 &lt;bar&gt;");

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.

Get the etag that was set on this Wikicode instance.

Get the HTML spec version for this document, if it’s available

Get the revision id associated with the Parsoid HTML, if it has one.

Get the title associated with the Parsoid HTML, if it has one.

Get a plain text representation of the Parsoid HTML with all markup stripped.

Methods from Deref<Target = NodeRef>

Return an iterator of references to this node and its ancestors.

Return an iterator of references to this node’s ancestors.

Return an iterator of references to this node and the siblings before it.

Return an iterator of references to this node’s siblings before it.

Return an iterator of references to this node and the siblings after it.

Return an iterator of references to this node’s siblings after it.

Return an iterator of references to this node’s children.

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().

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().

Return an iterator of the start and end edges of this node and its descendants, in tree order.

Return an iterator of the start and end edges of this node’s descendants, in tree order.

Return an iterator of the inclusive descendants element that match the given selector list.

Return the first inclusive descendants element that match the given selector list.

Serialize this node and its descendants in HTML syntax to the given stream.

Serialize this node and its descendants in HTML syntax to a new file at the given path.

Return the concatenation of all text nodes in this subtree.

Append a new child to this node, after existing children.

The new child is detached from its previous position.

Prepend a new child to this node, before existing children.

The new child is detached from its previous position.

Insert a new sibling after this node.

The new sibling is detached from its previous position.

Insert a new sibling before this node.

The new sibling is detached from its previous position.

Methods from Deref<Target = Node>

Return a reference to this node’s node-type-specific data.

If this node is an element, return a reference to element-specific data.

If this node is a text node, return a reference to its contents.

If this node is a comment, return a reference to its contents.

If this node is a document, return a reference to doctype-specific data.

If this node is a document, return a reference to document-specific data.

Return a reference to the parent node, unless this node is the root of the tree.

Return a reference to the first child of this node, unless it has no child.

Return a reference to the last child of this node, unless it has no child.

Return a reference to the previous sibling of this node, unless it is a first child.

Return a reference to the next sibling of this node, unless it is a last child.

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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Get a list of all comments (<!-- example -->)
Append a node as a child
Prepend a node as a child
Insert a node after the current node, as a sibling
Insert a node before the current node, as a sibling
Select some wiki nodes
Get the first element that matches the selector, if possible
Get a list of all wikilinks ([[Foo|bar]])
Get a list of all external links ([https://example.org/ Example])
Get a list of all categories
Get a list of all iamges
Get a list of templates
Get a list of parser functions.
Return the parent node, if it has one
Return the next sibling node, if it has one
Return the previous sibling node, if it has one
Return an iterator of references to this node and its ancestors.
Return an iterator of references to this node’s ancestors.
Return an iterator of references to this node and the siblings before it.
Return an iterator of references to this node’s siblings before it.
Return an iterator of references to this node and the siblings after it.
Return an iterator of references to this node’s siblings after it.
Return an iterator of references to this node’s children.
Return an iterator of references to this node and its descendants, in tree order. Parent nodes appear before the descendants. Read more
Return an iterator of references to this node’s descendants, in tree order. Parent nodes appear before the descendants. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more