commonmarker 2.8.1 → 2.8.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/Cargo.lock +4 -4
- data/README.md +1 -0
- data/ext/commonmarker/src/node.rs +48 -1
- data/lib/commonmarker/node/inspect.rb +1 -0
- data/lib/commonmarker/version.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: 19a56463af3eab1d8eaaf826922ef056e82bac12c681e79d4072c5df48b00799
|
|
4
|
+
data.tar.gz: 5a9fa46b145eb9839f19511e1bbd8c7ad80e36a8d9450302ea717bfbc1acece3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f6defcf19681e9cd13c55a923017dcd9dc6cdf6187309cd67af3e2a6d833de436738ac933ee156e7f61818efaabffdbf6b137696fd3e4b42ea9ca074a1d8d03
|
|
7
|
+
data.tar.gz: 7ece8faae54b250e7883b6ed16752bf8d9140e52508aacf6a755aea21f48e1f659527e2bb7a39b84da9f69620150d43f3b8397d9404015d9ecf7b574ccc8a01b
|
data/Cargo.lock
CHANGED
|
@@ -717,18 +717,18 @@ dependencies = [
|
|
|
717
717
|
|
|
718
718
|
[[package]]
|
|
719
719
|
name = "rb-sys"
|
|
720
|
-
version = "0.9.
|
|
720
|
+
version = "0.9.127"
|
|
721
721
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
722
|
-
checksum = "
|
|
722
|
+
checksum = "d7d7c9560fe42dcffa576941394075f18a17dce89fcf718a2fa90b7dc2134d12"
|
|
723
723
|
dependencies = [
|
|
724
724
|
"rb-sys-build",
|
|
725
725
|
]
|
|
726
726
|
|
|
727
727
|
[[package]]
|
|
728
728
|
name = "rb-sys-build"
|
|
729
|
-
version = "0.9.
|
|
729
|
+
version = "0.9.127"
|
|
730
730
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
731
|
-
checksum = "
|
|
731
|
+
checksum = "f1688e8f32967ba48c89e4dfa283b57f901075f542fc7ee9c3d7c5f9091ca1d9"
|
|
732
732
|
dependencies = [
|
|
733
733
|
"bindgen",
|
|
734
734
|
"lazy_static",
|
data/README.md
CHANGED
|
@@ -522,10 +522,11 @@ impl CommonmarkerNode {
|
|
|
522
522
|
"tip" => AlertType::Tip,
|
|
523
523
|
"important" => AlertType::Important,
|
|
524
524
|
"warning" => AlertType::Warning,
|
|
525
|
+
"caution" => AlertType::Caution,
|
|
525
526
|
_ => {
|
|
526
527
|
return Err(magnus::Error::new(
|
|
527
528
|
ruby.exception_arg_error(),
|
|
528
|
-
"alert type must be `note`, `tip`, `important`, or `
|
|
529
|
+
"alert type must be `note`, `tip`, `important`, `warning`, or `caution`",
|
|
529
530
|
));
|
|
530
531
|
}
|
|
531
532
|
};
|
|
@@ -980,6 +981,50 @@ impl CommonmarkerNode {
|
|
|
980
981
|
}
|
|
981
982
|
}
|
|
982
983
|
|
|
984
|
+
fn get_alert_type(ruby: &Ruby, rb_self: &Self) -> Result<Symbol, magnus::Error> {
|
|
985
|
+
let node = rb_self.inner.borrow();
|
|
986
|
+
|
|
987
|
+
match &node.data.value {
|
|
988
|
+
ComrakNodeValue::Alert(alert) => match alert.alert_type {
|
|
989
|
+
AlertType::Note => Ok(ruby.to_symbol("note")),
|
|
990
|
+
AlertType::Tip => Ok(ruby.to_symbol("tip")),
|
|
991
|
+
AlertType::Important => Ok(ruby.to_symbol("important")),
|
|
992
|
+
AlertType::Warning => Ok(ruby.to_symbol("warning")),
|
|
993
|
+
AlertType::Caution => Ok(ruby.to_symbol("caution")),
|
|
994
|
+
},
|
|
995
|
+
_ => Err(magnus::Error::new(
|
|
996
|
+
ruby.exception_type_error(),
|
|
997
|
+
"node is not an alert node",
|
|
998
|
+
)),
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
fn set_alert_type(
|
|
1003
|
+
ruby: &Ruby,
|
|
1004
|
+
rb_self: &Self,
|
|
1005
|
+
new_type: Symbol,
|
|
1006
|
+
) -> Result<bool, magnus::Error> {
|
|
1007
|
+
let mut node = rb_self.inner.borrow_mut();
|
|
1008
|
+
|
|
1009
|
+
match node.data.value {
|
|
1010
|
+
ComrakNodeValue::Alert(ref mut alert) => {
|
|
1011
|
+
match new_type.to_string().as_str() {
|
|
1012
|
+
"note" => alert.alert_type = AlertType::Note,
|
|
1013
|
+
"tip" => alert.alert_type = AlertType::Tip,
|
|
1014
|
+
"important" => alert.alert_type = AlertType::Important,
|
|
1015
|
+
"warning" => alert.alert_type = AlertType::Warning,
|
|
1016
|
+
"caution" => alert.alert_type = AlertType::Caution,
|
|
1017
|
+
_ => return Ok(false),
|
|
1018
|
+
}
|
|
1019
|
+
Ok(true)
|
|
1020
|
+
}
|
|
1021
|
+
_ => Err(magnus::Error::new(
|
|
1022
|
+
ruby.exception_type_error(),
|
|
1023
|
+
"node is not an alert node",
|
|
1024
|
+
)),
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
983
1028
|
fn to_html(ruby: &Ruby, rb_self: &Self, args: &[Value]) -> Result<String, magnus::Error> {
|
|
984
1029
|
let args = scan_args::scan_args::<(), (), (), (), _, ()>(args)?;
|
|
985
1030
|
|
|
@@ -1258,6 +1303,8 @@ pub fn init(ruby: &Ruby, m_commonmarker: RModule) -> Result<(), magnus::Error> {
|
|
|
1258
1303
|
c_node.define_method("fenced=", method!(CommonmarkerNode::set_fenced, 1))?;
|
|
1259
1304
|
c_node.define_method("fence_info", method!(CommonmarkerNode::get_fence_info, 0))?;
|
|
1260
1305
|
c_node.define_method("fence_info=", method!(CommonmarkerNode::set_fence_info, 1))?;
|
|
1306
|
+
c_node.define_method("alert_type", method!(CommonmarkerNode::get_alert_type, 0))?;
|
|
1307
|
+
c_node.define_method("alert_type=", method!(CommonmarkerNode::set_alert_type, 1))?;
|
|
1261
1308
|
|
|
1262
1309
|
Ok(())
|
|
1263
1310
|
}
|
data/lib/commonmarker/version.rb
CHANGED