https://github.com/benoitc/epygments
Simple wrapper to Pygments - prettify source code in your erlang program.
https://github.com/benoitc/epygments
Last synced: 7 months ago
JSON representation
Simple wrapper to Pygments - prettify source code in your erlang program.
- Host: GitHub
- URL: https://github.com/benoitc/epygments
- Owner: benoitc
- License: other
- Created: 2012-02-08T03:46:13.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2012-02-08T04:11:53.000Z (about 14 years ago)
- Last Synced: 2025-03-17T11:52:30.960Z (12 months ago)
- Language: Erlang
- Homepage:
- Size: 94.7 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# epygments
epygments is a simple wrapper to [Pygments](http://pygments.org/) to
highlight source code from your erlang program.
## Requirements
- Python 2.5x & sup.
- [erlport](http://erlport.org/) - Erlang port protocol for Python
- [Pygments](http://pygments.org/)
## installation
You can install manually the python dependancies or use Pip:
$ pip install -r requirements.txt
to use compile epygments:
$ make
to create the doc:
$ make docs
then open index.html in the doc folder.
## Use it:
For now epygments offers you 2 function that you can use in your
application:
- `epygments:all_languages/0` : get all languages
- `epygments:highlight/2`, `epygments:highlight/3`, `epygments:highlight/4` : prettify the source code. See the reference doc for more informations.
## Test it:
$ erl -pa ebin -pa deps/poolboy/ebin
Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9 (abort with ^G)
1> application:start(epygments).
ok
2> epygments:all_languages().
[{<<"text">>,<<"Plain text">>},
{<<"Cucumber">>,<<"Gherkin">>},
{<<"abap">>,<<"ABAP">>},
{<<"ada">>,<<"Ada">>},
{<<"ahk">>,<<"autohotkey">>},
{<<"antlr">>,<<"ANTLR">>},
{<<"antlr-as">>,<<"ANTLR With ActionScript Target">>},
{<<"antlr-cpp">>,<<"ANTLR With CPP Target">>},
{<<"antlr-csharp">>,<<"ANTLR With C# Target">>},
{<<"antlr-java">>,<<"ANTLR With Java Target">>},
{<<"antlr-objc">>,<<"ANTLR With ObjectiveC Target">>},
{<<"antlr-perl">>,<<"ANTLR With Perl Target">>},
{<<"antlr-python">>,<<"ANTLR With Python Target">>},
{<<"antlr-ruby">>,<<"ANTLR With Ruby Target">>},
{<<"apacheconf">>,<<"ApacheConf">>},
{<<"applescript">>,<<"AppleScript">>},
{<<"as">>,<<"ActionScript">>},
{<<"as3">>,<<"ActionScript 3">>},
{<<"aspx-cs">>,<<"aspx-cs">>},
{<<"aspx-vb">>,<<"aspx-vb">>},
{<<"asy">>,<<"Asymptote">>},
{<<"basemake">>,<<"Makefile">>},
{<<"bash">>,<<"Bash">>},
{<<"bat">>,<<"Batchfile">>},
{<<"bbcode">>,<<"BBCode">>},
{<<"befunge">>,<<"Befu"...>>},
{<<"blit"...>>,<<...>>},
{<<...>>,...},
{...}|...]
2> epygments:highlight(<<"def test(a):\n if a == 0:\n return True">>, <<"python">>).
"def test(a):\n if a == 0:\n return True\n"