Socket
Book a DemoInstallSign in
Socket

blogtext

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blogtext

1.0.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Blogtext

Gem Version

This Ruby gem converts a text file with specific format into HTML code.

Installation

Add this line to your application's Gemfile:

gem 'blogtext'

And then execute:

$ bundle

Or install it yourself as:

$ gem install blogtext

Usage

There are two main static methods:

  • Blogtext::convert(<path_to_file>), used to get the HTML for a certain file.

  • Blogtext::cli_convert, used to get a file (at the same directory as the original text file) with the HTML content corresponding to the original text file. This method receives no parameters, because it use ARGV[0] as file name, i.e., the first parameter after the program name at command line.

In order to help command line usage, an executable named blogtext was added. It invokes Blogtext::cli_convert and generates the corresponding HTML file for the text file given. To convert a text file, just type at command line:

$ blogtext <path/to/file/filename.txt>

The path may be absolute or relative. The HTML file will be created at the same directory of the original file.

The text file format

  • First line is always the article title and it is enclosed with <h1></h1> in the final result.
  • Second like is always the article subtitle and it is enclosed with <h3></h3> in the final result.
  • A line may start with [image] followed by a valid link to an image file.
  • A line may start with [video] followed by a valid pure Youtube link to a video.
  • A line may start with [quote] followed by a quote string.
  • If none of these things happen, the line is enclosed with <p></p>.

The 'pure' means we can't have, by now, any other URI parameters, then

TODO

  • Support non-'pure' Youtube URLs;
  • Support other video providers;
  • Support links in the middle of paragraphs.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/EdDeAlmeidaJr/blogtext.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Blogtext project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 15 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.