Module: CustomFilters
- Defined in:
- lib/liquidoc.rb
Overview
Extending Liquid filters/text manipulation
Instance Method Summary collapse
- #commentwrap(input) ⇒ Object
- #plainwrap(input) ⇒ Object
- #slugify(input) ⇒ Object
-
#unwrap(input) ⇒ Object
Not fully functional; inserts explicit ‘n’.
Instance Method Details
#commentwrap(input) ⇒ Object
655 656 657 |
# File 'lib/liquidoc.rb', line 655 def commentwrap input input.wrap commentchar: "# " end |
#plainwrap(input) ⇒ Object
652 653 654 |
# File 'lib/liquidoc.rb', line 652 def plainwrap input input.wrap end |
#slugify(input) ⇒ Object
665 666 667 668 669 670 671 |
# File 'lib/liquidoc.rb', line 665 def slugify input # Downcase # Turn unwanted chars into the seperator s = input.to_s.downcase s.gsub!(/[^a-zA-Z0-9\-_\+\/]+/i, "-") s end |
#unwrap(input) ⇒ Object
Not fully functional; inserts explicit ‘n’
658 659 660 661 662 663 |
# File 'lib/liquidoc.rb', line 658 def unwrap input # Not fully functional; inserts explicit '\n' if input token = "[g59hj1k]" input.gsub(/\n\n/, token).gsub(/\n/, ' ').gsub(token, "\n\n") end end |