10000 Add support for double quote on item value by lunny · Pull Request #110 · go-ini/ini · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add support for double quote on item value #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Add support for double quote on item value #110

wants to merge 1 commit into from

Conversation

lunny
Copy link
@lunny lunny commented Jul 2, 2017

This PR will support the format which is used on crowdin download file.

create_repo="创建了仓库 <a href=\"%s\">%s</a>"

@lunny lunny changed the title add support for double quote on item value Add support for double quote on item value Jul 2, 2017
@@ -202,6 +202,8 @@ func (p *parser) readValue(in []byte, ignoreContinuation, ignoreInlineComment bo
var valQuote string
if len(line) > 3 && string(line[0:3]) == `"""` {
valQuote = `"""`
} else if line[0] == '"' {
valQuote = `"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://github.com/go-ini/ini#working-with-values:

image

So this won't be supported as default behavior.

@@ -213,6 +215,9 @@ func (p *parser) readValue(in []byte, ignoreContinuation, ignoreInlineComment bo
if pos == -1 {
return p.readMultilines(line, line[startIdx:], valQuote)
}
if valQuote == `"` {
return strings.Replace(line[startIdx:pos+startIdx], `\"`, `"`, -1), nil
Copy link
Member
@unknwon unknwon Aug 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you distinguish user actually wants \" instead of replacing them to "?

@unknwon
Copy link
Member
unknwon commented Oct 14, 2017

You can now use this feature via:

cfg, err := ini.LoadSources(ini.LoadOptions{UnescapeValueDoubleQuotes: true}, ...))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0