breck7 / copypaster

Make web forms copy-pasteable.
http://copypaster.publicdomaincompany.com
99 stars 3 forks source link

Clarify advantages of using tree notation over other formats #1

Closed lubieowoce closed 1 week ago

lubieowoce commented 4 years ago

making forms copy-pastable is a neat idea! but i feel like the same benefits could be achieved by simply making web forms serializable to any suitable format of choice, preferably a human-readable/editable one. i think this proposal would benefit from clarifying the unique advantages of using tree notation vs, say, JSON + a schema.

breck7 commented 4 years ago

This is a good point! There are lots of little details of why I think Tree Notation (or someone else's similarly minimal notation) would be the best solution for this.

One main reason is that you never need to escape anything (just indent blocks). For instance, let's say the form is for filing a bug report and has a textarea for including source code. Perhaps the form is:

Name [Mary]
SourceCode
[ print "Hello"
  print "World" ]

This could serialize to Tree Notation as:

Name Mary
SourceCode
 print "Hello"
 print "World"

While JSON would require lots of escaping into something like this:

{
"Name": "Mary",
 "SourceCode": [
  "print": "\"Hello\"\n",
  "print": "\"World\""
 ]

}

breck7 commented 4 years ago

Thinking about it more, it seems the best approach would probably to allow the serialization to/from any format when possible as you suggested. I think Tree Notation would work best for most cases, for little detail reasons like the one above, but we could make a toggle or something to add support for other formats as well.

breck7 commented 1 week ago

After many years, we are very close to having CopyPaster functionality easy to use!!!!

I'm thinking in a very short time, we will ship this in Scroll.

Here's the new issue to track https://github.com/breck7/scroll/issues/133