Skip to content

Commit

Permalink
Merge pull request #32 from rodneylab/build__update_dependencies
Browse files Browse the repository at this point in the history
build  update dependencies
  • Loading branch information
rodneylab authored Aug 9, 2024
2 parents fd56999 + 45017e3 commit 1006598
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 38 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ opt-level = "z"
aho-corasick = "1.1.2"
deunicode = "1.6.0"
getrandom = { version = "0.2.15", features = ["js"] }
html5ever = "0.27.0"
html5ever = "0.28.0"
js-sys = "0.3.69"
mrml = { version = "4.0.1", features = ["parse", "render"], default-features = false }
nom = { version = "7.1.3", features = ["alloc"] }
pulldown-cmark = "0.9.2"
serde = { version = "1.0", features = ["derive"] }
serde = { version = "1.0.205", features = ["derive"] }
serde-wasm-bindgen = "0.6.5"
textwrap = "0.16.1"
thiserror = "1.0.63"
Expand Down
5 changes: 2 additions & 3 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"test": "deno test -A",
"wasmbuild": "deno run -A jsr:@deno/[email protected] --project=parsedown"
},
"imports": {
"@std/assert": "jsr:@std/assert@^1.0.0"
}
"exclude": ["lib/"],
"imports": { "@std/assert": "jsr:@std/assert@^1.0.2" }
}
45 changes: 20 additions & 25 deletions src/html_process/dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ fn remove_from_parent(target: &Handle) {
#[allow(clippy::module_name_repetitions)]
pub struct RcDom {
pub document: Handle,
pub errors: Vec<Cow<'static, str>>,
pub quirks_mode: QuirksMode,
pub errors: RefCell<Vec<Cow<'static, str>>>,
pub quirks_mode: Cell<QuirksMode>,
}

impl TreeSink for RcDom {
Expand All @@ -160,15 +160,15 @@ impl TreeSink for RcDom {
}
type Handle = Handle;

fn parse_error(&mut self, msg: Cow<'static, str>) {
self.errors.push(msg);
fn parse_error(&self, msg: Cow<'static, str>) {
self.errors.borrow_mut().push(msg);
}

fn get_document(&mut self) -> Handle {
fn get_document(&self) -> Handle {
self.document.clone()
}

fn get_template_contents(&mut self, target: &Handle) -> Handle {
fn get_template_contents(&self, target: &Handle) -> Handle {
if let NodeData::Element {
ref template_contents,
..
Expand All @@ -184,8 +184,8 @@ impl TreeSink for RcDom {
}
}

fn set_quirks_mode(&mut self, mode: QuirksMode) {
self.quirks_mode = mode;
fn set_quirks_mode(&self, mode: QuirksMode) {
self.quirks_mode.set(mode);
}

fn same_node(&self, x: &Handle, y: &Handle) -> bool {
Expand All @@ -199,12 +199,7 @@ impl TreeSink for RcDom {
};
}

fn create_element(
&mut self,
name: QualName,
attrs: Vec<Attribute>,
flags: ElementFlags,
) -> Handle {
fn create_element(&self, name: QualName, attrs: Vec<Attribute>, flags: ElementFlags) -> Handle {
Node::new(NodeData::Element {
name,
attrs: RefCell::new(attrs),
Expand All @@ -217,18 +212,18 @@ impl TreeSink for RcDom {
})
}

fn create_comment(&mut self, text: StrTendril) -> Handle {
fn create_comment(&self, text: StrTendril) -> Handle {
Node::new(NodeData::Comment { contents: text })
}

fn create_pi(&mut self, target: StrTendril, data: StrTendril) -> Handle {
fn create_pi(&self, target: StrTendril, data: StrTendril) -> Handle {
Node::new(NodeData::ProcessingInstruction {
target,
contents: data,
})
}

fn append(&mut self, parent: &Handle, child: NodeOrText<Handle>) {
fn append(&self, parent: &Handle, child: NodeOrText<Handle>) {
if let NodeOrText::AppendText(ref text) = child {
if let Some(h) = parent.children.borrow().last() {
if append_to_existing_text(h, text) {
Expand All @@ -248,7 +243,7 @@ impl TreeSink for RcDom {
);
}

fn append_before_sibling(&mut self, sibling: &Handle, child: NodeOrText<Handle>) {
fn append_before_sibling(&self, sibling: &Handle, child: NodeOrText<Handle>) {
let (parent, i) = get_parent_and_index(sibling)
.expect("append_before_sibling called on node without parent");

Expand Down Expand Up @@ -276,7 +271,7 @@ impl TreeSink for RcDom {
}

fn append_based_on_parent_node(
&mut self,
&self,
element: &Self::Handle,
prev_element: &Self::Handle,
child: NodeOrText<Self::Handle>,
Expand All @@ -293,7 +288,7 @@ impl TreeSink for RcDom {
}

fn append_doctype_to_document(
&mut self,
&self,
name: StrTendril,
public_id: StrTendril,
system_id: StrTendril,
Expand All @@ -308,7 +303,7 @@ impl TreeSink for RcDom {
);
}

fn add_attrs_if_missing(&mut self, target: &Handle, attrs: Vec<Attribute>) {
fn add_attrs_if_missing(&self, target: &Handle, attrs: Vec<Attribute>) {
let mut existing = if let NodeData::Element { ref attrs, .. } = target.data {
attrs.borrow_mut()
} else {
Expand All @@ -326,11 +321,11 @@ impl TreeSink for RcDom {
);
}

fn remove_from_parent(&mut self, target: &Handle) {
fn remove_from_parent(&self, target: &Handle) {
remove_from_parent(target);
}

fn reparent_children(&mut self, node: &Handle, new_parent: &Handle) {
fn reparent_children(&self, node: &Handle, new_parent: &Handle) {
let mut children = node.children.borrow_mut();
let mut new_children = new_parent.children.borrow_mut();
for child in children.iter() {
Expand Down Expand Up @@ -360,8 +355,8 @@ impl Default for RcDom {
fn default() -> RcDom {
RcDom {
document: Node::new(NodeData::Document),
errors: vec![],
quirks_mode: tree_builder::NoQuirks,
errors: RefCell::default(),
quirks_mode: Cell::new(tree_builder::NoQuirks),
}
}
}
Expand Down

0 comments on commit 1006598

Please sign in to comment.