pphtml 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -1
- data/lib/pphtml.rb +3 -1
- data/lib/pphtml/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b6e9e9347bbf9eea48f2a290cf3f3ac21e1cc5fccbcf86c0322801ca8688729
|
4
|
+
data.tar.gz: f0691692e6d2cc22970d0ca01d1ef4d82c88b39f3aabfc32aa2dea7bdcecbf1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da69389cd3d26b8a62aa58210ded3e3ab441dbf3a3149357c23db227ff512ae92b3a0ad45c7f0bb80b13da6bb69ff71ea589d3a0f3b582e72859ae7be5fbde44
|
7
|
+
data.tar.gz: a10eefb229540b206b96d25614d2285e49178a54875dfe4a4ceb0b0dec8ed76642ec634b5545ddd5b94f4dd682f5ff5150548348f0dc18afe0cc98dc46ca4524
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
PP for HTML looking things.
|
4
4
|
|
5
|
-
[
|
5
|
+
It will `puts` colorized HTML using ANSI escape codes from [CodeRay](https://github.com/rubychan/coderay) and returns an html document formatted by [HtmlBeautifier](https://github.com/threedaymonk/htmlbeautifier). This allows you to easily save the output to a file.
|
6
|
+
|
7
|
+
![screenshot](https://raw.githubusercontent.com/ttilberg/pphtml/master/screenshot.png)
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
@@ -32,6 +34,9 @@ pphtml response
|
|
32
34
|
|
33
35
|
doc = Nokogiri.parse(response)
|
34
36
|
pphtml doc
|
37
|
+
|
38
|
+
# The return value from pphtml is the html formatted without the ANSI escape codes:
|
39
|
+
File.write('myfile.html', pphtml doc)
|
35
40
|
```
|
36
41
|
|
37
42
|
## Development
|
data/lib/pphtml.rb
CHANGED
@@ -8,7 +8,9 @@ class PP < PrettyPrint
|
|
8
8
|
# Displays nice formatted output for an HTML string, or something that can look like one
|
9
9
|
#
|
10
10
|
def PP.pphtml(html)
|
11
|
-
|
11
|
+
pretty_html = HtmlBeautifier.beautify(html.to_s)
|
12
|
+
puts CodeRay.scan(pretty_html, :html).terminal
|
13
|
+
pretty_html
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
data/lib/pphtml/version.rb
CHANGED