Rename TextOneLine to OneLineText.

This commit is contained in:
jcamiel 2022-11-24 15:10:13 +01:00
parent a0f7d3e278
commit 2242c8ba0d
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
7 changed files with 13 additions and 13 deletions

View File

@ -26,7 +26,7 @@ pub fn eval_multiline(
variables: &HashMap<String, Value>, variables: &HashMap<String, Value>,
) -> Result<String, Error> { ) -> Result<String, Error> {
match multiline { match multiline {
MultilineString::TextOneline(value) => { MultilineString::OneLineText(value) => {
let s = eval_template(value, variables)?; let s = eval_template(value, variables)?;
Ok(s) Ok(s)
} }

View File

@ -483,7 +483,7 @@ pub enum PredicateFuncValue {
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
pub enum MultilineString { pub enum MultilineString {
// FIXME: temporary type until we implement oneline as `foo` instead of ```foo``` // FIXME: temporary type until we implement oneline as `foo` instead of ```foo```
TextOneline(Template), OneLineText(Template),
Text(Text), Text(Text),
Json(Text), Json(Text),
Xml(Text), Xml(Text),
@ -493,7 +493,7 @@ pub enum MultilineString {
impl MultilineString { impl MultilineString {
pub fn value(&self) -> Template { pub fn value(&self) -> Template {
match self { match self {
MultilineString::TextOneline(template) => template.clone(), MultilineString::OneLineText(template) => template.clone(),
MultilineString::Text(text) MultilineString::Text(text)
| MultilineString::Json(text) | MultilineString::Json(text)
| MultilineString::Xml(text) => text.value.clone(), | MultilineString::Xml(text) => text.value.clone(),

View File

@ -863,7 +863,7 @@ impl Htmlable for PredicateValue {
impl Htmlable for MultilineString { impl Htmlable for MultilineString {
fn to_html(&self) -> String { fn to_html(&self) -> String {
let lang = match self { let lang = match self {
MultilineString::TextOneline(_) => { MultilineString::OneLineText(_) => {
let s = format!("```{value}```", value = self.value()); let s = format!("```{value}```", value = self.value());
let buffer = multilines(&s); let buffer = multilines(&s);
return format!("<span class=\"multiline\">{}</span>", buffer); return format!("<span class=\"multiline\">{}</span>", buffer);
@ -1085,7 +1085,7 @@ mod tests {
#[test] #[test]
fn test_multiline_string() { fn test_multiline_string() {
// `````` // ``````
let multiline_string = MultilineString::TextOneline(Template { let multiline_string = MultilineString::OneLineText(Template {
quotes: false, quotes: false,
elements: vec![TemplateElement::String { elements: vec![TemplateElement::String {
value: "".to_string(), value: "".to_string(),
@ -1099,7 +1099,7 @@ mod tests {
); );
// ```hello``` // ```hello```
let multiline_string = MultilineString::TextOneline(Template { let multiline_string = MultilineString::OneLineText(Template {
quotes: false, quotes: false,
elements: vec![TemplateElement::String { elements: vec![TemplateElement::String {
value: "hello".to_string(), value: "hello".to_string(),

View File

@ -31,7 +31,7 @@ pub fn multiline_string(reader: &mut Reader) -> ParseResult<'static, MultilineSt
Err(_) => { Err(_) => {
reader.state = save; reader.state = save;
let value = oneline_string_value(reader)?; let value = oneline_string_value(reader)?;
Ok(MultilineString::TextOneline(value)) Ok(MultilineString::OneLineText(value))
} }
} }
} }
@ -295,7 +295,7 @@ mod tests {
let mut reader = Reader::init("``````"); let mut reader = Reader::init("``````");
assert_eq!( assert_eq!(
multiline_string(&mut reader).unwrap(), multiline_string(&mut reader).unwrap(),
MultilineString::TextOneline(Template { MultilineString::OneLineText(Template {
quotes: false, quotes: false,
elements: vec![], elements: vec![],
source_info: SourceInfo::new(1, 4, 1, 4), source_info: SourceInfo::new(1, 4, 1, 4),
@ -347,7 +347,7 @@ mod tests {
let mut reader = Reader::init("```Hello World!```"); let mut reader = Reader::init("```Hello World!```");
assert_eq!( assert_eq!(
multiline_string(&mut reader).unwrap(), multiline_string(&mut reader).unwrap(),
MultilineString::TextOneline(Template { MultilineString::OneLineText(Template {
quotes: false, quotes: false,
elements: vec![TemplateElement::String { elements: vec![TemplateElement::String {
value: "Hello World!".to_string(), value: "Hello World!".to_string(),
@ -363,7 +363,7 @@ mod tests {
let mut reader = Reader::init("```base64_inline```"); let mut reader = Reader::init("```base64_inline```");
assert_eq!( assert_eq!(
multiline_string(&mut reader).unwrap(), multiline_string(&mut reader).unwrap(),
MultilineString::TextOneline(Template { MultilineString::OneLineText(Template {
quotes: false, quotes: false,
elements: vec![TemplateElement::String { elements: vec![TemplateElement::String {
value: "base64_inline".to_string(), value: "base64_inline".to_string(),

View File

@ -158,7 +158,7 @@ impl ToJson for Bytes {
// base64,SGVsbG8gd29ybGQ=; // base64,SGVsbG8gd29ybGQ=;
// ~~~ // ~~~
let lang = match multi { let lang = match multi {
MultilineString::TextOneline(_) | MultilineString::Text(_) => { MultilineString::OneLineText(_) | MultilineString::Text(_) => {
"multiline-string" "multiline-string"
} }
MultilineString::Json(_) => "json", MultilineString::Json(_) => "json",

View File

@ -606,7 +606,7 @@ impl Tokenizable for PredicateValue {
impl Tokenizable for MultilineString { impl Tokenizable for MultilineString {
fn tokenize(&self) -> Vec<Token> { fn tokenize(&self) -> Vec<Token> {
let lang = match self { let lang = match self {
MultilineString::TextOneline(_) => None, MultilineString::OneLineText(_) => None,
MultilineString::Text(_) => None, MultilineString::Text(_) => None,
MultilineString::Json(_) => Some("json"), MultilineString::Json(_) => Some("json"),
MultilineString::Xml(_) => Some("xml"), MultilineString::Xml(_) => Some("xml"),

View File

@ -520,7 +520,7 @@ impl Lintable<MultilineString> for MultilineString {
fn lint(&self) -> MultilineString { fn lint(&self) -> MultilineString {
match self { match self {
MultilineString::TextOneline(value) => MultilineString::TextOneline(value.lint()), MultilineString::OneLineText(value) => MultilineString::OneLineText(value.lint()),
MultilineString::Text(value) => MultilineString::Text(value.lint()), MultilineString::Text(value) => MultilineString::Text(value.lint()),
MultilineString::Json(value) => MultilineString::Json(value.lint()), MultilineString::Json(value) => MultilineString::Json(value.lint()),
MultilineString::Xml(value) => MultilineString::Xml(value.lint()), MultilineString::Xml(value) => MultilineString::Xml(value.lint()),