markdown_it_ruby 0.1.1 → 0.1.2

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: 17a71dccb5da286b28b69ef8956a4e2d60d331a4af2990401169646ea7acb56a
4
- data.tar.gz: 5f0247e7cfee562d1e74d99d0903c9c2a09b5baad7e25abea5e402218ac32d19
3
+ metadata.gz: ead24545cc65a4327d59fb8699e8065d8697d6e6316a4c2d3392004c232c78fa
4
+ data.tar.gz: b15b8d76743eb3e87d36257889424b44607033c2f3ff23ddcf6b6712801ce8eb
5
5
  SHA512:
6
- metadata.gz: 9b6789d6a6bd6f8ad7179a08d5b238a3ac8fad93a72dd4c88ee0887aca6f72d9644a2af9c09d1e0a5a1f159cc54ca19e7dffcd5a5f5137588aca2ea3da30b4f2
7
- data.tar.gz: ed1b30a33d5575b3f22d0b1d6f9380f0211e1ccae8469d6ff46ec83d5fc628ef05be32f41abc5a0633689001b6f2aa6e03e77785f074551d4e7aec434a81cf46
6
+ metadata.gz: 87745c761da200d4f21f52e7cac7ac8f858e820d44b00cd18babf8c4c907756d3751623fe9ee3f54def7673179e47bfc0ce27dd830a7c29076939dd44877bf91
7
+ data.tar.gz: eacc45b5801ce725a85494cea7ecb570616e9b5fe4ba0f1a563cdb6b4a724d3a8116df8fe85b67a450363d164bb10806b295b657cfd9553861969864ca27aa22
data/.rubocop.yml CHANGED
@@ -11,7 +11,7 @@ require:
11
11
  - rubocop-rspec
12
12
 
13
13
  AllCops:
14
- TargetRubyVersion: 3.2
14
+ TargetRubyVersion: 3.1
15
15
  NewCops: enable
16
16
  Exclude:
17
17
  - "bin/*"
data/Cargo.lock CHANGED
@@ -561,7 +561,7 @@ dependencies = [
561
561
 
562
562
  [[package]]
563
563
  name = "markdown_it_ruby"
564
- version = "0.1.1"
564
+ version = "0.1.2"
565
565
  dependencies = [
566
566
  "magnus",
567
567
  "markdown-it",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "markdown_it_ruby"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  edition = "2021"
5
5
  authors = ["Koji Onishi <fursich0@gmail.com>"]
6
6
  license = "MIT"
@@ -1,26 +1,9 @@
1
1
  use crate::driver::MarkdonwItOptions;
2
2
  use markdown_it::parser::core::CoreRule;
3
3
  use markdown_it::plugins::extra::tables::Table;
4
- use markdown_it::{MarkdownIt, Node, NodeValue, Renderer};
4
+ use markdown_it::{MarkdownIt, Node};
5
5
 
6
6
  #[derive(Debug)]
7
- pub struct TableDecoration {
8
- pub table: Table,
9
- pub class_name: String,
10
- }
11
-
12
- impl NodeValue for TableDecoration {
13
- fn render(&self, node: &Node, fmt: &mut dyn Renderer) {
14
- let class_name = self.class_name.clone();
15
- let div_attrs = vec![("class", class_name)];
16
- fmt.open("div", &div_attrs);
17
- fmt.cr();
18
- self.table.render(node, fmt);
19
- fmt.cr();
20
- fmt.close("div");
21
- }
22
- }
23
-
24
7
  struct TableDecorationRule;
25
8
 
26
9
  impl CoreRule for TableDecorationRule {
@@ -33,12 +16,10 @@ impl CoreRule for TableDecorationRule {
33
16
  };
34
17
  root.walk_mut(|node, _| {
35
18
  if let Some(table) = node.cast::<Table>() {
36
- node.replace(TableDecoration {
37
- table: Table {
38
- alignments: table.alignments.clone(),
39
- },
40
- class_name: table_class_name.clone(),
41
- })
19
+ node.replace(Table {
20
+ alignments: table.alignments.clone(),
21
+ });
22
+ node.attrs = vec![("class", table_class_name.clone())];
42
23
  }
43
24
  });
44
25
  }
@@ -65,7 +46,7 @@ fn test_table_decoration() {
65
46
 
66
47
  assert_eq!(
67
48
  html,
68
- "<div class=\"table\">\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">左寄せタイトル</th>\n<th style=\"text-align:center\">センタリング</th>\n<th style=\"text-align:right\">右寄せタイトル</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\">column</td>\n<td style=\"text-align:center\">column</td>\n<td style=\"text-align:right\">column</td>\n</tr>\n</tbody>\n</table>\n</div>"
49
+ "<table class=\"table\">\n<thead>\n<tr>\n<th style=\"text-align:left\">左寄せタイトル</th>\n<th style=\"text-align:center\">センタリング</th>\n<th style=\"text-align:right\">右寄せタイトル</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\">column</td>\n<td style=\"text-align:center\">column</td>\n<td style=\"text-align:right\">column</td>\n</tr>\n</tbody>\n</table>\n"
69
50
  )
70
51
  }
71
52
 
@@ -82,7 +63,7 @@ fn test_table_decoration() {
82
63
 
83
64
  assert_eq!(
84
65
  html,
85
- "<div class=\"custom-table-class-name\">\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">左寄せタイトル</th>\n<th style=\"text-align:center\">センタリング</th>\n<th style=\"text-align:right\">右寄せタイトル</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\">column</td>\n<td style=\"text-align:center\">column</td>\n<td style=\"text-align:right\">column</td>\n</tr>\n</tbody>\n</table>\n</div>"
66
+ "<table class=\"custom-table-class-name\">\n<thead>\n<tr>\n<th style=\"text-align:left\">左寄せタイトル</th>\n<th style=\"text-align:center\">センタリング</th>\n<th style=\"text-align:right\">右寄せタイトル</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\">column</td>\n<td style=\"text-align:center\">column</td>\n<td style=\"text-align:right\">column</td>\n</tr>\n</tbody>\n</table>\n"
86
67
  )
87
68
  }
88
69
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MarkdownIt
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -10,6 +10,6 @@ module MarkdownIt
10
10
  options.transform_keys!(&:to_s)
11
11
  options.transform_values!(&:to_s)
12
12
 
13
- __convert(input, **options)
13
+ __convert(input, options)
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_it_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koji Onishi