mirror of
https://github.com/TxtDot/dalet-rs.git
synced 2024-11-22 00:36:21 +03:00
fix: rename tcol, tpcol to trow, tprow
This commit is contained in:
parent
d2fc37fed3
commit
0fd582b6f5
11 changed files with 25 additions and 25 deletions
|
@ -63,12 +63,12 @@ fn main() {
|
||||||
]
|
]
|
||||||
.into()),
|
.into()),
|
||||||
Table(vec![
|
Table(vec![
|
||||||
Tpcol(vec![
|
Tprow(vec![
|
||||||
El("Col 1".into()),
|
El("Col 1".into()),
|
||||||
El("Col 2".into()),
|
El("Col 2".into()),
|
||||||
El("Col 3".into()),
|
El("Col 3".into()),
|
||||||
]),
|
]),
|
||||||
Tcol(vec![
|
Trow(vec![
|
||||||
El("Never gonna".into()),
|
El("Never gonna".into()),
|
||||||
El("give you".into()),
|
El("give you".into()),
|
||||||
El("up".into()),
|
El("up".into()),
|
||||||
|
|
|
@ -121,7 +121,7 @@ row [
|
||||||
# +| cells | - primary column
|
# +| cells | - primary column
|
||||||
# | cells | - secondary column
|
# | cells | - secondary column
|
||||||
# | Element | Description | - converts to
|
# | Element | Description | - converts to
|
||||||
# tcol [
|
# trow [
|
||||||
# Element
|
# Element
|
||||||
# Description
|
# Description
|
||||||
# ]
|
# ]
|
||||||
|
|
|
@ -16,12 +16,12 @@ pub fn table_to_tag(rows: &Vec<TableCol>) -> Tag {
|
||||||
Tag::Table(
|
Tag::Table(
|
||||||
rows.into_iter()
|
rows.into_iter()
|
||||||
.map(|row| match row {
|
.map(|row| match row {
|
||||||
TableCol::Primary(row) => Tag::Tpcol(
|
TableCol::Primary(row) => Tag::Tprow(
|
||||||
row.into_iter()
|
row.into_iter()
|
||||||
.map(|t| Tag::El(NNBody::Text(format!("{t}"))))
|
.map(|t| Tag::El(NNBody::Text(format!("{t}"))))
|
||||||
.collect(),
|
.collect(),
|
||||||
),
|
),
|
||||||
TableCol::Secondary(row) => Tag::Tcol(
|
TableCol::Secondary(row) => Tag::Trow(
|
||||||
row.into_iter()
|
row.into_iter()
|
||||||
.map(|t| Tag::El(NNBody::Text(format!("{t}"))))
|
.map(|t| Tag::El(NNBody::Text(format!("{t}"))))
|
||||||
.collect(),
|
.collect(),
|
||||||
|
|
|
@ -119,8 +119,8 @@ pub fn format<'src>(spanned_tokens: &Vec<Spanned<Token<'src>>>) -> String {
|
||||||
Token::Navbtn => prepend_indent("navbtn", current_indent),
|
Token::Navbtn => prepend_indent("navbtn", current_indent),
|
||||||
Token::Img => prepend_indent("img", current_indent),
|
Token::Img => prepend_indent("img", current_indent),
|
||||||
Token::Table => prepend_indent("table", current_indent),
|
Token::Table => prepend_indent("table", current_indent),
|
||||||
Token::Tcol => prepend_indent("tcol", current_indent),
|
Token::Trow => prepend_indent("trow", current_indent),
|
||||||
Token::Tpcol => prepend_indent("tpcol", current_indent),
|
Token::Tprow => prepend_indent("tprow", current_indent),
|
||||||
Token::Hr => prepend_indent("hr", current_indent),
|
Token::Hr => prepend_indent("hr", current_indent),
|
||||||
Token::B => prepend_indent("b", current_indent),
|
Token::B => prepend_indent("b", current_indent),
|
||||||
Token::I => prepend_indent("i", current_indent),
|
Token::I => prepend_indent("i", current_indent),
|
||||||
|
|
|
@ -53,8 +53,8 @@ fn tag<'src>() -> impl Parser<'src, &'src str, Token<'src>, extra::Err<Rich<'src
|
||||||
just("navbtn").to(Token::Navbtn),
|
just("navbtn").to(Token::Navbtn),
|
||||||
just("img").to(Token::Img),
|
just("img").to(Token::Img),
|
||||||
just("table").to(Token::Table),
|
just("table").to(Token::Table),
|
||||||
just("tcol").to(Token::Tcol),
|
just("trow").to(Token::Trow),
|
||||||
just("tpcol").to(Token::Tpcol),
|
just("tprow").to(Token::Tprow),
|
||||||
just("hr").to(Token::Hr),
|
just("hr").to(Token::Hr),
|
||||||
just("b").to(Token::B),
|
just("b").to(Token::B),
|
||||||
just("i").to(Token::I),
|
just("i").to(Token::I),
|
||||||
|
|
|
@ -50,8 +50,8 @@ pub enum Token<'src> {
|
||||||
Navbtn,
|
Navbtn,
|
||||||
Img,
|
Img,
|
||||||
Table,
|
Table,
|
||||||
Tcol,
|
Trow,
|
||||||
Tpcol,
|
Tprow,
|
||||||
Hr,
|
Hr,
|
||||||
B,
|
B,
|
||||||
I,
|
I,
|
||||||
|
@ -100,8 +100,8 @@ impl<'src> fmt::Display for Token<'src> {
|
||||||
Token::Navbtn => write!(f, "navbtn"),
|
Token::Navbtn => write!(f, "navbtn"),
|
||||||
Token::Img => write!(f, "img"),
|
Token::Img => write!(f, "img"),
|
||||||
Token::Table => write!(f, "table"),
|
Token::Table => write!(f, "table"),
|
||||||
Token::Tcol => write!(f, "tcol"),
|
Token::Trow => write!(f, "trow"),
|
||||||
Token::Tpcol => write!(f, "tpcol"),
|
Token::Tprow => write!(f, "tprow"),
|
||||||
Token::Hr => write!(f, "hr"),
|
Token::Hr => write!(f, "hr"),
|
||||||
Token::B => write!(f, "b"),
|
Token::B => write!(f, "b"),
|
||||||
Token::I => write!(f, "i"),
|
Token::I => write!(f, "i"),
|
||||||
|
|
|
@ -131,8 +131,8 @@ pub fn tag<'tokens, 'src: 'tokens>(
|
||||||
.map(|(arg, body)| Navbtn(body, arg));
|
.map(|(arg, body)| Navbtn(body, arg));
|
||||||
let img = just(Token::Img).ignore_then(text_arg.clone()).map(Img);
|
let img = just(Token::Img).ignore_then(text_arg.clone()).map(Img);
|
||||||
let table = just(Token::Table).ignore_then(tags_body.clone()).map(Table);
|
let table = just(Token::Table).ignore_then(tags_body.clone()).map(Table);
|
||||||
let tcol = just(Token::Tcol).ignore_then(tags_body.clone()).map(Tcol);
|
let trow = just(Token::Trow).ignore_then(tags_body.clone()).map(Trow);
|
||||||
let tpcol = just(Token::Tpcol).ignore_then(tags_body.clone()).map(Tpcol);
|
let tprow = just(Token::Tprow).ignore_then(tags_body.clone()).map(Tprow);
|
||||||
let hr = just(Token::Hr).to(Hr);
|
let hr = just(Token::Hr).to(Hr);
|
||||||
let b = just(Token::B).ignore_then(text_body.clone()).map(B);
|
let b = just(Token::B).ignore_then(text_body.clone()).map(B);
|
||||||
let i = just(Token::I).ignore_then(text_body.clone()).map(I);
|
let i = just(Token::I).ignore_then(text_body.clone()).map(I);
|
||||||
|
@ -184,7 +184,7 @@ pub fn tag<'tokens, 'src: 'tokens>(
|
||||||
};
|
};
|
||||||
|
|
||||||
choice((
|
choice((
|
||||||
el, h, p, br, ul, ol, row, link, navlink, btn, navbtn, img, table, tcol, tpcol, hr, b,
|
el, h, p, br, ul, ol, row, link, navlink, btn, navbtn, img, table, trow, tprow, hr, b,
|
||||||
i, bq, footlnk, footn, a, s, sup, sub, disc,
|
i, bq, footlnk, footn, a, s, sup, sub, disc,
|
||||||
))
|
))
|
||||||
.or(choice((block, carousel, code, pre, meta)))
|
.or(choice((block, carousel, code, pre, meta)))
|
||||||
|
|
|
@ -60,8 +60,8 @@ pub enum DlTid {
|
||||||
Navbtn,
|
Navbtn,
|
||||||
Img,
|
Img,
|
||||||
Table,
|
Table,
|
||||||
Tcol,
|
Trow,
|
||||||
Tpcol,
|
Tprow,
|
||||||
Hr,
|
Hr,
|
||||||
B,
|
B,
|
||||||
I,
|
I,
|
||||||
|
|
|
@ -24,8 +24,8 @@ impl TryFrom<DlTag> for Tag {
|
||||||
DlTid::Navbtn => Navbtn(tag.body.try_into()?, tag.argument.try_into()?),
|
DlTid::Navbtn => Navbtn(tag.body.try_into()?, tag.argument.try_into()?),
|
||||||
DlTid::Img => Img(tag.argument.try_into()?),
|
DlTid::Img => Img(tag.argument.try_into()?),
|
||||||
DlTid::Table => Table(tag.body.try_into()?),
|
DlTid::Table => Table(tag.body.try_into()?),
|
||||||
DlTid::Tcol => Tcol(tag.body.try_into()?),
|
DlTid::Trow => Trow(tag.body.try_into()?),
|
||||||
DlTid::Tpcol => Tpcol(tag.body.try_into()?),
|
DlTid::Tprow => Tprow(tag.body.try_into()?),
|
||||||
DlTid::Hr => Hr,
|
DlTid::Hr => Hr,
|
||||||
DlTid::B => B(tag.body.try_into()?),
|
DlTid::B => B(tag.body.try_into()?),
|
||||||
DlTid::I => I(tag.body.try_into()?),
|
DlTid::I => I(tag.body.try_into()?),
|
||||||
|
|
|
@ -19,8 +19,8 @@ impl From<Tag> for DlTag {
|
||||||
Tag::Navbtn(b, a) => dlt_new(DlTid::Navbtn, b.into(), a.into()),
|
Tag::Navbtn(b, a) => dlt_new(DlTid::Navbtn, b.into(), a.into()),
|
||||||
Tag::Img(a) => dlt_new(DlTid::Img, NB, a.into()),
|
Tag::Img(a) => dlt_new(DlTid::Img, NB, a.into()),
|
||||||
Tag::Table(b) => dlt_new(DlTid::Table, b.into(), NA),
|
Tag::Table(b) => dlt_new(DlTid::Table, b.into(), NA),
|
||||||
Tag::Tcol(b) => dlt_new(DlTid::Tcol, b.into(), NA),
|
Tag::Trow(b) => dlt_new(DlTid::Trow, b.into(), NA),
|
||||||
Tag::Tpcol(b) => dlt_new(DlTid::Tpcol, b.into(), NA),
|
Tag::Tprow(b) => dlt_new(DlTid::Tprow, b.into(), NA),
|
||||||
Tag::Hr => dlt_new(DlTid::Hr, NB, NA),
|
Tag::Hr => dlt_new(DlTid::Hr, NB, NA),
|
||||||
Tag::B(b) => dlt_new(DlTid::B, b.into(), NA),
|
Tag::B(b) => dlt_new(DlTid::B, b.into(), NA),
|
||||||
Tag::I(b) => dlt_new(DlTid::I, b.into(), NA),
|
Tag::I(b) => dlt_new(DlTid::I, b.into(), NA),
|
||||||
|
|
|
@ -29,8 +29,8 @@ pub enum Tag {
|
||||||
Navbtn(Body, TArg),
|
Navbtn(Body, TArg),
|
||||||
Img(TArg),
|
Img(TArg),
|
||||||
Table(Vec<Tag>),
|
Table(Vec<Tag>),
|
||||||
Tcol(Vec<Tag>),
|
Trow(Vec<Tag>),
|
||||||
Tpcol(Vec<Tag>),
|
Tprow(Vec<Tag>),
|
||||||
Hr,
|
Hr,
|
||||||
B(TBody),
|
B(TBody),
|
||||||
I(TBody),
|
I(TBody),
|
||||||
|
|
Loading…
Add table
Reference in a new issue