pickten / StoryCraftJS

A JS port of StoryCraft
Other
0 stars 0 forks source link

Syntax #1

Open pickten opened 9 years ago

pickten commented 9 years ago

Originally, Storycraft had the following syntax:

Title
text text text
blah
=chap
==sec
blah
blah

Of course, I don't want to remove that -- it's too useful. But the anchor system feels incomplete. In particular, we need a way to set anchors and set them without changing chap/sec/part/scene/whatever.

Here're some options:

=Location: Home=

-Location: Home

-Location=Home

$Location=Home

Location: Home.

I'm leaning towards the first two, because they're pretty clean. However, it would be really nice to have auto-expiring anchors. The issue is that that makes it very hard to keep things consistent-seeming between ==Chapter 5: Welcome to Night Vale notation and ===Chapter 5: Welcome to Night Vale=== notation (seriously though, who sets an anchor name equal to "Chapter 5").

This makes me like the last, but it means you can't begin a par with __:__., which is terrible and stupid.

UGH. More later.

pickten commented 8 years ago

This feels like what I need to do next, so I drafted some more thoughts.

Location -> Home

I like this one, because I can do Location > Home, but again, same problem with limiting user content.

Alternatively, :Location: Home feels nice, maybe :Location:= Home as the temp version?

It feels wrong to write this, but I'm also considering Location :Home, :Location :Home, etc. or some variant of that. The advantage of this is that it feels like Location: Home, but doesn't restrict user content.

This all feels fairly Haskellian, so maybe Location-:Home or Location <- Home. Again, this makes temps feel wrong. What about Location>>Home, Location->>Home, etc? Still feels wrong.

pickten commented 8 years ago

Pretty happy with this : at the start of a line enters "Anchor mode" So :Location Home sets Location Home in global However, :Location: Home is depth-1, likewise :Location::::Home is depth-4.

But wait! We can chain these together! :Location Home:Time Early sets Location=Home, Time=Early. Want spaces or colons in a name? - has you covered. A -: is not counted as a :, and a - takes precedence in determining the key-value breakup of a token, e.g. :Colon-:key says hi! is "Colon-:key" "says hi!", while :space key - works as well. Note that the latter usage eats up white space, so you cannot have a key ending in a space that has a space elsewhere in it. Thus, :hi bob - key is the same as :hi bob - key.

So what is :::Location:Home::Key:hi, for example? Or anything with extra colons? The extra colons will be useless! Additionally, a white-space name will not work, so you can use :Location: Home: : : Test: Yup to do :Location:Home:Test:Yup if you find the white space helpful. Likewise, a key or value of - is ignored. In other words, a key or value which is entirely a combination of whitespace, - and : is ignored with the exception of changing depth as mentioned above.

pickten commented 8 years ago

OK, some more thoughts on needed syntax.

  1. Synonyms. Would be a big help. Tentative: ![list, of, alternate, keys]![list, of values, which, function, identically for, that, set of keys], so ![Location, Place, Setting]![] ([] can be dropped, ! can as well if it's the value part, not the first). This stuff may be hard to code.
  2. Better anchor logic. 'nuff said.