A simple plaintext list parser/serializer
Add this line with github option to your application's Gemfile:
gem 'lis', github: 'deeeki/lis'
And then execute:
$ bundle
Lis.parse("a\n-b\n--c\n") #=> {"a"=>{"b"=>["c"]}}
Lis.serialize({ "a" => { "b" => ["c"] } }) #=> "a\n-b\n--c\n"The following plaintext list --
Ruby
-2
--2.1.0
--2.0.0
-1
--1.9.3
--1.8.7
Rails
-4
--4.1.0
--4.0.2
-3
--3.2.16
will be converted to the following as Ruby hash object.
{
"Ruby" => {
"2" => ["2.1.0", "2.0.0"],
"1" => ["1.9.3", "1.8.7"]
},
"Rails" => {
"4" => ["4.1.0", "4.0.2"],
"3" => ["3.2.16"]
}
}- Support Markdown lists format
- lists with top-level symbol (
"-a\n--b\n---c\n") - other symbols (
*and+)
- Ruby 2.1.0 or higher
- Fork it ( http://github.com/deeeki/lis/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request