redrug 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b28a70768420e25e2504fc03468bff2dda20eb02
4
- data.tar.gz: f58513ae5ec0d9975be0582f2b9d48c7aa255348
2
+ SHA256:
3
+ metadata.gz: 8c57240ac79baf96c9a4e16630e30f215bb632aad7abd9859c7bee23fde191ab
4
+ data.tar.gz: a712d3e065bfd6d01108dfeaa0fba0150649c726f82c26b597269756b8906da1
5
5
  SHA512:
6
- metadata.gz: c927e151019a06056f4f641e7d0f07bac755c242d81fc81bd935fafa7d01285ce756aac7b8e8d5799e4a53664e8c56377ae57d04ad5b88378986079b6c089144
7
- data.tar.gz: a325d5b66ef979be5da8cde63d3785203ca6a795a4c7bb4d322548e577481c88f3a5fbbdef3de1fb6f09d306ae0037e0ffe74957e5ecf1d45170da56a12fe801
6
+ metadata.gz: 6ce34f4060254d32df5411b05a2750942a24f2da4e379c72ed3a69a5931f8c9dacb31d9470615715ca77e9926c9c9806f87fc3e76a83e6b2ff90e650ae880644
7
+ data.tar.gz: 002757ab7f297c5ed8e4470052850c1ccfba069f6cbb3f4655fd6104fda26f31bcc15ea9c238091461613cd0653d26a842cb28ccfca0621e0414eb99d4c67610
data/COPYING CHANGED
@@ -1,17 +1,18 @@
1
- RedRug is distributed under the terms of the Detachable Public License. The
2
- Detachable Public License is a copyfree license.
1
+ RedRug is distributed under the terms of the Copyfree Open Innovation License
2
+ (COIL) or the Detachable Public License (DPL), at the recipient's discretion.
3
+ The COIL and DPL are copyfree licenses.
3
4
 
4
5
  RedRug depends on Redcarpet, which is distributed under the terms of the ISC
5
6
  License. The ISC License is a copyfree license.
6
7
 
7
8
  RedRug also depends on Versionize, which is distributed under the terms of the
8
- same license as RedRug. That's awfully convenient.
9
+ same licenses as RedRug. That's awfully convenient.
9
10
 
10
11
  See http://copyfree.org for more information about copyfree licensing in
11
- general, and about the Detachable Public License and ISC License in particular.
12
+ general, and about the COIL, DPL, and ISC License in particular.
12
13
 
13
14
  See https://github.com/vmg/redcarpet for more information about Redcarpet. See
14
15
  http://fossrec.com/u/apotheon/versionize for more information about Versionize.
15
16
  See http://fossrec.com/u/apotheon/redrug for more information about RedRug.
16
17
 
17
- See the LICENSE file for the text of the Detachable Public License.
18
+ See coil.txt for the text of the COIL and dpl.txt for the text of the DPL.
data/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # redrug
2
+
3
+ The redcarpet library can be a bit cumbersome to use, and redrug aims to
4
+ rectify this problem by wrapping it with simpler interfaces for common use
5
+ cases. Three places to get information about RedRug include:
6
+
7
+ * [Fossil Repository](https://fossrec.com/u/apotheon/redrug)
8
+ * [GitHub Mirror](https://github.com/apotheon/redrug)
9
+ * [Ruby Gem Page](https://rubygems.org/gems/redrug)
10
+
11
+ ## Installation
12
+
13
+ The simple way to install redrug is to use the gem command:
14
+
15
+ $ gem install redrug
16
+
17
+ You can also build from source and install it the "hard" way. To do this,
18
+ first clone the sources to your local system using Fossil SCM:
19
+
20
+ $ fossil clone http://redrug.fossrec.com redrug.fossil
21
+
22
+ Then, open the repository in an appropriate directory:
23
+
24
+ $ mkdir redrug
25
+ $ cd redrug
26
+ $ fossil open ../redrug.fossil
27
+
28
+ Finally, build and install, where in this example the N.N.N sequence is a
29
+ series of numbers indicating the current version number of the gem.
30
+
31
+ $ gem build red_rug.gemspec
32
+ $ gem install redrug-N.N.N.gem
33
+
34
+ ## Rails Usage
35
+
36
+ The most convenient use of RedRug with Rails is probably as an application
37
+ helper. The following example assumes that approach.
38
+
39
+ First, stick it in your Gemfile:
40
+
41
+ gem 'redrug'
42
+
43
+ Next, make sure you install it:
44
+
45
+ $ bundle install
46
+
47
+ Finally (and this is the "hard" part, of course), set up a helper in your
48
+ project's `app/helpers/application_helper.rb` (though if you are only going to
49
+ use it in very limited contexts, you may want to stick it in some other helper
50
+ within `app/helpers/`):
51
+
52
+ # whatever other requires you need
53
+ require 'red_rug'
54
+
55
+ module ApplicationHelper
56
+ # whatever other helper methods you've defined
57
+
58
+ def markdown text
59
+ RedRug.to_html(text).html_safe
60
+ end
61
+ end
62
+
63
+ You can then use it wherever you need to parse Markdown by executing the
64
+ `markdown` method, most likely in views. For instance, there's always this
65
+ common pattern, in (for instance) your `app/views/profiles/show.html.erb` view:
66
+
67
+ <h2><%= @article.title %></h2>
68
+
69
+ <%= markdown @article.body %>
70
+
71
+ Voila: Markdown enhanced blogging.
72
+
73
+ ### HTML Safety
74
+
75
+ Alas, the simplistic approach above may expose you to the dangers of unescaped
76
+ HTML input from users. The following rewrite of the `markdown` helper method
77
+ as two methods provides both a way to escape any HTML in the input Markdown
78
+ text and a way to leave HTML unescaped when you trust the source of the
79
+ Markdown text and want to allow HTML to pass through unmolested:
80
+
81
+ module ApplicationHelper
82
+ # whatever other helper methods you've defined
83
+
84
+ # use this for input you do not trust
85
+ def markdown text
86
+ RedRug.to_html(h text).html_safe
87
+ end
88
+
89
+ # use this for input you trust, if you really really must
90
+ def septic_markdown text
91
+ RedRug.to_html(text).html_safe
92
+ end
93
+ end
94
+
95
+ Since RedRug version 0.3.0, you have another alternative that relies on
96
+ Redcarpet's own HTML escaping capabilities. If you wish to use that instead of
97
+ the Rails `h` helper, you can do this with the HTML-escaped version of your
98
+ RedRug-based Markdown helper:
99
+
100
+ module ApplicationHelper
101
+ # . . .
102
+
103
+ def markdown text
104
+ RedRug.to_html(text, escape_html: true).html_safe
105
+ end
106
+
107
+ # . . .
108
+ end
109
+
110
+ ## Library Usage
111
+
112
+ At this time, the RedRug module provides a very simple API for translating
113
+ Markdown into HTML. The basic use case examples are as follows:
114
+
115
+ require 'red_rug'
116
+
117
+ RedRug.from_file '/path/to/filename.md'
118
+
119
+ RedRug.to_html <<END
120
+ # This Is A Markdown Heading
121
+
122
+ This is how paragraphs look in Markdown.
123
+ END
124
+
125
+ ## Command Line Usage
126
+
127
+ The redrug gem provides a `redrug` command line utility that takes a Markdown
128
+ formatted file as input and translates it into HTML, dumping the results to
129
+ standard output. The usual approach would be to use a redirect to send the
130
+ output to a persistent file instead:
131
+
132
+ $ redrug filename.md > filename.html
133
+
134
+ This translates the contents of a Markdown formatted file, `filename.md`, into
135
+ HTML, then writes that HTML into a file called `filename.html`.
136
+
137
+ It can also accept Markdown from standard input, so commands such as the
138
+ following examples should also work:
139
+
140
+ $ cat file1.md file2.md file3.md | redrug > filename.html
141
+ $ redrug < filename.md > filename.html
142
+
143
+ The usual Unix pipeline rules apply.
144
+
145
+ As of RedRug version 0.3.0, the `redrug` utility also accepts a command line
146
+ option for escaping HTML before parsing Markdown:
147
+
148
+ $ redrug -e filename.md
149
+
150
+ Simply put, `-e` employs Redcarpet's `:html_escape` parsing option to escape
151
+ HTML before parsing any Markdown. Otherwise, the behavior of the `redrug`
152
+ utility has not changed.
153
+
154
+ ## Bugs And Feature Requests
155
+
156
+ To file a bug report, feature request, or other issue, please log in as
157
+ "anonymous" using the temporary password provided on the login page, then click
158
+ the Tickets link and select New Ticket. Select the appropriate issue type
159
+ before submitting.
160
+
161
+ ## Other
162
+
163
+ For more information, see either the [redrug project page][redrug] or the
164
+ [redrug Rubygems page][rubygem].
165
+
166
+ [redrug]: http://fossrec.com/u/apotheon/redrug
167
+ [rubygem]: http://rubygems.org/gems/redrug
data/bin/redrug CHANGED
@@ -8,19 +8,19 @@ help_text = {
8
8
  version: 'Display version and license information.'
9
9
  }
10
10
 
11
- @usage = <<EOF
11
+ @usage = <<-EOF
12
12
 
13
- USAGE: #{File.basename $0} [options] FILE
13
+ USAGE: #{File.basename $0} [options] FILE
14
14
 
15
- This utility reads the contents of a Markdown formatted FILE, translates them
16
- to HTML, and prints the translated text to standard output.
15
+ This utility reads the contents of a Markdown formatted FILE, translates them
16
+ to HTML, and prints the translated text to standard output.
17
17
 
18
18
  EOF
19
19
 
20
- version_help = <<EOF
20
+ version_help = <<-EOF
21
21
 
22
- RedRug #{RedRug.version}, Copyright 2012 Chad Perrin
23
- May be distributed under the terms of the Open Works License.
22
+ RedRug #{RedRug.version}, Copyright 2012 Chad Perrin
23
+ It may be distributed under the terms of the Open Works License.
24
24
 
25
25
  EOF
26
26
 
@@ -49,4 +49,4 @@ content = String.new
49
49
 
50
50
  $<.each {|line| content << line }
51
51
 
52
- puts RedRug.to_html(content, options)
52
+ puts RedRug.to_html content, options
data/coil.txt ADDED
@@ -0,0 +1,30 @@
1
+ # Copyfree Open Innovation License
2
+
3
+ This is version 0.6 of the Copyfree Open Innovation License.
4
+
5
+ ## Terms and Conditions
6
+
7
+ Redistributions, modified or unmodified, in whole or in part, must retain
8
+ applicable notices of copyright or other legal privilege, these conditions, and
9
+ the following license terms and disclaimer. Subject to these conditions, each
10
+ holder of copyright or other legal privileges, author or assembler, and
11
+ contributor of this work, henceforth "licensor", hereby grants to any person
12
+ who obtains a copy of this work in any form:
13
+
14
+ 1. Permission to reproduce, modify, distribute, publish, sell, sublicense, use,
15
+ and/or otherwise deal in the licensed material without restriction.
16
+
17
+ 2. A perpetual, worldwide, non-exclusive, royalty-free, gratis, irrevocable
18
+ patent license to make, have made, provide, transfer, import, use, and/or
19
+ otherwise deal in the licensed material without restriction, for any and all
20
+ patents held by such licensor and necessarily infringed by the form of the work
21
+ upon distribution of that licensor's contribution to the work under the terms
22
+ of this license.
23
+
24
+ NO WARRANTY OF ANY KIND IS IMPLIED BY, OR SHOULD BE INFERRED FROM, THIS LICENSE
25
+ OR THE ACT OF DISTRIBUTION UNDER THE TERMS OF THIS LICENSE, INCLUDING BUT NOT
26
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
27
+ AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, ASSEMBLERS, OR HOLDERS OF
28
+ COPYRIGHT OR OTHER LEGAL PRIVILEGE BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
29
+ LIABILITY, WHETHER IN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM, OUT
30
+ OF, OR IN CONNECTION WITH THE WORK OR THE USE OF OR OTHER DEALINGS IN THE WORK.
File without changes
data/lib/red_rug.rb CHANGED
@@ -18,7 +18,7 @@ module RedRug
18
18
  @version = {
19
19
  :major => 0,
20
20
  :minor => 3,
21
- :revision => 0
21
+ :revision => 2
22
22
  }
23
23
 
24
24
  =begin rdoc
data/spec/red_rug_spec.rb CHANGED
@@ -1,4 +1,6 @@
1
+ require 'rspec'
1
2
  load '../lib/red_rug.rb'
3
+
2
4
  RSpec.describe RedRug do
3
5
  describe 'to_html' do
4
6
  it 'returns HTML equivalent of Markdown input' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redrug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Perrin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-19 00:00:00.000000000 Z
11
+ date: 2021-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet
@@ -48,14 +48,16 @@ extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
50
  - COPYING
51
- - LICENSE
52
- - README
51
+ - README.md
53
52
  - bin/redrug
53
+ - coil.txt
54
+ - dpl.txt
54
55
  - lib/red_rug.rb
55
56
  - spec/red_rug_spec.rb
56
57
  - spec/spec_helper.rb
57
58
  homepage: http://fossrec.com/u/apotheon/redrug
58
59
  licenses:
60
+ - COIL
59
61
  - DPL
60
62
  metadata: {}
61
63
  post_install_message: |2
@@ -77,8 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
79
  - !ruby/object:Gem::Version
78
80
  version: '0'
79
81
  requirements: []
80
- rubyforge_project:
81
- rubygems_version: 2.4.5
82
+ rubygems_version: 3.1.4
82
83
  signing_key:
83
84
  specification_version: 4
84
85
  summary: RedRug - Simple Markdown Interface
data/README DELETED
@@ -1,17 +0,0 @@
1
- # redrug
2
-
3
- The redcarpet library can be a bit cumbersome to use, and redrug aims to
4
- rectify this problem by wrapping it with simpler interfaces for common use
5
- cases.
6
-
7
- ## Command Line Usage
8
-
9
- The redrug gem provides a `redrug` command line utility that takes a Markdown
10
- formatted file as input and translates it into HTML, dumping the results to
11
- standard output. The usual approach would be to use a redirect to send the
12
- output to a persistent file instead:
13
-
14
- $ redrug filename.md > filename.html
15
-
16
- This translates the contents of a Markdown formatted file, `filename.md`, into
17
- HTML, then writes that HTML into a file called `filename.html`.