README.md in h2p-0.1 vs README.md in h2p-0.2
- old
+ new
@@ -10,11 +10,11 @@
# you'll also need to have wkhtmltopdf installed:
gem install 'wkhtmltopdf-binary'
```
-Or just [use the source(TM)](#use-the-source).
+Or just [use the source™️](#use-the-source).
## Usage
```ruby
...
@@ -23,15 +23,18 @@
...
```
## Use the source
-Adding a dependency to your `Gemfile` is just another thing to keep track off,
-on top of everything else. Luckily, H2P is so small you can just copy the
-source into your project:
+If you don't want to add another dependency to your project, here's the source
+of the present gem (with the [modulation](https://github.com/digital-fabric/modulation)
+dependency removed.) Feel free to use and manipulate however you please:
```ruby
+# This is free and unencumbered software released into the public domain
+# Full license here: https://unlicense.org/
+
require 'tmpdir'
require 'fileutils'
module H2P
def self.tmp_path(ext)
@@ -41,10 +44,9 @@
end
def self.convert(html)
html_path = tmp_path(:html)
pdf_path = tmp_path(:pdf)
- p [html_path, pdf_path]
File.open(html_path, 'w+') { |f| f << html }
system('wkhtmltopdf', '-q', html_path, pdf_path)
IO.read(pdf_path)
ensure
FileUtils.rm(html_path) rescue nil
\ No newline at end of file