poppins 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +15 -10
- data/bin/poppins +1 -5
- data/lib/poppins/document.rb +10 -3
- data/lib/poppins/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -22,17 +22,22 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
Poppins: a Markdown cleaner and formatter
|
26
|
-
Usage: poppins [options] <filename>
|
25
|
+
Poppins: a Markdown cleaner and formatter
|
26
|
+
Usage: poppins [options] <filename>
|
27
|
+
|
28
|
+
Examples:
|
29
|
+
poppins ./README.md
|
30
|
+
poppins --output 'output.md' ./input.md
|
31
|
+
|
32
|
+
Options:
|
33
|
+
-o, --output [FILE] Write the clean, formatted Markdown to FILE.
|
34
|
+
-h, --help Show this message
|
35
|
+
-v, --version Show version
|
36
|
+
|
37
|
+
## Roadmap
|
38
|
+
|
39
|
+
Poppins is intended to be similar to [formd](http://www.drbunsen.org/formd-a-markdown-formatting-tool.html), but with easier integration with Ruby projects. Also, I would like to add the ability to insert reference links they way Dr. Drang describes [here](http://www.leancrew.com/all-this/2012/08/markdown-reference-links-in-bbedit/) and [here](http://www.leancrew.com/all-this/2012/08/more-markdown-reference-links-in-bbedit/).
|
27
40
|
|
28
|
-
Examples:
|
29
|
-
poppins ./README.md
|
30
|
-
poppins --output 'output.md' ./input.md
|
31
|
-
|
32
|
-
Options:
|
33
|
-
-o, --output [FILE] Write the clean, formatted Markdown to FILE.
|
34
|
-
-h, --help Show this message
|
35
|
-
-v, --version Show version
|
36
41
|
|
37
42
|
## Contributing
|
38
43
|
|
data/bin/poppins
CHANGED
data/lib/poppins/document.rb
CHANGED
@@ -1,14 +1,21 @@
|
|
1
1
|
module Poppins
|
2
2
|
class Document
|
3
3
|
|
4
|
-
def initialize(input, output=nil)
|
5
|
-
|
4
|
+
def initialize(input=nil, output=nil)
|
5
|
+
if input.empty?
|
6
|
+
# TODO: Probably need to raise an error if ARGF is nil...
|
7
|
+
@input = ARGF.readlines.join
|
8
|
+
else
|
9
|
+
@input = File.open(input, 'r').readlines.join
|
10
|
+
end
|
11
|
+
|
6
12
|
@output = output
|
7
13
|
|
8
14
|
# RegEx for matching reference links in the text. (Avoid footnotes!)
|
9
15
|
@links = /\[([^\]]+)\]\[([^^\]]+)\]/
|
10
16
|
# RegEx for matching labels for reference links. (Avoid footnotes!)
|
11
17
|
@labels = /^\[([^^\]]+)\]:\s+(.+)$/
|
18
|
+
@labels_with_possible_newlines = /^\[([^^\]]+)\]:\s+(.+)(\n)?/
|
12
19
|
end
|
13
20
|
|
14
21
|
##
|
@@ -57,7 +64,7 @@ module Poppins
|
|
57
64
|
def clean_and_format
|
58
65
|
# Remove old references (TOOD: Need to remove blank lines resulting from
|
59
66
|
# this.)
|
60
|
-
result = @input.gsub(@
|
67
|
+
result = @input.gsub(@labels_with_possible_newlines, '')
|
61
68
|
#
|
62
69
|
# Add new references
|
63
70
|
ordinal_references.each do |r|
|
data/lib/poppins/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poppins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -63,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
segments:
|
65
65
|
- 0
|
66
|
-
hash:
|
66
|
+
hash: 1824278332185590952
|
67
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
68
|
none: false
|
69
69
|
requirements:
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
version: '0'
|
73
73
|
segments:
|
74
74
|
- 0
|
75
|
-
hash:
|
75
|
+
hash: 1824278332185590952
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
78
|
rubygems_version: 1.8.23
|