Skip to content

Commit de003dd

Browse files
committed
missing commit
1 parent 90261f9 commit de003dd

File tree

1 file changed

+44
-11
lines changed

1 file changed

+44
-11
lines changed

crates/quarto_markdown_pandoc/src/pandoc/treesitter.rs

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ fn native_visitor<T: Write>(
475475
"Raw specifiers are unsupported in images: {}. Will ignore.",
476476
node_text()
477477
);
478-
},
478+
}
479479
PandocNativeIntermediate::IntermediateAttr(a) => attr = a,
480480
PandocNativeIntermediate::IntermediateBaseText(text, _) => {
481481
if node == "link_destination" {
@@ -524,7 +524,7 @@ fn native_visitor<T: Write>(
524524
"Raw attribute specifiers are unsupported in links and spans: {}. Ignoring.",
525525
node_text()
526526
);
527-
},
527+
}
528528
PandocNativeIntermediate::IntermediateAttr(a) => attr = a,
529529
PandocNativeIntermediate::IntermediateBaseText(text, _) => {
530530
if node == "link_destination" {
@@ -1022,14 +1022,18 @@ fn native_visitor<T: Write>(
10221022
if node_name == "language_attribute" {
10231023
language_attribute = Some(text);
10241024
// IntermediateUnknown here "consumes" the node
1025-
(node_name, PandocNativeIntermediate::IntermediateUnknown(range))
1025+
(
1026+
node_name,
1027+
PandocNativeIntermediate::IntermediateUnknown(range),
1028+
)
10261029
} else {
1027-
(node_name, PandocNativeIntermediate::IntermediateBaseText(text, range))
1030+
(
1031+
node_name,
1032+
PandocNativeIntermediate::IntermediateBaseText(text, range),
1033+
)
10281034
}
10291035
}
1030-
_ => {
1031-
(node_name, child)
1032-
},
1036+
_ => (node_name, child),
10331037
}
10341038
})
10351039
.filter(|(_, child)| {
@@ -1078,11 +1082,15 @@ fn native_visitor<T: Write>(
10781082
} else {
10791083
match language_attribute {
10801084
Some(lang) => {
1081-
PandocNativeIntermediate::IntermediateInline(Inline::Code(Code { attr, text: lang + &" " + &text }))
1082-
}
1083-
None => {
1084-
PandocNativeIntermediate::IntermediateInline(Inline::Code(Code { attr, text }))
1085+
PandocNativeIntermediate::IntermediateInline(Inline::Code(Code {
1086+
attr,
1087+
text: lang + &" " + &text,
1088+
}))
10851089
}
1090+
None => PandocNativeIntermediate::IntermediateInline(Inline::Code(Code {
1091+
attr,
1092+
text,
1093+
})),
10861094
}
10871095
}
10881096
})(),
@@ -1404,6 +1412,31 @@ fn native_visitor<T: Write>(
14041412
continue;
14051413
}
14061414
match child {
1415+
PandocNativeIntermediate::IntermediateBaseText(_, _) => {
1416+
if node == "language_attribute" {
1417+
writeln!(
1418+
buf,
1419+
"Warning: language attribute unsupported in divs: {:?} {:?}",
1420+
node, child
1421+
)
1422+
.unwrap();
1423+
} else {
1424+
writeln!(
1425+
buf,
1426+
"Warning: Unexpected base text in div, ignoring: {:?} {:?}",
1427+
node, child
1428+
)
1429+
.unwrap();
1430+
}
1431+
}
1432+
PandocNativeIntermediate::IntermediateRawFormat(_, _) => {
1433+
writeln!(
1434+
buf,
1435+
"Warning: Raw attribute specifiers are not supported in divs: {:?} {:?}",
1436+
node, child
1437+
)
1438+
.unwrap();
1439+
}
14071440
PandocNativeIntermediate::IntermediateAttr(a) => {
14081441
attr = a;
14091442
}

0 commit comments

Comments
 (0)