-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from liplum/master
Refactor: Improve string quoting logic and fixed string-related bugs
- Loading branch information
Showing
14 changed files
with
599 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/// Style of quotes to use for string serialization. | ||
enum QuoteStyle { | ||
/// Example: `'value'`. | ||
singleQuote("'"), | ||
|
||
/// Example: `"value"`. | ||
doubleQuote('"'); | ||
|
||
final String char; | ||
|
||
const QuoteStyle(this.char); | ||
} | ||
|
||
/// Configuration for [YamlWriter]. | ||
class YamlWriterConfig { | ||
/// The indentation size. | ||
/// Must be greater or equal to `1`. | ||
/// | ||
/// Defaults to `2`. | ||
final int indentSize; | ||
|
||
/// The quote to be used for quoting strings. | ||
/// Defaults to [QuoteStyle.doubleQuote], because single quotes are often used as apostrophes. | ||
final QuoteStyle quoteStyle; | ||
|
||
/// If `true`, it will force quoting of strings. | ||
/// If `false`, strings could be left unquoted if possible. | ||
final bool forceQuotedString; | ||
|
||
const YamlWriterConfig({ | ||
this.indentSize = 2, | ||
this.quoteStyle = QuoteStyle.doubleQuote, | ||
this.forceQuotedString = false, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/// YAML Writer Library. | ||
library yaml_writer; | ||
library; | ||
|
||
export 'src/yaml_writer.dart'; | ||
export "src/config.dart"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
name: yaml_writer | ||
description: A library to write YAML documents, supporting Object encoding and 'dart:convert' 'Converter'. | ||
version: 2.0.1 | ||
version: 2.1.0 | ||
homepage: https://github.com/gmpassos/yaml_writer | ||
|
||
environment: | ||
sdk: ">=3.0.0 <4.0.0" | ||
|
||
dev_dependencies: | ||
lints: ^3.0.0 | ||
lints: ^5.1.1 | ||
test: ^1.25.8 | ||
dependency_validator: ^3.2.3 | ||
dependency_validator: ^5.0.2 | ||
coverage: ^1.10.0 | ||
yaml: ^3.1.3 |
Oops, something went wrong.