Polites
Polites allows you to work with files generated by the Ulysses writing application for macos.
Most importantly, this gem allows you to take Ulysses .ulyz files as input and transform them into HTML, all from Ruby. Additionally, you can extract embedded media files from the .ulyz file.
See the API docs.
Installation
Add this line to your application's Gemfile:
gem 'polites'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install polites
Usage
Transform a file to HTML:
Polites::Convert.new.call('/path/to/file.ulyz')
# => (html content)
Parse a sheet:
Polites::File.open('/path/to/file.ulyz') do |f|
sheet = Polites::Parser.new.parse_sheet(f.content)
sheet.keywords # => ['Keyword1', 'Keyword2']
sheet.files # => ['1a3577ba004942ecb71d8a940cab4b1f']
Polites::HtmlFormatter.new.call(sheet)
# => (html content)
end
Usage with Nanoc
When using Nanoc you can install polites-nanoc
so you can use a Ulysses external folder as a Nanoc data source.
gem 'polites-nanoc'
Refer to the API docs for Polites::Nanoc
for more information.
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/avdgaag/polites. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Polites project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.