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>,
) -> Result<String, Error> {
match multiline {
MultilineString::TextOneline(value) => {
MultilineString::OneLineText(value) => {
let s = eval_template(value, variables)?;
Ok(s)
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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