Skip to content

Commit

Permalink
Renamed BlockQuote to Blockquote
Browse files Browse the repository at this point in the history
  • Loading branch information
h7kanna committed Sep 16, 2024
1 parent bf4d60d commit 323607c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
9 changes: 3 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,15 @@ The following bash scripts are useful when working on this project:
```
* format:
```sh
cargo fmt && cargo fix --all-targets
cargo fmt && cargo fix --all-targets --all-features
```
* lint:
```sh
cargo fmt --check && cargo clippy --examples --tests --benches --all-features
cargo fmt --check && cargo clippy --examples --tests --benches --all-features --all-features
```
* test:
```sh
RUST_BACKTRACE=1 cargo test
```
```sh
RUST_BACKTRACE=1 cargo test --features json
RUST_BACKTRACE=1 cargo test --all-features
```
* docs:
```sh
Expand Down
24 changes: 12 additions & 12 deletions src/mdast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub enum Node {

// Container:
/// Block quote.
BlockQuote(BlockQuote),
Blockquote(Blockquote),
/// Footnote definition.
FootnoteDefinition(FootnoteDefinition),
/// MDX: JSX element (container).
Expand Down Expand Up @@ -183,7 +183,7 @@ impl fmt::Debug for Node {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Node::Root(x) => x.fmt(f),
Node::BlockQuote(x) => x.fmt(f),
Node::Blockquote(x) => x.fmt(f),
Node::FootnoteDefinition(x) => x.fmt(f),
Node::MdxJsxFlowElement(x) => x.fmt(f),
Node::List(x) => x.fmt(f),
Expand Down Expand Up @@ -231,7 +231,7 @@ impl ToString for Node {
match self {
// Parents.
Node::Root(x) => children_to_string(&x.children),
Node::BlockQuote(x) => children_to_string(&x.children),
Node::Blockquote(x) => children_to_string(&x.children),
Node::FootnoteDefinition(x) => children_to_string(&x.children),
Node::MdxJsxFlowElement(x) => children_to_string(&x.children),
Node::List(x) => children_to_string(&x.children),
Expand Down Expand Up @@ -280,7 +280,7 @@ impl Node {
Node::Root(x) => Some(&x.children),
Node::Paragraph(x) => Some(&x.children),
Node::Heading(x) => Some(&x.children),
Node::BlockQuote(x) => Some(&x.children),
Node::Blockquote(x) => Some(&x.children),
Node::List(x) => Some(&x.children),
Node::ListItem(x) => Some(&x.children),
Node::Emphasis(x) => Some(&x.children),
Expand All @@ -305,7 +305,7 @@ impl Node {
Node::Root(x) => Some(&mut x.children),
Node::Paragraph(x) => Some(&mut x.children),
Node::Heading(x) => Some(&mut x.children),
Node::BlockQuote(x) => Some(&mut x.children),
Node::Blockquote(x) => Some(&mut x.children),
Node::List(x) => Some(&mut x.children),
Node::ListItem(x) => Some(&mut x.children),
Node::Emphasis(x) => Some(&mut x.children),
Expand All @@ -328,7 +328,7 @@ impl Node {
pub fn position(&self) -> Option<&Position> {
match self {
Node::Root(x) => x.position.as_ref(),
Node::BlockQuote(x) => x.position.as_ref(),
Node::Blockquote(x) => x.position.as_ref(),
Node::FootnoteDefinition(x) => x.position.as_ref(),
Node::MdxJsxFlowElement(x) => x.position.as_ref(),
Node::List(x) => x.position.as_ref(),
Expand Down Expand Up @@ -367,7 +367,7 @@ impl Node {
pub fn position_mut(&mut self) -> Option<&mut Position> {
match self {
Node::Root(x) => x.position.as_mut(),
Node::BlockQuote(x) => x.position.as_mut(),
Node::Blockquote(x) => x.position.as_mut(),
Node::FootnoteDefinition(x) => x.position.as_mut(),
Node::MdxJsxFlowElement(x) => x.position.as_mut(),
Node::List(x) => x.position.as_mut(),
Expand Down Expand Up @@ -406,7 +406,7 @@ impl Node {
pub fn position_set(&mut self, position: Option<Position>) {
match self {
Node::Root(x) => x.position = position,
Node::BlockQuote(x) => x.position = position,
Node::Blockquote(x) => x.position = position,
Node::FootnoteDefinition(x) => x.position = position,
Node::MdxJsxFlowElement(x) => x.position = position,
Node::List(x) => x.position = position,
Expand Down Expand Up @@ -575,7 +575,7 @@ pub struct ThematicBreak {
/// ```
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BlockQuote {
pub struct Blockquote {
// Parent.
/// Content model.
pub children: Vec<Node>,
Expand Down Expand Up @@ -1712,14 +1712,14 @@ mod tests {

#[test]
fn block_quote() {
let mut node = Node::BlockQuote(BlockQuote {
let mut node = Node::Blockquote(Blockquote {
position: None,
children: vec![],
});

assert_eq!(
format!("{:?}", node),
"BlockQuote { children: [], position: None }",
"Blockquote { children: [], position: None }",
"should support `Debug`"
);
assert_eq!(node.to_string(), "", "should support `ToString`");
Expand All @@ -1734,7 +1734,7 @@ mod tests {
node.position_set(Some(Position::new(1, 1, 0, 1, 2, 1)));
assert_eq!(
format!("{:?}", node),
"BlockQuote { children: [], position: Some(1:1-1:2 (0-1)) }",
"Blockquote { children: [], position: Some(1:1-1:2 (0-1)) }",
"should support `position_set`"
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/to_mdast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use crate::event::{Event, Kind, Name};
use crate::mdast::{
AttributeContent, AttributeValue, AttributeValueExpression, BlockQuote, Break, Code,
AttributeContent, AttributeValue, AttributeValueExpression, Blockquote, Break, Code,
Definition, Delete, Emphasis, FootnoteDefinition, FootnoteReference, Heading, Html, Image,
ImageReference, InlineCode, InlineMath, Link, LinkReference, List, ListItem, Math,
MdxFlowExpression, MdxJsxAttribute, MdxJsxFlowElement, MdxJsxTextElement, MdxTextExpression,
Expand Down Expand Up @@ -470,7 +470,7 @@ fn on_enter_autolink(context: &mut CompileContext) {

/// Handle [`Enter`][Kind::Enter]:[`BlockQuote`][Name::BlockQuote].
fn on_enter_block_quote(context: &mut CompileContext) {
context.tail_push(Node::BlockQuote(BlockQuote {
context.tail_push(Node::Blockquote(Blockquote {
children: vec![],
position: None,
}));
Expand Down
4 changes: 2 additions & 2 deletions tests/block_quote.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use markdown::{
mdast::{BlockQuote, Node, Paragraph, Root, Text},
mdast::{Blockquote, Node, Paragraph, Root, Text},
message, to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
Expand Down Expand Up @@ -221,7 +221,7 @@ fn block_quote() -> Result<(), message::Message> {
assert_eq!(
to_mdast("> a", &Default::default())?,
Node::Root(Root {
children: vec![Node::BlockQuote(BlockQuote {
children: vec![Node::Blockquote(Blockquote {
children: vec![Node::Paragraph(Paragraph {
children: vec![Node::Text(Text {
value: "a".into(),
Expand Down

0 comments on commit 323607c

Please sign in to comment.