plugin StringParser
I decided to somehow streamline the hackneyed problem: in almost every project I have to create a custom parser that displays the text in a readable form. And in almost every project, 80% of this parser is the solution of already solved problems.
StringParser is a Rails and Lib plugin that includes methods that implement the most common parsing tasks. Let me show you an example: The same can be done in a block (anyone likes it as much as possible): I’ll just give the names of the methods that I already managed to code, and the description can be found in more detail in the docks or in the sources: break_long_words close_tags cut highlight_code # uses gem ultraviolet to highlight
html_escape #, unlike the rail counterpart, accepts: except => []
newlines_to_br
urls_to_images
urls_to_links
I would like to invite everyone to complete the library and bring it to mind.
StringParser is a Rails and Lib plugin that includes methods that implement the most common parsing tasks. Let me show you an example: The same can be done in a block (anyone likes it as much as possible): I’ll just give the names of the methods that I already managed to code, and the description can be found in more detail in the docks or in the sources: break_long_words close_tags cut highlight_code # uses gem ultraviolet to highlight
StringParser.new("what a cool url: url.com and image image.com/image.jpg
").urls_to_images.urls_to_links.html_escape.string
parser = StringParser.new("what a cool url: url.com and image image.com/image.jpg
") do |p|
p.urls_to_images.urls_to_links
p.html_escape
end
parser.string
html_escape #, unlike the rail counterpart, accepts: except => []
newlines_to_br
urls_to_images
urls_to_links
I would like to invite everyone to complete the library and bring it to mind.