html-to-markdown 3.20.0 → 3.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f43865f82a7e4c6d23c66a65771037f4d8ee80030446ffaa3f540b186a63d495
4
- data.tar.gz: 9153d54e8c57c12d344ad60c428a456f23ad99b986b9c095611ef5209861ca3f
3
+ metadata.gz: 15f402f9dda7241decfc22f13ad4914661924ac16828888e8869be4a330c58e6
4
+ data.tar.gz: a4160304d6e89d800d30c873fa836ba9bbabb99ef7abbbcb14deba9598dce74a
5
5
  SHA512:
6
- metadata.gz: 23eb08b05df928356dd4d205fb51ab09ed795a73ade15c16e81925eb3abe4d251bea9434ba4b47f8d8ddcb1c1be9d6e291c7c3d42bd67f8d2b9639099b712fd9
7
- data.tar.gz: 9a64c7eb777837684aec301285b64494e3fe4dcd76e507f079808586e83acf655953cf321796b11339f6e128dd75873ee905a1dd718867cd273556c34de1c1d2
6
+ metadata.gz: 22e024bb02c9080414e5fef70298f95616659360925644fa2ae4112455bba6ebf4f69e44ae8200185bd94226249ec58d0db4b0637895caff975d4efcc3f1f3cd
7
+ data.tar.gz: e1317218cd188ffa0da59e86110f70a1a262fe6bfbe266297993e7518a68a7b30345117157456e69968165ca2210a06125e27d9752fa324c572ff4a3dfbeafaa
@@ -252,7 +252,7 @@ checksum = "491194d601b4fa9fac3c9571e014070a0ad1bc3392d1bc10419695196a8b3cc3"
252
252
 
253
253
  [[package]]
254
254
  name = "html-to-markdown-rb"
255
- version = "3.20.0"
255
+ version = "3.21.0"
256
256
  dependencies = [
257
257
  "async-trait",
258
258
  "html-to-markdown-rs",
@@ -266,9 +266,9 @@ dependencies = [
266
266
 
267
267
  [[package]]
268
268
  name = "html-to-markdown-rs"
269
- version = "3.20.0"
269
+ version = "3.21.0"
270
270
  source = "registry+https://github.com/rust-lang/crates.io-index"
271
- checksum = "87d942a115ed580f0f224aa32114e82b964dcd05a9cfa71b015829d7fafba1b2"
271
+ checksum = "1508f37b10916e398625bcce1e4d19da5a04786d25de2996e2e4579c0e800a22"
272
272
  dependencies = [
273
273
  "ahash",
274
274
  "astral-html",
@@ -1,11 +1,11 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:2037391b7b71beb6a98065ebcf3cf7a6468bb5565cae33f921c678449cee8a10
2
+ # alef:hash:99bb12a622d006aa5ffe8246e71c811f228cb7525070d61578a5fb1e85c3be45
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify
5
5
 
6
6
  [package]
7
7
  name = "html-to-markdown-rb"
8
- version = "3.20.0"
8
+ version = "3.21.0"
9
9
  edition = "2024"
10
10
  authors = ["Na'aman Hirschfeld <naaman@xberg.io>", "Tobias Perlstein <tobias@xberg.io>"]
11
11
  license = "MIT"
@@ -31,7 +31,7 @@ visitor = ["html-to-markdown-rs/visitor"]
31
31
 
32
32
  [dependencies]
33
33
  async-trait = "0.1"
34
- html-to-markdown-rs = { version = "3.20.0", features = ["serde", "metadata", "visitor", "inline-images", "testkit"] }
34
+ html-to-markdown-rs = { version = "3.21.0", features = ["serde", "metadata", "visitor", "inline-images", "testkit"] }
35
35
  magnus = "0.9"
36
36
  rb-sys = ">=0.9.130, <0.10"
37
37
  serde = { version = "1", features = ["derive"] }
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by alef. DO NOT EDIT.
2
- // alef:hash:12cba80e3c0806295fe73c09cbd3a6127be840c81ee90b163b8a848eda56f40f
2
+ // alef:hash:400e845c128395e5bc9553bc48841d62d847fc1925e8b1343b42e4926ac2fe5e
3
3
  // Re-generate with: alef generate
4
4
  #![allow(dead_code, unused_imports, unused_variables)]
5
5
  #![allow(
@@ -2957,6 +2957,7 @@ pub struct NodeContext {
2957
2957
  index_in_parent: usize,
2958
2958
  parent_tag: Option<String>,
2959
2959
  is_inline: bool,
2960
+ attributes: HashMap<String, String>,
2960
2961
  }
2961
2962
 
2962
2963
  #[cfg(feature = "visitor")]
@@ -3057,6 +3058,15 @@ impl NodeContext {
3057
3058
  })?,
3058
3059
  None => Default::default(),
3059
3060
  },
3061
+ attributes: match kwargs.get(ruby.to_symbol("attributes")) {
3062
+ Some(v) => <HashMap<String, String>>::try_convert(v).map_err(|e| {
3063
+ magnus::Error::new(
3064
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
3065
+ format!("invalid value for `attributes`: {}", e),
3066
+ )
3067
+ })?,
3068
+ None => Default::default(),
3069
+ },
3060
3070
  })
3061
3071
  }
3062
3072
 
@@ -3085,12 +3095,7 @@ impl NodeContext {
3085
3095
  }
3086
3096
 
3087
3097
  fn attributes(&self) -> HashMap<String, String> {
3088
- let core_self = html_to_markdown_rs::NodeContext::from(self.clone());
3089
- core_self
3090
- .attributes()
3091
- .iter()
3092
- .map(|(k, v)| (k.clone(), v.clone()))
3093
- .collect()
3098
+ self.attributes.clone()
3094
3099
  }
3095
3100
 
3096
3101
  #[allow(
@@ -5411,6 +5416,11 @@ fn nodecontext_to_rb_hash(ctx: &html_to_markdown_rs::NodeContext) -> magnus::RHa
5411
5416
  )
5412
5417
  .ok();
5413
5418
  h.aset(ruby.to_symbol("is_inline"), ctx.is_inline).ok();
5419
+ let attributes_hash = ruby.hash_new();
5420
+ for (key, value) in ctx.attributes() {
5421
+ attributes_hash.aset(ruby.str_new(key), ruby.str_new(value)).ok();
5422
+ }
5423
+ h.aset(ruby.to_symbol("attributes"), attributes_hash).ok();
5414
5424
  h
5415
5425
  }
5416
5426
 
@@ -7575,13 +7585,16 @@ impl From<html_to_markdown_rs::MetadataEntry> for MetadataEntry {
7575
7585
  }
7576
7586
 
7577
7587
  #[cfg(feature = "visitor")]
7578
- #[allow(clippy::useless_conversion)]
7588
+ #[allow(clippy::redundant_closure, clippy::useless_conversion)]
7579
7589
  impl From<NodeContext> for html_to_markdown_rs::NodeContext<'_> {
7580
7590
  fn from(val: NodeContext) -> Self {
7581
7591
  html_to_markdown_rs::NodeContext::with_owned_attributes(
7582
7592
  val.node_type.into(),
7583
7593
  val.tag_name.into(),
7584
- std::collections::BTreeMap::new(),
7594
+ val.attributes
7595
+ .iter()
7596
+ .map(|(k, v)| (k.clone(), v.clone()))
7597
+ .collect::<std::collections::BTreeMap<_, _>>(),
7585
7598
  val.depth,
7586
7599
  val.index_in_parent,
7587
7600
  val.parent_tag.map(Into::into),
@@ -7595,6 +7608,12 @@ impl From<NodeContext> for html_to_markdown_rs::NodeContext<'_> {
7595
7608
  impl From<html_to_markdown_rs::NodeContext<'_>> for NodeContext {
7596
7609
  fn from(val: html_to_markdown_rs::NodeContext<'_>) -> Self {
7597
7610
  Self {
7611
+ attributes: val
7612
+ .attributes()
7613
+ .clone()
7614
+ .into_iter()
7615
+ .map(|(k, v)| (k.into(), v.into()))
7616
+ .collect(),
7598
7617
  node_type: val.node_type.into(),
7599
7618
  tag_name: val.tag_name.to_string(),
7600
7619
  depth: val.depth,
@@ -1,10 +1,10 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:a84c4b56eb2a68cb8ebc1ff8b99fb9aa75fb7b5f3d8e8b4a1481e8847e18814f
2
+ # alef:hash:619922d1aadc86f33a41a722ca732e9be4b5b43e722e085969152b4b5dc3c502
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify
5
5
  # frozen_string_literal: true
6
6
 
7
7
  module HtmlToMarkdown
8
8
  ## The version string for this package.
9
- VERSION = "3.20.0"
9
+ VERSION = "3.21.0"
10
10
  end
data/sig/types.rbs CHANGED
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:1d4b142f8a480d7e1db67239954e5333ef61df246e0597c2429f8c8ec6660510
2
+ # alef:hash:3268ce0b667ca8b7ee33bab52a6acdac2751438fa66a49e6165b34ea272253be
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify
5
5
 
@@ -238,9 +238,9 @@ def initialize: (href: String, text: String, ?title: String, link_type: enum_Lin
238
238
  attr_reader index_in_parent: Integer
239
239
  attr_reader parent_tag: String?
240
240
  attr_reader is_inline: bool
241
+ attr_reader attributes: Hash[String, String]
241
242
 
242
- def initialize: (node_type: enum_NodeType, tag_name: String, depth: Integer, index_in_parent: Integer, ?parent_tag: String, is_inline: bool) -> void
243
- def attributes: () -> Hash[String, String]
243
+ def initialize: (node_type: enum_NodeType, tag_name: String, depth: Integer, index_in_parent: Integer, ?parent_tag: String, is_inline: bool, ?attributes: Hash[String, String]) -> void
244
244
  def into_owned: () -> NodeContext
245
245
  end
246
246
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-to-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.20.0
4
+ version: 3.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Na'aman Hirschfeld