sagotch / pastek-lang Goto Github PK
View Code? Open in Web Editor NEWAnother lightweight markup language.
Home Page: http://sagotch.github.io/pastek-lang
License: MIT License
Another lightweight markup language.
Home Page: http://sagotch.github.io/pastek-lang
License: MIT License
Using the same rule with different parameters could be very useful. A syntax highlighter for instance, taking the language as parameter would need to create as many rule as there is different languages, but only one would be required with parameterized rules.
Something like:
[foo] cmd = "foo --option $1 $2"
%%%foo bar bu
This is foo, bar is $1 and bu is $2.
%%%
$ pastek <<< "[[ foo || bar\" ]]"
<p><img src="foo" alt="bar"" /></p>
$ pastek <<< "[[ foo\" << bar ]]"
<p><a href="foo"">bar</a></p>
Pastek parser should be a module provided as a library.
Any translater should depends on this library but still being independant.
Also, AST could shipped as another librarie, which would allow to use it for multiple parser. It would allow to use any Markup Language parser to create an AST, and then convert this AST in any target language.
The ability of giving the name of a file as toml configuration table would help a lost generating multiple pages without the need to redefine the css
and cmd
tables (for instance).
Later, pastek
should also look for a ~/.pastekconfig
file (or another name/location).
Now way to provide charset attribute for now.
@Lasconik asked for linebreak feature.
I'll go for a two-space-ended-line.
For instance, \{
in raw code blocks is not supported.
Introduce a way to define custom divisions in the document.
<<<???>>>
some pastek here.
<<</>>>
The ???
part could be a identifier, or it may embedded some data for render engines specific use.
Need to think about it.
pastek misses a verbatim mode.
It’d be great to be able to use pastek --version
to get Pastek’s version for bug reports.
=-=-= Installing pastek.0.5.0 =-=-=
pastek.0.5.0 Fetching https://github.com/pastek-project/pastek.git#v0.5.0
Copying ~/.opam/repo/pastek/packages/pastek/pastek.0.5.0/files/pastek.install to ~/.opam/4.01.0/build/pastek.0.5.0/
Building pastek.0.5.0:
make build
[ERROR] The compilation of pastek.0.5.0 failed.
Removing pastek.0.5.0.
ocamlfind remove pastek
===== ERROR while installing pastek.0.5.0 =====
The former state can be restored with opam switch import -f "/Users/gnukos/.opam/4.01.0/backup/state-20140910162505.export"
'opam install pastek' failed.
$ pastek --version
pastek version: 2014.03.24
$ pastek --help
usage: pastek [options] < input > output
--full-document Generate a full standalone document.
--translate-only Translate into target language only (default behavior).
--no-default-config Do not use default (~/.pastek/default_config.toml) file.
--config Use provided file as configuration file.
--version Print pastek version and exit.
-help Display this list of options
--help Display this list of options
The help text is not aligned, e.g.:
--foo Foo bar
instead of:
--foo Foo bar
My first idea for comment syntax is
Can you see<< this comment>>?
<<<
This is a comment,
and I like to write it
using lot of lines.
>>>
With a fresh installation of Pastek 2014.03.24:
$ pastek <<< "foo"
Fatal error: exception Sys_error("/Users/baptiste/.pastek/default_config.toml: No such file or directory")
$ pastek -help
usage: pastek_core [options] < input > output
--full-document Generate a full standalone document.
--translate-only Translate into target language only (default behavior).
-help Display this list of options
--help Display this list of options
Notice that it mentions pastek_core
even if the command is pastek
.
From menhir list:
rule param closing_keyword = parse
| keyword as kw ->
{ if kw = closing_keyword then DONE else main closing_keyword lexbuf }
Do you plan to support reference links, like Markdown? See example below:
Here is a [link][a-ref] and [another][] with an implicit reference.
[a-ref]: http://example.com/foo
[another]: http://example.com/bar
This is handy when you have long links, for exemple here is an excerpt of a Wikipedia article with expanded links:
**Rambles in Germany and Italy**, in 1840, 1842, and 1843 is a [travel
narrative](https://en.wikipedia.org/wiki/Travel_literature) by the British
[Romantic](https://en.wikipedia.org/wiki/Romanticism) author [Mary
Shelley](https://en.wikipedia.org/wiki/Mary_Shelley). Issued in 1844, it is her
last published work. Published in two volumes, the text describes two European
trips that Mary Shelley took with her son, [Percy Florence
Shelley](https://en.wikipedia.org/wiki/Percy_Florence_Shelley), and several of
his university friends. Mary Shelley had lived in Italy with her husband,
[Percy Bysshe Shelley](https://en.wikipedia.org/wiki/Percy_Bysshe_Shelley),
between 1818 and 1823.
And here is the same excerpt using references:
**Rambles in Germany and Italy**, in 1840, 1842, and 1843 is a [travel
narrative][1] by the British [Romantic][2] author [Mary Shelley][3]. Issued in
1844, it is her last published work. Published in two volumes, the text
describes two European trips that Mary Shelley took with her son, [Percy
Florence Shelley][4], and several of his university friends. Mary Shelley had
lived in Italy with her husband, [Percy Bysshe Shelley][5], between 1818 and
1823.
[1]: https://en.wikipedia.org/wiki/Travel_literature
[2]: https://en.wikipedia.org/wiki/Romanticism
[3]: https://en.wikipedia.org/wiki/Mary_Shelley
[4]: https://en.wikipedia.org/wiki/Percy_Florence_Shelley
[5]: https://en.wikipedia.org/wiki/Percy_Bysshe_Shelley
Encoded Mnemonic Argum ent Action
Form Symbol
------- --------- ----- ----- ----------------------------------
0 DAT B Initialize location to value B.
1 MOV A B Move A into location B.
Look at: #14 (comment)
Solution?
Wouldn't it be nice to be able to define UML diagrams inside pastek files ? The same way it supports Graphviz, it could support an UML modeler, for instance PlantUML.
Some markdown parsers allow errors in syntax and still process the input, e.g:
$ maruku <<< "aa**" 2>/dev/null
<p>aa**</p>
$ kramdown <<< "aa**"
<p>aa**</p>
Also note that Maruku gives human-friendly errors, e.g.:
$ maruku <<< "aa**"
___________________________________________________________________________
| Maruku tells you:
+---------------------------------------------------------------------------
| Opening * as last char.
| ---------------------------------------------------------------------------
| aa**EOF
| ---|------------------------------------------------------------------------
| +--- Byte 3
| Shown bytes [0 to 4] of 4:
| >aa**
|
| At line 2
| text |aa**|
|
|
| Elements read in span:
| -
| Current string:
| "aa*"
|
|
| Recovering: Treating as literal
+---------------------------------------------------------------------------
!/Users/baptiste/.rvm/gems/ruby-2.0.0-p247/gems/maruku-0.7.1/lib/maruku/input/parse_span.rb:142:in `read_span'
!/Users/baptiste/.rvm/gems/ruby-2.0.0-p247/gems/maruku-0.7.1/lib/maruku/input/parse_span.rb:14:in `parse_span'
!/Users/baptiste/.rvm/gems/ruby-2.0.0-p247/gems/maruku-0.7.1/lib/maruku/input/parse_block.rb:287:in `read_paragraph'
!/Users/baptiste/.rvm/gems/ruby-2.0.0-p247/gems/maruku-0.7.1/lib/maruku/input/parse_block.rb:154:in `read_text_material'
\___________________________________________________________________________
<p>aa**</p>
$ pastek <<< "aa**"
Fatal error: exception Parser.Error
By default, Maruku will process the input even if there’s an error, but it can be told to break on error: maruku --break
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.