marker 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +674 -0
- data/README +98 -0
- data/bin/marker +59 -0
- data/lib/marker/common.rb +40 -0
- data/lib/marker/headings.rb +79 -0
- data/lib/marker/language.treetop +679 -0
- data/lib/marker/links.rb +153 -0
- data/lib/marker/lists.rb +188 -0
- data/lib/marker/markup.rb +81 -0
- data/lib/marker/templates.rb +105 -0
- data/lib/marker/text.rb +96 -0
- data/lib/marker/verbatim.rb +48 -0
- data/lib/marker.rb +80 -0
- metadata +77 -0
data/lib/marker.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2009 Ryan Blue.
|
3
|
+
# Distributed under the terms of the GNU General Public License (GPL).
|
4
|
+
# See the LICENSE file for further information on the GPL.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'treetop'
|
9
|
+
|
10
|
+
#-- markup classes ++
|
11
|
+
|
12
|
+
require 'marker/common'
|
13
|
+
require 'marker/markup'
|
14
|
+
require 'marker/text'
|
15
|
+
require 'marker/headings'
|
16
|
+
require 'marker/lists'
|
17
|
+
require 'marker/links'
|
18
|
+
require 'marker/templates'
|
19
|
+
require 'marker/verbatim'
|
20
|
+
|
21
|
+
#-- markup grammar/parser ++
|
22
|
+
|
23
|
+
require 'marker/language'
|
24
|
+
|
25
|
+
#:include:README
|
26
|
+
module Marker
|
27
|
+
class << self
|
28
|
+
# Adds the instance methods of +mod+ to the templates that will be used
|
29
|
+
# when rendering text.
|
30
|
+
#
|
31
|
+
# module Templates
|
32
|
+
# # defines {{ name }}
|
33
|
+
# def name( format, positional_array, named_hash )
|
34
|
+
# # return a string!
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
# Marker.templates = Templates
|
38
|
+
def templates=( mod )
|
39
|
+
@@templates = Marker::DefaultTemplates.extend( mod )
|
40
|
+
end
|
41
|
+
|
42
|
+
def templates #:nodoc:
|
43
|
+
@@templates ||= Marker::DefaultTemplates
|
44
|
+
end
|
45
|
+
|
46
|
+
# Sets the base url for internal links. If not set, internal links will
|
47
|
+
# begin with '/'
|
48
|
+
def link_base=( url )
|
49
|
+
@@link_base = url
|
50
|
+
end
|
51
|
+
|
52
|
+
def link_base #:nodoc:
|
53
|
+
@@link_base ||= ''
|
54
|
+
end
|
55
|
+
|
56
|
+
# sets the default options used when rendering markup
|
57
|
+
def render_options=( options )
|
58
|
+
@@render_options = options
|
59
|
+
end
|
60
|
+
|
61
|
+
def render_options #:nodoc:
|
62
|
+
@@render_options ||= {}
|
63
|
+
end
|
64
|
+
|
65
|
+
# Returns a Marker markup parser instance (Marker::LanguageParser)
|
66
|
+
def parser
|
67
|
+
@@parser ||= LanguageParser.new
|
68
|
+
end
|
69
|
+
|
70
|
+
# Parses the given +markup+ string and returns the result
|
71
|
+
def parse( markup )
|
72
|
+
parser.parse( markup )
|
73
|
+
end
|
74
|
+
|
75
|
+
# Parses markup read from the file +filename+ and returns the result
|
76
|
+
def parse_file( filename )
|
77
|
+
parser.parse( File.read( filename ) )
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: marker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Blue
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-14 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: treetop
|
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.2
|
24
|
+
version:
|
25
|
+
description:
|
26
|
+
email: rdblue@gmail.com
|
27
|
+
executables:
|
28
|
+
- marker
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README
|
33
|
+
- LICENSE
|
34
|
+
files:
|
35
|
+
- bin/marker
|
36
|
+
- lib/marker.rb
|
37
|
+
- lib/marker/verbatim.rb
|
38
|
+
- lib/marker/templates.rb
|
39
|
+
- lib/marker/markup.rb
|
40
|
+
- lib/marker/common.rb
|
41
|
+
- lib/marker/text.rb
|
42
|
+
- lib/marker/links.rb
|
43
|
+
- lib/marker/lists.rb
|
44
|
+
- lib/marker/headings.rb
|
45
|
+
- lib/marker/language.treetop
|
46
|
+
- README
|
47
|
+
- LICENSE
|
48
|
+
has_rdoc: true
|
49
|
+
homepage: http://github.com/rdblue/marker
|
50
|
+
licenses: []
|
51
|
+
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
version:
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.3.5
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: A markup parser that outputs html and text. Syntax is similar to MediaWiki.
|
76
|
+
test_files: []
|
77
|
+
|