Comments (3)
Another strange edge case:
key:value
multi-line-value
[singleword]
newkey:yeah
[]
another multi line value
:end
Result:
{
"key": "value",
"singleword": [
{
"newkey": "yeah"
}
],
"newkey": "undefinedanother multi line value"
}
from archieml-js.
Also seems to be related:
{scope}
key:value
{}
value2
:end
result:
{
"scope": {
"key": "value"
},
"key": "undefinedvalue2"
}
from archieml-js.
Hey @minikomi - thanks for all of the examples, these were all bugs in the way archieml-js was handling multi-line values. We can continue the discussion here if there are any questions / concerns about the behavior in any specific circumstances, but the way we intended it to work was:
Start any value with either a key: value
, or with an asterisk in the case of a simple array * value
). The value as defined on that line is always included as the value. Sequential lines are added to the value only if those lines 1) do not contain any lines that would be interpreted as commands (i.e., {}
), and are followed with an :end
line.
All of the examples above broke because the javascript parser was trying to add the lines immediately preceding :end
to the last key that was defined, even though there was a command line in the middle of the value that should have prevented it from being interpreted as a multi-line value.
I'm uploading a patch now that will cause key
in most of your examples to wind up as a single-line value, value
.
from archieml-js.
Related Issues (20)
- Only one line in a multi-line string can be escaped; multiple should be possible
- Test suite HOT 3
- Since commit a89c313... objects no longer "close" as they used to
- Is there a json to AML method? HOT 1
- Document crashes JS parser (but works in Ruby) HOT 3
- Support JSON-LD HOT 2
- Freeforms shouldn't require trailing newlines to pick up last line of text
- Support for numbers
- Exclude unnecessary files from production installs
- Sandbox doesn't escape output
- Converting JSON to ArchieML HOT 1
- Google autoformatting tends to break arrays of strings
- Cut npm release of v0.5.0? HOT 1
- 'Using with Google Documents' instructions, error
- Add SECURITY.md
- In-line JSON parsing HOT 1
- Arrays should override strings that already exist at a key HOT 1
- Nested array string values don't overwrite nested key/value pairs created by scoped arrays HOT 3
- Make inline comments configurable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from archieml-js.