mandown 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,10 +5,12 @@ README.txt
5
5
  Rakefile
6
6
  bin/bibdown
7
7
  bin/mandown-sample
8
+ bin/secdown
8
9
  config/hoe.rb
9
10
  config/requirements.rb
10
11
  lib/bibdown_lib.rb
11
12
  lib/mandown.rb
13
+ lib/secdown_lib.rb
12
14
  lib/mandown/version.rb
13
15
  log/debug.log
14
16
  script/destroy
@@ -21,6 +23,7 @@ tasks/website.rake
21
23
  test/test_helper.rb
22
24
  test/test_mandown.rb
23
25
  test/test_bibdown.rb
26
+ test/test_secdown.rb
24
27
  website/index.html
25
28
  website/index.txt
26
29
  website/javascripts/rounded_corners_lite.inc.js
@@ -5,7 +5,7 @@
5
5
  def sample
6
6
  <<END
7
7
  Lethal Injection Is Not Humane
8
- ==============================
8
+
9
9
 
10
10
  The PLoS Medicine Editors
11
11
 
@@ -17,8 +17,16 @@ Copyright: © 2007 The PLoS Medicine Editors. This is an open-access article dis
17
17
 
18
18
  E-mail: medicine_editors@plos.org
19
19
 
20
+ Note: This manuscript has been modified slightly to be processed using the Mandown tools and to illustrate Mandown features. As a result the original meaning of the article may be altered slightly (e.g. the introduction of sections may place emphasis in a way that the original authors did not intend), but I have tried hard not to alter the meaning of the text. Please refer to the original article at PLoS Medicine.
21
+
22
+ Introduction
23
+ ============
24
+
20
25
  This month's issue of PLoS Medicine contains a research article on three protocols used in lethal injection, the current method of execution for most US states. Despite the British Royal Commission on Capital Punishment advising against lethal injection half a century ago cite:Emanuel, the United Nations General Assembly affirming the desirability of abolishing the death penalty in 1971, and the European Union explicitly banning the death penalty in all circumstances cite:EU, execution—predominantly by lethal injection—is still practiced in many countries. During 2005 at least 2,148 people were executed in 22 countries in cases recorded by Amnesty International; the actual numbers were certainly higher. The majority of these executions took place in China, where fleets of mobile execution vans have been deployed to facilitate prompt, low-profile executions by lethal injection. Iran, Saudi Arabia, and the US together with China accounted for 94% of executions in 2005 cite:AmInt.
21
26
 
27
+ Lethal Injection in the US
28
+ ==========================
29
+
22
30
  Following its introduction to the US in 1982, lethal injection became the primary method of execution there, largely replacing execution by hanging, firing squad, gas chamber, and electrocution. Each of these older methods has come to be seen as inhumane or excessively violent by most states, but each remains an option in a handful of others. Of the 53 executions in the US in 2006, all but one (an electrocution) were carried out using lethal injection cite:DPIC.
23
31
 
24
32
  In recent months, concerns over botched lethal injections have put the method on hold in a dozen or so of the 36 US states that have the death penalty. Following a particularly agonizing execution in December 2006, the US District Court ruled that California's lethal injection protocol was unconstitutional. The governors of Florida and Tennessee suspended executions pending review of their states' lethal injection protocols. A court ruling in December 2006 suspended Maryland's executions, and New Jersey is considering an outright ban on its death penalty following a 2004 court order requiring the state to justify its lethal injection process. Executions are on hold in several other states pending legal proceedings cite:DPIC.
@@ -35,6 +43,9 @@ Apart from the issue of whether humane execution can exist, we must also conside
35
43
 
36
44
  We support the recent decision of Craig Watkins, the new district attorney of Dallas, Texas, to examine hundreds of cases over the past 30 years to see whether DNA tests might reveal wrongful convictions cite:McGonigle. Such errors are inevitable when an implicit goal of sentencing, and particularly of imposing the death penalty, is not rational but emotional: the desire for revenge. As one law professor stated in a recent New York Times Magazine article on lethal injection, “Retribution, the conscious affliction of pain and suffering because and only because some people deserve it, is the essence of punishment” cite:Weil. But if the personal satisfaction of seeing criminals “get what they deserve” really reflects the intentions of Americans, why has the US seen a transition away from firing squads, hanging, or even drawing and quartering? Why was capital punishment illegal for a decade until it was reinstated by a Supreme Court ruling in 1976? Why have some US states rejected the death penalty completely, and others suspended its use? Why has the US followed the course associated with totalitarian states and rejected by other democracies in this matter?
37
45
 
46
+ Conclusions
47
+ ===========
48
+
38
49
  Clearly, the death penalty is a matter of profound ambivalence in American society. Courts and state governments are saying that if capital punishment exists, it must not be cruel or visibly violent. Physicians and nurses are saying that their involvement in executions is below any acceptable conception of professional ethics. How to reconcile the needs of a society given to vengeance but outwardly abhorrent of cruelty or violence, trusting of medical science's trappings but indifferent to their use in killing, expecting the highest ethics of its physicians but willing to medicalize the execution chamber? The new data in PLoS Medicine will further strengthen the constitutional case for the abandonment of execution in the US. As a moral society, the US should take a leading role in the abandonment of executions worldwide.
39
50
 
40
51
  # Bibliography
@@ -0,0 +1,23 @@
1
+ #################### License ###################################################
2
+ #
3
+ # Copyright (c) 2008 Chris Rose
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ #
18
+ ################################################################################
19
+
20
+ require 'secdown_lib'
21
+
22
+ # Entry point
23
+ secdown_main
@@ -2,7 +2,7 @@ module Mandown #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 8
5
+ TINY = 9
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -0,0 +1,224 @@
1
+ #################### License ###################################################
2
+ #
3
+ # Copyright (c) 2008 Chris Rose
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ #
18
+ ################################################################################
19
+
20
+ # Define the text that is displayed when the user asks for documentation
21
+ def documentation
22
+ <<END
23
+
24
+
25
+ secdown --- part of the Mandown set of tools.
26
+
27
+ secdown processes standard input and inserts section numbers in titles.
28
+
29
+ Copyright © 2008 Chris Rose.
30
+ Distributed according to the GNU General Public License.
31
+
32
+ Usage:
33
+ ------
34
+ cat infile.txt | secdown > outfile.txt
35
+
36
+ Syntax:
37
+ -------
38
+
39
+ Standard Markdown provides two ways to indicate headings: the first style uses
40
+ '=' or '-' characters placed under the title (for first and second level
41
+ headings respectively); the second uses leading '#' characters, where the
42
+ number of '#' characters indicates the nesting level.
43
+
44
+ ------------------------------- Example -------------------------------------
45
+
46
+ This is a level 1 heading
47
+ =========================
48
+
49
+ This is a level 2 heading
50
+ -------------------------
51
+
52
+ # This is also a level 1 heading
53
+
54
+ ## This is also a level 2 heading
55
+
56
+ ## So is this
57
+
58
+ ### This is a level 3 heading
59
+
60
+ ### So is this
61
+
62
+ ------------------------------- End of example ------------------------------
63
+
64
+ secdown inserts heading numbers into headings. For example, the above example
65
+ would be given the following heading numbers (the actual result is not shown,
66
+ but this indicates the resulting numbering):
67
+
68
+ 1 This is a level 1 heading
69
+ 1.1 This is a level 2 heading
70
+ 2 This is also a level 1 heading
71
+ 2.1 This is also a level 2 heading
72
+ 2.2 So is this
73
+ 2.2.1 This is a level 3 heading
74
+ 2.2.2 So is this
75
+
76
+ secdown outputs all headings in the '#'-based style, irrespective of the input
77
+ style.
78
+
79
+ secdown does not insert a heading number for '# Bibliography'.
80
+
81
+ See also:
82
+ ---------
83
+
84
+ Markdown -- http://daringfireball.net/projects/markdown/
85
+ Pandoc -- http://johnmacfarlane.net/pandoc/
86
+
87
+ END
88
+ end
89
+
90
+
91
+ # Return true if the string contains an atx-style header and false otherwise.
92
+ def atx_header?(line)
93
+ if /#+ \w*/.match(line).nil?
94
+ false
95
+ else
96
+ true
97
+ end
98
+ end
99
+
100
+ # Given an atx-style header string of the form '# Something ...' or '##
101
+ # Something ...', return an integer that indicates the nesting level; '#'
102
+ # would be level 1, '##' would be level 2, etc. Returns 0 if the text is not
103
+ # an atx-style header.
104
+ def get_atx_nesting_level(atx_header)
105
+ # Check that we have an atx header.
106
+ return 0 if !atx_header?(atx_header)
107
+ atx_header.split[0].length # Return the number of leading # characters.
108
+ end
109
+
110
+ # Given a string, return true if all the characters are equal to char, or
111
+ # false otherwise. Note that if the line ends with a newline, this will be
112
+ # ignored.
113
+ def all_chars?(line, char)
114
+ return false if line.nil?
115
+ line = line.strip
116
+ chars_array = line.split('').uniq
117
+ return true if chars_array.length == 1 && chars_array[0] == char
118
+ return false
119
+ end
120
+
121
+ # Given an array of strings, where the (i+1)-th string is the line that
122
+ # appears after the i-th line, convert setx-style headings (those that use
123
+ # underlining to indicate nesting level) to atx style (where a given number of
124
+ # # character are used). Return the resulting array of lines.
125
+ def setx_to_atx(lines)
126
+ ret_val = []
127
+ lines.each_index do |i|
128
+ # Get the next two lines, if there are, else quit looking.
129
+ if lines.length > i-2
130
+ this_line = lines[i]
131
+ next_line = lines[i+1]
132
+
133
+ if all_chars?(next_line, '=')
134
+ ret_val.push('# ' + this_line)
135
+ elsif all_chars?(next_line, '-')
136
+ ret_val.push('## ' + this_line)
137
+ elsif all_chars?(this_line, '-') || all_chars?(this_line, '=')
138
+ # Do nothing, but keep this condition in!
139
+ else
140
+ ret_val.push(this_line)
141
+ end
142
+ end
143
+ end
144
+ ret_val
145
+ end
146
+
147
+ # Given the nesting level of a header (e.g. 2, as returned by
148
+ # get_atx_nesting_level) and a string which specifies the previous heading
149
+ # nesting level (e.g. '1.2.1'), return the heading nesting level string for
150
+ # the header (e.g. '1.3', in this example).
151
+ def get_heading_level_string(current_nesting, previous_level)
152
+ if previous_level.split('.').length < current_nesting
153
+ # The case where we need to move to a deeper nesting level.
154
+ previous_level + '.1'
155
+ else
156
+ # The case where we need to remain at the current, or move up, a level.
157
+ t = previous_level.split('.')
158
+ t = t[0..current_nesting-1]
159
+ t[-1] = (t[-1].to_i + 1).to_s
160
+ t.join('.')
161
+ end
162
+ end
163
+
164
+ # Given a string that specifies the previous heading nesting level string
165
+ # (e.g. '1.3.1') and an atx-style header (e.g. '## Header'), return the next
166
+ # heading nesting level string (e.g. '## 1.4', in this example) and return it.
167
+ def get_next_level_string(previous, header)
168
+ # Get the level and the string to insert.
169
+ if previous == ''
170
+ '1'
171
+ else
172
+ get_heading_level_string(get_atx_nesting_level(header), previous)
173
+ end
174
+ end
175
+
176
+
177
+ # Given a string that specifies the level of a heading (e.g. '1.2.3' such as
178
+ # returned by get_next_level_string, for example), and an atx-style header
179
+ # string, insert the level string into the header and return it.
180
+ def insert_level_to_atx_header(level_string, header)
181
+ level = get_atx_nesting_level(header)
182
+ header[0..level-1] + ' ' + level_string + header[level..-1]
183
+ end
184
+
185
+
186
+ # Given an array of lines of text, insert appropriate leading section numbers,
187
+ # and return the resulting array. By default, ignore the bibliography line.
188
+ def insert_header_levels(lines, ignore_bibliography = true)
189
+ lines = setx_to_atx(lines) # Convert setx-style headers to atx-style.
190
+
191
+ current_level_string = '0'
192
+ ret_val = []
193
+ lines.each do |line|
194
+ if atx_header?(line) && /# Bibliography/.match(line) && ignore_bibliography
195
+ ret_val.push(line)
196
+ elsif atx_header?(line)
197
+ current_level_string = get_next_level_string(current_level_string, line)
198
+ ret_val.push(
199
+ insert_level_to_atx_header(current_level_string, line))
200
+ else
201
+ ret_val.push(line)
202
+ end
203
+ end
204
+ ret_val
205
+ end
206
+
207
+
208
+ # Read the manuscript from standard input and insert appropriately nested level numbering (e.g. '2.1') and send the result to standard output.
209
+ def secdown_main
210
+ # Handle request for documentation.
211
+ if ARGV.length > 0 && ARGV[0] == '--help'
212
+ puts documentation
213
+ exit
214
+ end
215
+
216
+ # Read the file from standard input.
217
+ lines = STDIN.readlines
218
+
219
+ # Insert the level numbers.
220
+ manuscript = insert_header_levels(lines)
221
+
222
+ # Send the processed manuscript to standard output.
223
+ STDOUT.puts(manuscript)
224
+ end
@@ -0,0 +1,149 @@
1
+ #################### License ###################################################
2
+ #
3
+ # Copyright (c) 2008 Chris Rose
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ #
18
+ ################################################################################
19
+
20
+ require File.dirname(__FILE__) + '/test_helper.rb'
21
+ require File.dirname(__FILE__) + '/../lib/secdown_lib'
22
+
23
+ class TestSecdown < Test::Unit::TestCase
24
+
25
+ def setup
26
+ end
27
+
28
+ def test_atx_header?
29
+ assert_equal(true, atx_header?('# This is a header'))
30
+ assert_equal(true, atx_header?('## This is a header'))
31
+ assert_equal(true, atx_header?('#### This is a header'))
32
+ assert_equal(false, atx_header?('This is not a header'))
33
+ assert_equal(false, atx_header?(''))
34
+ end
35
+
36
+ def test_get_atx_nesting_level
37
+ assert_equal(0, get_atx_nesting_level('This is not a header.'))
38
+ assert_equal(1, get_atx_nesting_level('# This is a level 1 header'))
39
+ assert_equal(2, get_atx_nesting_level('## This is a level 2 header'))
40
+ assert_equal(3, get_atx_nesting_level('### This is a level 3 header'))
41
+ assert_equal(4, get_atx_nesting_level('#### This is a level 4 header'))
42
+ assert_equal(5, get_atx_nesting_level('##### This is a level 5 header'))
43
+ assert_equal(6, get_atx_nesting_level('###### This is a level 6 header'))
44
+ end
45
+
46
+ def test_all_chars?
47
+ assert_equal(true, all_chars?('======', '='))
48
+ assert_equal(false, all_chars?('== Hello', '='))
49
+ assert_equal(false, all_chars?('=======', '-'))
50
+ end
51
+
52
+ def test_setx_to_atx
53
+ source = [
54
+ "This is just a line.",
55
+ "",
56
+ "This is a level 1 header",
57
+ "==========================",
58
+ "",
59
+ "This is a level 2 header",
60
+ "--------------------------",
61
+ "",
62
+ "And this is some text."]
63
+ expected = [
64
+ "This is just a line.",
65
+ "",
66
+ "# This is a level 1 header",
67
+ "",
68
+ "## This is a level 2 header",
69
+ "",
70
+ "And this is some text."]
71
+
72
+ assert_equal(expected, setx_to_atx(source))
73
+ end
74
+
75
+ def test_get_heading_level_string
76
+ assert_equal('1.1', get_heading_level_string(2, '1'))
77
+ assert_equal('3', get_heading_level_string(1, '2.1'))
78
+ assert_equal('2.2', get_heading_level_string(2, '2.1'))
79
+ assert_equal('2.1.3', get_heading_level_string(3, '2.1.2'))
80
+ assert_equal('3', get_heading_level_string(1, '2.1.1'))
81
+ end
82
+
83
+ def test_get_next_level_string
84
+ assert_equal('2', get_next_level_string('1', '# Level 1 header'))
85
+ assert_equal('1.1', get_next_level_string('1', '## Level 1.1 header'))
86
+ assert_equal('2.2', get_next_level_string('2.1', '## Level 2.2 header'))
87
+ assert_equal('2.1.3', get_next_level_string('2.1.2', '### A 2.1.3 header'))
88
+ end
89
+
90
+ def test_insert_level_to_atx_header
91
+ assert_equal('# 1 Title', insert_level_to_atx_header('1', '# Title'))
92
+ end
93
+
94
+ def test_insert_header_levels
95
+ source = [
96
+ "This is just a line.",
97
+ "",
98
+ "This is a level 1 header",
99
+ "========================",
100
+ "",
101
+ "## This is a level 2 header",
102
+ "",
103
+ "# This is another title",
104
+ "",
105
+ "And this is some text",
106
+ "",
107
+ "Another header",
108
+ "--------------",
109
+ "",
110
+ "More text",
111
+ "",
112
+ "## Yet another header."]
113
+ expected = [
114
+ "This is just a line.",
115
+ "",
116
+ "# 1 This is a level 1 header",
117
+ "",
118
+ "## 1.1 This is a level 2 header",
119
+ "",
120
+ "# 2 This is another title",
121
+ "",
122
+ "And this is some text",
123
+ "",
124
+ "## 2.1 Another header",
125
+ "",
126
+ "More text",
127
+ "",
128
+ "## 2.2 Yet another header."]
129
+ assert_equal(expected, insert_header_levels(source))
130
+
131
+ source = [
132
+ "This is a heading",
133
+ "=================",
134
+ "",
135
+ "And this is some text."]
136
+ expected = [
137
+ "# 1 This is a heading",
138
+ "",
139
+ "And this is some text."]
140
+ assert_equal(expected, insert_header_levels(source))
141
+
142
+ # Test that it ignores bibliography headings by default.
143
+ bib_line = ["# Bibliography"]
144
+ assert_equal(bib_line, insert_header_levels(bib_line))
145
+
146
+ end
147
+
148
+
149
+ end
@@ -5,7 +5,7 @@
5
5
  <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
7
  <title>
8
- &#x2192; &#8216;mandown&#8217;
8
+ Academic writing extensions to Markdown
9
9
  </title>
10
10
  <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
11
  <style>
@@ -30,12 +30,12 @@
30
30
  <body>
31
31
  <div id="main">
32
32
 
33
- <h1>&#x2192; &#8216;mandown&#8217;</h1>
33
+ <h1>Academic writing extensions to Markdown</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/mandown"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/mandown" class="numbers">0.0.8</a>
36
+ <a href="http://rubyforge.org/projects/mandown" class="numbers">0.0.9</a>
37
37
  </div>
38
- <h1>Academic writing extensions to Markdown</h1>
38
+ <h1>&#x2192; &#8216;mandown&#8217;</h1>
39
39
 
40
40
 
41
41
  <h2>What</h2>
@@ -70,7 +70,7 @@
70
70
 
71
71
  <pre>sudo gem install mandown</pre>
72
72
 
73
- <p>If you are confused already, read the <a href="http://rubygems.org/read/chapter/1#page1">Really Quick Start guide</a> from the RubyGems user guide and note that you may or may not need the <a href="http://en.wikipedia.org/wiki/Sudo">sudo</a> command (it&#8217;s necessary on Mac <span class="caps">OS X</span>).</p>
73
+ <p>If you are confused already, read the <a href="http://rubygems.org/read/chapter/1#page1">Really Quick Start guide</a> from the RubyGems user guide and note that you may or may not need the <a href="http://en.wikipedia.org/wiki/Sudo">sudo</a> command (it&#8217;s necessary on Mac <span class="caps">OS X</span>); on some systems you might need to become the super user first by running the <code>su</code> command and entering the super user&#8217;s password, and then running <code>gem install mandown</code>.</p>
74
74
 
75
75
 
76
76
  <p>This will add the Mandown executables (executable Ruby scripts) to your $PATH, which include the following: bibdown.</p>
@@ -79,6 +79,19 @@
79
79
  <p>You will also need to install a suitable Markdown processor; I recommend <a href="http://johnmacfarlane.net/pandoc/">Pandoc</a> which can convert Markdown to multiple output formats, including <span class="caps">RTF</span> which can be opened using Microsoft Word.</p>
80
80
 
81
81
 
82
+ <h2>The tools</h2>
83
+
84
+
85
+ <p>The following Mandown tools are provided in the latest release:</p>
86
+
87
+
88
+ <ul>
89
+ <li><code>bibdown</code> Cite publications and build a bibliography.</li>
90
+ <li><code>secdown</code> Automatically insert section numbers.</li>
91
+ <li><code>mandown-sample</code> Output a sample Mandown source document.</li>
92
+ </ul>
93
+
94
+
82
95
  <h2>Usage</h2>
83
96
 
84
97
 
@@ -144,12 +157,9 @@ for academic applications).</p>
144
157
  <p>The Mandown tools are designed to be chained together into a pipeline, so for example you might do:</p>
145
158
 
146
159
 
147
- <pre>cat my-manu.txt | bibdown | eqndown | secdown &gt; my-manu-out.txt</pre>
160
+ <pre>cat my-manu.txt | bibdown | secdown &gt; my-manu-out.txt</pre>
148
161
  <pre>pandoc ...</pre>
149
162
 
150
- <p>Note: only bibdown is currently implemented.</p>
151
-
152
-
153
163
  <h2>Help, gotchas and <span class="caps">FAQ</span></h2>
154
164
 
155
165
 
@@ -207,7 +217,7 @@ for academic applications).</p>
207
217
 
208
218
  <p>This code is distributed according to the terms of the <span class="caps">GNU</span> General Public License; see the file <code>COPYING</code> for full details.</p>
209
219
  <p class="coda">
210
- <a href="mandown@microserf.org.uk">Chris Rose</a>, 15th January 2008<br>
220
+ <a href="mandown@microserf.org.uk">Chris Rose</a>, 18th January 2008<br>
211
221
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
212
222
  </p>
213
223
  </div>
@@ -1,7 +1,7 @@
1
- h1. &#x2192; 'mandown'
2
-
3
1
  h1. Academic writing extensions to Markdown
4
2
 
3
+ h1. &#x2192; 'mandown'
4
+
5
5
  h2. What
6
6
 
7
7
  Mandown provides simple extensions to the "Markdown":http://daringfireball.net/projects/markdown/ syntax that are useful for academic writing.
@@ -26,12 +26,20 @@ Mandown is distributed as a Ruby gem (so you'll need Ruby and RubyGems installed
26
26
 
27
27
  <pre>sudo gem install mandown</pre>
28
28
 
29
- If you are confused already, read the "Really Quick Start guide":http://rubygems.org/read/chapter/1#page1 from the RubyGems user guide and note that you may or may not need the "sudo":http://en.wikipedia.org/wiki/Sudo command (it's necessary on Mac OS X).
29
+ If you are confused already, read the "Really Quick Start guide":http://rubygems.org/read/chapter/1#page1 from the RubyGems user guide and note that you may or may not need the "sudo":http://en.wikipedia.org/wiki/Sudo command (it's necessary on Mac OS X); on some systems you might need to become the super user first by running the <code>su</code> command and entering the super user's password, and then running <code>gem install mandown</code>.
30
30
 
31
31
  This will add the Mandown executables (executable Ruby scripts) to your $PATH, which include the following: bibdown.
32
32
 
33
33
  You will also need to install a suitable Markdown processor; I recommend "Pandoc":http://johnmacfarlane.net/pandoc/ which can convert Markdown to multiple output formats, including RTF which can be opened using Microsoft Word.
34
34
 
35
+ h2. The tools
36
+
37
+ The following Mandown tools are provided in the latest release:
38
+
39
+ * <code>bibdown</code> Cite publications and build a bibliography.
40
+ * <code>secdown</code> Automatically insert section numbers.
41
+ * <code>mandown-sample</code> Output a sample Mandown source document.
42
+
35
43
 
36
44
  h2. Usage
37
45
 
@@ -82,11 +90,9 @@ You could now open the <code>manuscript.rtf</code> file using an application lik
82
90
 
83
91
  The Mandown tools are designed to be chained together into a pipeline, so for example you might do:
84
92
 
85
- <pre>cat my-manu.txt | bibdown | eqndown | secdown > my-manu-out.txt</pre>
93
+ <pre>cat my-manu.txt | bibdown | secdown > my-manu-out.txt</pre>
86
94
  <pre>pandoc ...</pre>
87
95
 
88
- Note: only bibdown is currently implemented.
89
-
90
96
 
91
97
 
92
98
  h2. Help, gotchas and FAQ
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: mandown
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.8
7
- date: 2008-01-15 00:00:00 +00:00
6
+ version: 0.0.9
7
+ date: 2008-01-18 00:00:00 +00:00
8
8
  summary: Provides simple extensions to Markdown that are useful for academic writing
9
9
  require_paths:
10
10
  - lib
@@ -36,10 +36,12 @@ files:
36
36
  - Rakefile
37
37
  - bin/bibdown
38
38
  - bin/mandown-sample
39
+ - bin/secdown
39
40
  - config/hoe.rb
40
41
  - config/requirements.rb
41
42
  - lib/bibdown_lib.rb
42
43
  - lib/mandown.rb
44
+ - lib/secdown_lib.rb
43
45
  - lib/mandown/version.rb
44
46
  - log/debug.log
45
47
  - script/destroy
@@ -52,6 +54,7 @@ files:
52
54
  - test/test_helper.rb
53
55
  - test/test_mandown.rb
54
56
  - test/test_bibdown.rb
57
+ - test/test_secdown.rb
55
58
  - website/index.html
56
59
  - website/index.txt
57
60
  - website/javascripts/rounded_corners_lite.inc.js
@@ -61,6 +64,7 @@ test_files:
61
64
  - test/test_bibdown.rb
62
65
  - test/test_helper.rb
63
66
  - test/test_mandown.rb
67
+ - test/test_secdown.rb
64
68
  rdoc_options:
65
69
  - --main
66
70
  - README.txt
@@ -72,6 +76,7 @@ extra_rdoc_files:
72
76
  executables:
73
77
  - bibdown
74
78
  - mandown-sample
79
+ - secdown
75
80
  extensions: []
76
81
 
77
82
  requirements: []