Gottani
Gottani is converter for indent-style text.
Support type
- Tab indent
- Space2 indent
- Space4 indent
- Markdown indent
- Hatena indent
Installation
Add this line to your application's Gemfile:
gem 'gottani'
And then execute:
$ bundle
Or install it yourself as:
$ gem install gottani
Usage
Convert List
type | convert_type key | convert_method_name |
---|---|---|
hatena | Gottani::Core.new :hatena, text | to_hatena |
markdown | Gottani::Core.new :markdown, text | to_markdown |
space2-indent | Gottani::Core.new :space2, text | to_space2 |
space4-indent | Gottani::Core.new :space4, text | to_space4 |
tab-indent | Gottani::Core.new :tab, text | to_tab |
tab-indent to space2 indent
require 'gottani_core'
text =<<-EOS
root
child1
child1_1
child1_1_1
child1_1_2
child1_2
child2
child2_1
child3
EOS
gottani_core = Gottani::Core.new :tab, text
gottani_core.to_space2
output
root
child1
child1_1
child1_1_1
child1_1_2
child1_2
child2
child2_1
child3
space2 to space4 indent
require 'gottani_core'
text =<<-EOS
root
child1
child1_1
child1_1_1
child1_1_2
child1_2
child2
child2_1
child3
EOS
gottani_core = Gottani::Core.new :space2, text
gottani_core.to_space4
output
root
child1
child1_1
child1_1_1
child1_1_2
child1_2
child2
child2_1
child3
space4 to Markdown indent
require 'gottani_core'
text =<<-EOS
root
child1
child1_1
child1_1_1
child1_1_2
child1_2
child2
child2_1
child3
EOS
gottani_core = Gottani::Core.new :space4, text
gottani_core.to_markdown
output
# root
## child1
### child1_1
#### child1_1_1
#### child1_1_2
### child1_2
## child2
### child2_1
## child3
space4 to Hatena indent
require 'gottani_core'
text =<<-EOS
root
child1
child1_1
child1_1_1
child1_1_2
child1_2
child2
child2_1
child3
EOS
gottani_core = Gottani::Core.new :space4, text
gottani_core.to_hatena
output
*root
**child1
***child1_1
****child1_1_1
****child1_1_2
***child1_2
**child2
***child2_1
**child3
History
- version 0.0.2 : add Hatena Format.
- version 0.0.1 : first release.
Contributing
- Fork it
- 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