Skip to content

Commit

Permalink
chore: renamed to enabled_indented_mutiline_value (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed Dec 20, 2024
1 parent b2a09b9 commit fa792ff
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
use std::{
borrow::Cow,
char, error,
char,
error,
fmt::{self, Display},
fs::{File, OpenOptions},
io::{self, Read, Seek, SeekFrom, Write},
Expand Down Expand Up @@ -218,17 +219,19 @@ pub struct ParseOption {
/// Enables values that span lines
/// ```ini
/// [Section]
/// Key1=C:\Windows
/// foo=
/// b
/// c
/// ```
pub indented_multiline_values: bool,
pub enabled_indented_mutiline_value: bool,
}

impl Default for ParseOption {
fn default() -> ParseOption {
ParseOption {
enabled_quote: true,
enabled_escape: true,
indented_multiline_values: false,
enabled_indented_mutiline_value: false,
}
}
}
Expand Down Expand Up @@ -1567,7 +1570,7 @@ impl<'a> Parser<'a> {
}
_ => self.parse_str_until_eol(cfg!(feature = "inline-comment")),
}?;
if self.opt.indented_multiline_values {
if self.opt.enabled_indented_mutiline_value {
loop {
self.bump();
match self.ch {
Expand All @@ -1580,7 +1583,7 @@ impl<'a> Parser<'a> {
}
Some('\n') => {
val.push('\n');
continue
continue;
}
_ => break,
}
Expand Down Expand Up @@ -2758,7 +2761,7 @@ x3 = nb
}

#[test]
fn parse_indented_multiline_values() {
fn parse_enabled_indented_mutiline_value() {
let input = "
[Foo]
bar =
Expand All @@ -2776,7 +2779,7 @@ bla = a
let opt = Ini::load_from_str_opt(
input,
ParseOption {
indented_multiline_values: true,
enabled_indented_mutiline_value: true,
..ParseOption::default()
},
)
Expand Down

0 comments on commit fa792ff

Please sign in to comment.