https://github.com/spencermountain/somehow-script
a natural-language data-entry format
https://github.com/spencermountain/somehow-script
Last synced: 18 days ago
JSON representation
a natural-language data-entry format
- Host: GitHub
- URL: https://github.com/spencermountain/somehow-script
- Owner: spencermountain
- Created: 2020-01-13T17:12:43.000Z (over 5 years ago)
- Default Branch: gh-pages
- Last Pushed: 2023-01-06T02:25:52.000Z (over 2 years ago)
- Last Synced: 2025-03-11T15:58:03.978Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://spencermounta.in/somehow-script/
- Size: 1.28 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
this is a *work-in-progress* markup format for creating metadata in text.
It is inspired by a good number of similar projects:
* [pugjs](https://pugjs.org/api/getting-started.html) - period-based control-chars
* [margin](https://margin.love) - flexible use of `[ ]` chars
* [archieml](http://archieml.org/) - interchangable `=` and `:`
* [TOML](https://github.com/toml-lang/toml) - typing of booleans+dates
* [literate coffeescript](http://sukima.github.io/litcoffee-presentation/) - encourage freehand text### Usage
`npm i somehow-script````js
const smh = require('./src')let text = `in the town where I was born
there lived a man, who sailed the seas.the simplest tag is a word that begins with a period:
.filmsquare-brackets allow adding key-value data to the tag
.film[name: Interview with a Vampire]somehow-script automatically parses dates+times
.film[release=July 1992]can add multiple properties at once
.film[release=July 1992, budget=12m]automatically parses lists
.film[actors=Brad Pitt, Tom Cruise]
`
console.log(smh(text))
/*
{
data: [
{ name: 'film', props: {}, text: '.film', offset: 124, len: 5 },
{
name: 'film',
props: { name: 'Interview with a Vampire' },
text: '.film[name: Interview with a Vampire]',
offset: 186,
len: 37
},
...
]
}
*/// remove all annotations
console.log(smh.strip(text))
// wrap annotations in generic span tags
console.log(smh.html(text))
```### Goals
* create folk-style triplets (without being too-semantic-web)
* rarely collide with natural text (few false positives)
* avoid collisions with markdown.
* avoid collisions with hashtags/atmentions/email/emoticons
* easy creation on mobile keyboards
* allow chaining
* support parsing of natural-language dates (via spacetime)
* parsing of natural-language numbers (via compromise-tokenize, compromise-numbers)
* wysiwyg via code/prose-mirrorMIT