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 +4 -4
- data/.rubocop.yml +1 -1
- data/Cargo.lock +1 -1
- data/ext/markdown_it_ruby/Cargo.toml +1 -1
- data/ext/markdown_it_ruby/src/extensions/table_decoration.rs +7 -26
- data/lib/markdown_it_ruby/version.rb +1 -1
- data/lib/markdown_it_ruby.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead24545cc65a4327d59fb8699e8065d8697d6e6316a4c2d3392004c232c78fa
|
4
|
+
data.tar.gz: b15b8d76743eb3e87d36257889424b44607033c2f3ff23ddcf6b6712801ce8eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87745c761da200d4f21f52e7cac7ac8f858e820d44b00cd18babf8c4c907756d3751623fe9ee3f54def7673179e47bfc0ce27dd830a7c29076939dd44877bf91
|
7
|
+
data.tar.gz: eacc45b5801ce725a85494cea7ecb570616e9b5fe4ba0f1a563cdb6b4a724d3a8116df8fe85b67a450363d164bb10806b295b657cfd9553861969864ca27aa22
|
data/.rubocop.yml
CHANGED
data/Cargo.lock
CHANGED
@@ -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
|
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(
|
37
|
-
|
38
|
-
|
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
|
-
"<
|
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
|
-
"<
|
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
|
}
|
data/lib/markdown_it_ruby.rb
CHANGED