ron 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,136 @@
1
+ ron(1) -- the opposite of roff
2
+ ==============================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `ron` [ _OPTIONS_ ]
7
+ `ron` --build _FILE_ ...
8
+ `ron` --install _FILE_ ...
9
+ `ron` --man _FILE_
10
+
11
+ ## DESCRIPTION
12
+
13
+ `Ron` is a humane text format and toolchain for authoring man pages
14
+ (and things that appear as man pages from a distance). Use it to build
15
+ and install standard UNIX / roff(7) formatted man pages and to
16
+ generate nicely formatted HTML manual pages.
17
+
18
+ The `ron` command converts one or more named input <em>FILE</em>s
19
+ (or standard input when no files are named or the file name `-`
20
+ is given) from humane man page markup to one or more destination
21
+ output formats. If no output format is selected explicitly, `ron`
22
+ writes output in roff format.
23
+
24
+ ## FILES
25
+
26
+ The `ron` command expects input to be formatted as ron(5) text.
27
+ Source files are typically named '_name_._section_.ron' (e.g.,
28
+ `hello.1.ron`). The _name_ and _section_ should match the name
29
+ and section defined in _FILE_'s heading.
30
+
31
+ When building roff and/or HTML output files with the `--build`
32
+ argument, destination filenames are determined by taking the basename
33
+ of the input _FILE_ and adding the appropriate file extension (or
34
+ removing the file extension in the case of roff output).
35
+
36
+ For example, the command `ron -b --html --roff hello.1.ron` would
37
+ generate a `hello.1` file with roff output and a `hello.1.html` file
38
+ with HTML output.
39
+
40
+ ## OPTIONS
41
+
42
+ `Ron`'s default mode of operation is to read a single document from
43
+ standard input and to write the generated output to standard output.
44
+ The following arguments change this behavior:
45
+
46
+ * `-b`, `--build`:
47
+ Write output directly to files instead of standard output. When
48
+ the `--roff` option is provided, writes roff output to
49
+ _file_._section_. When the `--html` option is provided, writes
50
+ output to '_file_._section_.html'.
51
+
52
+ * `-i`, `--install`:
53
+ Install the roff formatted man page to the local system such
54
+ that it can be displayed by man(1). The `MANHOME`
55
+ environment variable is used to determine the prefix where
56
+ man pages should be installed when defined.
57
+
58
+ If `MANHOME` is not defined, `ron` installs man pages to
59
+ _/usr/local/man_.
60
+
61
+ * `-m`, `--man`:
62
+ Display _FILE_ as if man(1) were invoked on the roff output
63
+ file. This simulates default man behavior by piping the roff
64
+ output through groff(1) and the paging program specified by the
65
+ `MANPAGER` environment variable.
66
+
67
+ The following options control the output formats generated:
68
+
69
+ * `--html`:
70
+ Generate HTML output.
71
+
72
+ * `--roff`:
73
+ Generate roff output. This is the default behavior when no
74
+ other format argument is provided.
75
+
76
+ ## EXAMPLES
77
+
78
+ Generate `roff(7)` output on stdout:
79
+
80
+ $ ron < hello.1.ron
81
+
82
+ Build a roff file based on the input filename:
83
+
84
+ $ ron -b hello.1.ron
85
+ building: hello.1
86
+ $ man hello.1
87
+
88
+ Build and open a standalone HTML file based on the input filename:
89
+
90
+ $ ron -b --html test.1.ron
91
+ $ open test.1.html
92
+
93
+ Build roff and HTML versions of all `.ron` files in the current
94
+ directory:
95
+
96
+ $ ron -b --roff --html *.ron
97
+ building: hello.1
98
+ building: hello.1.html
99
+ building: world.1
100
+ building: world.1.html
101
+
102
+ View a ron file in the same way as man(1) without building a roff
103
+ file:
104
+
105
+ $ ron -m hello.1.ron
106
+
107
+ Install the roff man page for a ron file:
108
+
109
+ $ ron -i hello.1.ron
110
+
111
+ ## ENVIRONMENT
112
+
113
+ * `MANHOME`:
114
+ Location where roff formatted man pages should be installed.
115
+ Relevant only when the `--installed` argument is provided.
116
+ _PATH_ is to the base of a man file hierarchy. e.g.,
117
+ `/usr/local/share/man`, `/home/rtomayko/man`.
118
+
119
+ * `MANPAGER`:
120
+ The paging program used for man pages. This is typically set
121
+ to something like 'less -is'.
122
+
123
+ * `PAGER`:
124
+ Used instead of `MANPAGER` when `MANPAGER` is not defined.
125
+
126
+ ## BUGS
127
+
128
+ Ron is written in Ruby.
129
+
130
+ ## COPYRIGHT
131
+
132
+ `ron` is Copyright (C) 2009 Ryan Tomayko <tomayko.com/about>
133
+
134
+ ## SEE ALSO
135
+
136
+ ron(5), markdown(5), manpages(5), man(1), roff(7), groff(1)
@@ -0,0 +1,150 @@
1
+ ron(5) -- humane manual page authoring format
2
+ =============================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ name(1) -- one sentence description
7
+ ===================================
8
+
9
+ ## SECTION HEADING
10
+
11
+ A normal paragraph. This can span multiple lines and is
12
+ terminated with two or more line endings -- just like
13
+ Markdown.
14
+
15
+ ## INLINE MARKUP
16
+
17
+ Inline markup should be used for `code` (displayed in
18
+ boldface) and _variables_ (displayed in underline).
19
+
20
+ Manual page references like sh(1), markdown(5), roff(7), etc.
21
+ are displayed in boldface and hyperlinked in HTML output.
22
+
23
+ ## DEFINITION LISTS
24
+
25
+ Definition lists are used to define arguments, variables,
26
+ or other terms:
27
+
28
+ * `-a`, `--arg1`=[_OPTION_]:
29
+ One or more paragraphs describing the
30
+ * `-b`, `--arg2`:
31
+ Any number of these may be specified and they can be
32
+ nested.
33
+
34
+ ## DESCRIPTION
35
+
36
+ `Ron` files are simple ascii texts that document things in the
37
+ style of UNIX man pages but with a syntax and feature-set less
38
+ insane than that of roff(7). `Ron` files are piped through
39
+ ron(1) to build and install traditional roff(7) man pages or
40
+ to generate hyperlinked HTML documentation.
41
+
42
+ All `ron` files must conform to a simple subset of markdown(5), a
43
+ humane text markup designed for writing on the web. It is neither
44
+ possible nor desirable to express many of roff(7)'s complex
45
+ typesetting features in `ron`.
46
+
47
+ ## MANPAGE TITLE
48
+
49
+ All man pages have a _name_, belong to a _section_, and have a
50
+ single sentence _tagline_ (useless but witty, preferably). `Ron`
51
+ files must begin with a first-level heading that includes all of
52
+ this information. For example, this very man page begins:
53
+
54
+ ron(5) -- humane manual page authoring format
55
+ =============================================
56
+
57
+ Here, we're saying that the man page documents a thing named `ron`
58
+ in manual section `5` -- the "file formats" section; see
59
+ manpages(5) for full section list -- and that's quickly
60
+ described as a "humane manual page authoring format".
61
+
62
+ These bits of information are used to fill in the document
63
+ header, to create the `NAME` section, and also to establish
64
+ output filenames when processed with ron(1).
65
+
66
+ ## SECTION HEADINGS
67
+
68
+ Man section headings are expressed with markdown level two
69
+ headings. markdown(5) provides two syntaxes for level two
70
+ headings. A hash prefix syntax:
71
+
72
+ ## HEADING TEXT
73
+
74
+ Or, a dash underline syntax:
75
+
76
+ HEADING TEXT
77
+ ------------
78
+
79
+ Section headings should be in all uppercase and may not contain
80
+ other inline markup.
81
+
82
+ Most manual pages include at least one of the `SYNOPSIS`,
83
+ `DESCRIPTION`, and/or `OPTIONS` sections. Additional sections
84
+ commonly included are `SYNTAX`, `ENVIRONMENT`, `HISTORY`, `RETURN
85
+ VALUES`, `BUGS`, `SECURITY CONSIDERATIONS`, `STANDARDS` /
86
+ `CONFORMING TO`, `AUTHOR`, and `COPYRIGHT`. Finally, most man
87
+ pages end with a `SEE ALSO` section that references other manual
88
+ pages and external documents.
89
+
90
+ ## INLINE MARKUP
91
+
92
+ Man pages typically use a limited set of text formatting
93
+ capabilities. There's basically <b>boldface</b> and
94
+ <i>italics</i> (often displayed using <u>underline</u>). Ron
95
+ uses the following bits of markdown(5) to accomplish this:
96
+
97
+ * <code>\`backticks\`</code>:
98
+ Code, flags, commands, and noun-like things; typically
99
+ displayed in in <b>boldface</b>. Note that all text included
100
+ within `backticks` is displayed literally; other inline markup
101
+ is not processed.
102
+ * `_`_underbars_`_`:
103
+ User-specified arguments, variables, or user input; typically
104
+ displayed in <u>underline</u>.
105
+ * `**double stars**`:
106
+ Like `backticks` but may contain other inline markup.
107
+
108
+ Here is grep(1)'s DESCRIPTION section represented in `ron`:
109
+
110
+ `Grep` searches the named input _FILE_ (or standard input if
111
+ no files are named, or the file name `-` is given) for lines
112
+ containing a match to the given _PATTERN_. By default, `grep`
113
+ prints the matching lines.
114
+
115
+ ## DEFINITION LISTS
116
+
117
+ Because definition lists are so often used in manual pages to
118
+ describe arguments, options, and variables, the basic markdown(5)
119
+ list syntax has been extended to support a definition list
120
+ syntax.
121
+
122
+ A definition list's syntax is exactly the same as markdown(5)'s
123
+ unordered list syntax but requires that the first line of each
124
+ list item be terminated with a colon "`:`". The first line
125
+ (minus the colon) is the _term_; subsequent lines may be
126
+ comprised of multiple paragraphs, code blocks, standard lists,
127
+ and nested definition lists.
128
+
129
+ An example definition list, taken from test(1)'s `DESCRIPTION`
130
+ section:
131
+
132
+ The following primaries are used to construct expressions:
133
+
134
+ * `-b` _file_:
135
+ True if _file_ exists and is a block special file.
136
+
137
+ * `-c` _file_:
138
+ True if _file_ exists and is a character special file.
139
+
140
+ * `-d` _file_:
141
+ True if file exists and is a directory.
142
+
143
+ The definition list syntax is intentionally backward compatible
144
+ with markdown(5)'s list syntax. This allows `ron` documents to be
145
+ piped through normal markdown processors with minor degradation
146
+ in output formatting.
147
+
148
+ ## SEE ALSO
149
+
150
+ ron(1), markdown(5), manpages(5)
@@ -0,0 +1,48 @@
1
+ Gem::Specification.new do |s|
2
+ s.specification_version = 2 if s.respond_to? :specification_version=
3
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
+
5
+ s.name = 'ron'
6
+ s.version = '0.1'
7
+ s.date = '2009-11-05'
8
+
9
+ s.description = "The opposite of roff"
10
+ s.summary = "The opposite of roff"
11
+
12
+ s.authors = ["Ryan Tomayko"]
13
+ s.email = "rtomayko@gmail.com"
14
+
15
+ # = MANIFEST =
16
+ s.files = %w[
17
+ COPYING
18
+ README
19
+ Rakefile
20
+ bin/ron
21
+ lib/ron.rb
22
+ lib/ron/document.rb
23
+ lib/ron/layout.html
24
+ lib/ron/roff.rb
25
+ man/markdown.5.ron
26
+ man/ron.1.ron
27
+ man/ron.5.ron
28
+ ron.gemspec
29
+ test/document_test.rb
30
+ test/ron_test.rb
31
+ test/simple.ron
32
+ ]
33
+ # = MANIFEST =
34
+
35
+ s.executables = ['ron']
36
+ s.test_files = s.files.select { |path| path =~ /^test\/.*_test.rb/ }
37
+
38
+ s.extra_rdoc_files = %w[README COPYING]
39
+ s.add_dependency 'nokogiri', '~> 1.4'
40
+ s.add_dependency 'rdiscount', '~> 1.3'
41
+ s.add_development_dependency 'contest', '~> 0.1'
42
+
43
+ s.has_rdoc = true
44
+ s.homepage = "http://github.com/rtomayko/ron/"
45
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ron"]
46
+ s.require_paths = %w[lib]
47
+ s.rubygems_version = '1.1.1'
48
+ end
@@ -0,0 +1,35 @@
1
+ require 'contest'
2
+ require 'ron/document'
3
+
4
+ class DocumentTest < Test::Unit::TestCase
5
+ SIMPLE_FILE = "#{File.dirname(__FILE__)}/simple.ron"
6
+ HELLO_DATA = "# hello(1) -- hello world"
7
+
8
+ test "creating with a file" do
9
+ doc = Ron::Document.new(SIMPLE_FILE)
10
+ assert_equal File.read(SIMPLE_FILE), doc.data
11
+ end
12
+
13
+ test "creating with a string and a file" do
14
+ doc = Ron::Document.new('hello.1.ron') { HELLO_DATA }
15
+ assert_equal HELLO_DATA, doc.data
16
+ end
17
+
18
+ context "Document" do
19
+ setup do
20
+ @doc = Ron::Document.new('hello.1.ron') { HELLO_DATA }
21
+ end
22
+
23
+ should "load data" do
24
+ assert_equal HELLO_DATA, @doc.data
25
+ end
26
+
27
+ should "extract the name" do
28
+ assert_equal 'hello', @doc.name
29
+ end
30
+
31
+ should "extract the section" do
32
+ assert_equal '1', @doc.section
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,29 @@
1
+ require 'contest'
2
+
3
+ # ron command tests
4
+ class RonTest < Test::Unit::TestCase
5
+ testdir = File.dirname(__FILE__)
6
+ bindir = File.dirname(testdir)
7
+ ENV['PATH'] = "#{bindir}:#{ENV['PATH']}"
8
+
9
+ SIMPLE_FILE = "#{File.dirname(__FILE__)}/simple.ron"
10
+
11
+ test "takes ron text on stdin and produces roff on stdout" do
12
+ output = `echo '# hello(1) -- hello world' | ron`
13
+ lines = output.split("\n")
14
+ assert_equal 7, lines.size
15
+ assert_equal %[.\\" generated with Ron], lines.shift
16
+ assert_equal %[.\\" http://github.com/rtomayko/ron/], lines.shift
17
+ assert_equal %[.], lines.shift
18
+ assert_equal %[.TH "HELLO" 1 "" "" ""], lines.shift
19
+ assert_equal %[.], lines.shift
20
+ assert_equal %[.SH "NAME"], lines.shift
21
+ assert_equal %[\\fBhello\\fR \\-\\- hello world], lines.shift
22
+ assert_equal 0, lines.size
23
+ end
24
+
25
+ test "produces html instead of roff with the --html argument" do
26
+ output = `echo '# hello(1) -- hello world' | ron --html`
27
+ assert_match(/<h2 id="NAME">NAME<\/h2>/, output)
28
+ end
29
+ end
@@ -0,0 +1,2 @@
1
+ simple(7) -- a simple ron example
2
+ =================================
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ron
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.1"
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Tomayko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-05 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: nokogiri
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: "1.4"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rdiscount
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: "1.3"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: contest
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: "0.1"
44
+ version:
45
+ description: The opposite of roff
46
+ email: rtomayko@gmail.com
47
+ executables:
48
+ - ron
49
+ extensions: []
50
+
51
+ extra_rdoc_files:
52
+ - README
53
+ - COPYING
54
+ files:
55
+ - COPYING
56
+ - README
57
+ - Rakefile
58
+ - bin/ron
59
+ - lib/ron.rb
60
+ - lib/ron/document.rb
61
+ - lib/ron/layout.html
62
+ - lib/ron/roff.rb
63
+ - man/markdown.5.ron
64
+ - man/ron.1.ron
65
+ - man/ron.5.ron
66
+ - ron.gemspec
67
+ - test/document_test.rb
68
+ - test/ron_test.rb
69
+ - test/simple.ron
70
+ has_rdoc: true
71
+ homepage: http://github.com/rtomayko/ron/
72
+ licenses: []
73
+
74
+ post_install_message:
75
+ rdoc_options:
76
+ - --line-numbers
77
+ - --inline-source
78
+ - --title
79
+ - Ron
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
87
+ version:
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: "0"
93
+ version:
94
+ requirements: []
95
+
96
+ rubyforge_project:
97
+ rubygems_version: 1.3.5
98
+ signing_key:
99
+ specification_version: 2
100
+ summary: The opposite of roff
101
+ test_files:
102
+ - test/document_test.rb
103
+ - test/ron_test.rb