org-parse 0.1.1
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/.document +5 -0
- data/.gitignore +23 -0
- data/ChangeLog +4 -0
- data/LICENSE +20 -0
- data/README.rdoc +68 -0
- data/Rakefile +54 -0
- data/VERSION.yml +5 -0
- data/bin/org-parse +51 -0
- data/bin/org-test +74 -0
- data/doc/images/org-parse-struct_1ffae50f0c5eb867f9418df6800f40a5cc3d1751.png +0 -0
- data/doc/org-parse.html +203 -0
- data/doc/org-parse.org +71 -0
- data/doc/struct.dot +10 -0
- data/doc/struct.png +0 -0
- data/examples/body-only.html.erb +1 -0
- data/examples/dot.org-parse-rc +21 -0
- data/lib/org-parse/inline-parser.output +945 -0
- data/lib/org-parse/inline-parser.rb +219 -0
- data/lib/org-parse/inline-parser.ry +77 -0
- data/lib/org-parse/inline-parser.tab.rb +411 -0
- data/lib/org-parse/node.rb +329 -0
- data/lib/org-parse/struct-parser.output +1019 -0
- data/lib/org-parse/struct-parser.rb +78 -0
- data/lib/org-parse/struct-parser.ry +125 -0
- data/lib/org-parse/struct-parser.tab.rb +608 -0
- data/lib/org-parse/struct-scanner.rb +272 -0
- data/lib/org-parse/templates/single.html.erb +118 -0
- data/lib/org-parse/textile-visitor.rb +296 -0
- data/lib/org-parse/utils.rb +15 -0
- data/lib/org-parse/visitor.rb +542 -0
- data/lib/org-parse.rb +46 -0
- data/org-parse.gemspec +113 -0
- data/rakelib/racc.rake +16 -0
- data/test/data/blocks.org +67 -0
- data/test/data/emphasis.org +7 -0
- data/test/data/footnote.html +136 -0
- data/test/data/footnote.org +8 -0
- data/test/data/html-export.html +1062 -0
- data/test/data/html-export.org +342 -0
- data/test/data/images.html +179 -0
- data/test/data/images.org +30 -0
- data/test/data/index.org +242 -0
- data/test/data/lily20100228.jpg +0 -0
- data/test/data/lily20100228t.jpg +0 -0
- data/test/data/link.org +7 -0
- data/test/data/list_before_1st_headline.html +119 -0
- data/test/data/list_before_1st_headline.org +7 -0
- data/test/data/lists.html +284 -0
- data/test/data/lists.org +78 -0
- data/test/data/no-headline.org +6 -0
- data/test/data/one-headline.org +2 -0
- data/test/data/paragraph.org +13 -0
- data/test/data/quote.org +15 -0
- data/test/data/sections.html +173 -0
- data/test/data/sections.org +9 -0
- data/test/data/simple-list.org +6 -0
- data/test/data/skip_t.org +3 -0
- data/test/data/structure.org +53 -0
- data/test/data/table.org +14 -0
- data/test/data/test-list.org +12 -0
- data/test/data/text-bef-hl.org +5 -0
- data/test/data/text.org +6 -0
- data/test/data/title.html +88 -0
- data/test/data/title.org +6 -0
- data/test/data/verse.org +48 -0
- data/test/helper.rb +31 -0
- data/test/test_org-parse.rb +148 -0
- metadata +134 -0
data/test/data/lists.org
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
* Unordered Lists
|
2
|
+
I want to make sure I have great support for lists.
|
3
|
+
|
4
|
+
- This is an unordered list
|
5
|
+
- This continues the unordered list
|
6
|
+
|
7
|
+
And this is a paragraph *after* the list.
|
8
|
+
|
9
|
+
** Wrapping within the list
|
10
|
+
- This is a single-line list item in the org file.
|
11
|
+
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
|
12
|
+
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
|
13
|
+
erat, sed diam voluptua. At vero eos et accusam et justo duo
|
14
|
+
dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
|
15
|
+
sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit
|
16
|
+
amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
|
17
|
+
invidunt ut labore et dolore magna aliquyam erat, sed diam
|
18
|
+
voluptua. At vero eos et accusam et justo duo dolores et ea
|
19
|
+
rebum. Stet clita kasd gubergren, no sea takimata sanctus est
|
20
|
+
Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
|
21
|
+
consetetur sadipscing elitr, sed diam nonumy eirmod tempor
|
22
|
+
invidunt ut labore et dolore magna aliquyam erat, sed diam
|
23
|
+
voluptua. At vero eos et accusam et justo duo dolores et ea
|
24
|
+
rebum. Stet clita kasd gubergren, no sea takimata sanctus est
|
25
|
+
Lorem ipsum dolor sit amet.
|
26
|
+
- And this is the next item. The previous item needs to be on one
|
27
|
+
line to keep =textile= happy.
|
28
|
+
- Ditto the previous line, actually.
|
29
|
+
|
30
|
+
** Edge cases
|
31
|
+
- This is a single-line list.
|
32
|
+
And this is a *separate paragraph.* Note the indentation in the org
|
33
|
+
file.
|
34
|
+
|
35
|
+
** Indent and Indent and Indent ...
|
36
|
+
- first list: first item
|
37
|
+
first list item
|
38
|
+
same indent
|
39
|
+
deeper
|
40
|
+
- first list: second item
|
41
|
+
+ second list : first item
|
42
|
+
+ second list : second item
|
43
|
+
* third list : first item
|
44
|
+
+ second list : third item
|
45
|
+
- first list: third item
|
46
|
+
|
47
|
+
* Ordered list
|
48
|
+
1. first list: first item
|
49
|
+
1) second list: first item
|
50
|
+
- unordered list
|
51
|
+
- unordered list
|
52
|
+
1) second list: second item
|
53
|
+
|
54
|
+
this has brank line
|
55
|
+
1. I can't count mmm.
|
56
|
+
|
57
|
+
** Indent Indent Indent ...
|
58
|
+
1. white line ↓
|
59
|
+
|
60
|
+
same indent line
|
61
|
+
2. next item?
|
62
|
+
|
63
|
+
↑ space indented line
|
64
|
+
|
65
|
+
this line is in.
|
66
|
+
this line out of list.
|
67
|
+
|
68
|
+
* Description list
|
69
|
+
- Elijah Wood :: He plays Frodo
|
70
|
+
- Sean Austin :: He plays Sam, Frodo's friend. I still remember
|
71
|
+
him very well from his role as Mikey Walsh in The Goonies.
|
72
|
+
- the P :: this is test.
|
73
|
+
|
74
|
+
next paragraph? <- No.
|
75
|
+
next paragraph.
|
76
|
+
|
77
|
+
#+OPTIONS: toc:nil author:nil timestamp:nil creator:nil
|
78
|
+
#+LANGUAGE: ja
|
data/test/data/quote.org
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml"
|
5
|
+
lang="en" xml:lang="en">
|
6
|
+
<head>
|
7
|
+
<title>sections</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
9
|
+
<meta name="generator" content="Org-mode"/>
|
10
|
+
<meta name="generated" content="2010-03-09 11:42:06 JST"/>
|
11
|
+
<meta name="author" content="Kensei Nakamura"/>
|
12
|
+
<meta name="description" content=""/>
|
13
|
+
<meta name="keywords" content=""/>
|
14
|
+
<style type="text/css">
|
15
|
+
<!--/*--><![CDATA[/*><!--*/
|
16
|
+
html { font-family: Times, serif; font-size: 12pt; }
|
17
|
+
.title { text-align: center; }
|
18
|
+
.todo { color: red; }
|
19
|
+
.done { color: green; }
|
20
|
+
.tag { background-color: #add8e6; font-weight:normal }
|
21
|
+
.target { }
|
22
|
+
.timestamp { color: #bebebe; }
|
23
|
+
.timestamp-kwd { color: #5f9ea0; }
|
24
|
+
p.verse { margin-left: 3% }
|
25
|
+
pre {
|
26
|
+
border: 1pt solid #AEBDCC;
|
27
|
+
background-color: #F3F5F7;
|
28
|
+
padding: 5pt;
|
29
|
+
font-family: courier, monospace;
|
30
|
+
font-size: 90%;
|
31
|
+
overflow:auto;
|
32
|
+
}
|
33
|
+
table { border-collapse: collapse; }
|
34
|
+
td, th { vertical-align: top; }
|
35
|
+
dt { font-weight: bold; }
|
36
|
+
div.figure { padding: 0.5em; }
|
37
|
+
div.figure p { text-align: center; }
|
38
|
+
.linenr { font-size:smaller }
|
39
|
+
.code-highlighted {background-color:#ffff00;}
|
40
|
+
.org-info-js_info-navigation { border-style:none; }
|
41
|
+
#org-info-js_console-label { font-size:10px; font-weight:bold;
|
42
|
+
white-space:nowrap; }
|
43
|
+
.org-info-js_search-highlight {background-color:#ffff00; color:#000000;
|
44
|
+
font-weight:bold; }
|
45
|
+
/*]]>*/-->
|
46
|
+
</style>
|
47
|
+
<script type="text/javascript">
|
48
|
+
<!--/*--><![CDATA[/*><!--*/
|
49
|
+
function CodeHighlightOn(elem, id)
|
50
|
+
{
|
51
|
+
var target = document.getElementById(id);
|
52
|
+
if(null != target) {
|
53
|
+
elem.cacheClassElem = elem.className;
|
54
|
+
elem.cacheClassTarget = target.className;
|
55
|
+
target.className = "code-highlighted";
|
56
|
+
elem.className = "code-highlighted";
|
57
|
+
}
|
58
|
+
}
|
59
|
+
function CodeHighlightOff(elem, id)
|
60
|
+
{
|
61
|
+
var target = document.getElementById(id);
|
62
|
+
if(elem.cacheClassElem)
|
63
|
+
elem.className = elem.cacheClassElem;
|
64
|
+
if(elem.cacheClassTarget)
|
65
|
+
target.className = elem.cacheClassTarget;
|
66
|
+
}
|
67
|
+
/*]]>*///-->
|
68
|
+
</script>
|
69
|
+
</head>
|
70
|
+
<body>
|
71
|
+
<div id="content">
|
72
|
+
|
73
|
+
<h1 class="title">sections</h1>
|
74
|
+
|
75
|
+
|
76
|
+
<div id="table-of-contents">
|
77
|
+
<h2>Table of Contents</h2>
|
78
|
+
<div id="text-table-of-contents">
|
79
|
+
<ul>
|
80
|
+
<li><a href="#sec-1">1 section 1 </a>
|
81
|
+
<ul>
|
82
|
+
<li><a href="#sec-1.1">1.1 section 1.1 </a>
|
83
|
+
<ul>
|
84
|
+
<li><a href="#sec-1.1.1">1.1.1 section 1.1.1 </a></li>
|
85
|
+
<li><a href="#sec-1.1.2">1.1.2 section 1.1.2 </a></li>
|
86
|
+
</ul>
|
87
|
+
</li>
|
88
|
+
<li><a href="#sec-1.2">1.2 section 1.2 </a></li>
|
89
|
+
</ul>
|
90
|
+
</li>
|
91
|
+
<li><a href="#sec-2">2 section 2 </a>
|
92
|
+
<ul>
|
93
|
+
<li>
|
94
|
+
<ul>
|
95
|
+
<li><a href="#sec-2.1">2.1 section 2.1 </a></li>
|
96
|
+
</ul>
|
97
|
+
</li>
|
98
|
+
</ul>
|
99
|
+
</li>
|
100
|
+
</ul>
|
101
|
+
</div>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<div id="outline-container-1" class="outline-2">
|
105
|
+
<h2 id="sec-1"><span class="section-number-2">1</span> section 1 </h2>
|
106
|
+
<div class="outline-text-2" id="text-1">
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<div id="outline-container-1.1" class="outline-3">
|
112
|
+
<h3 id="sec-1.1"><span class="section-number-3">1.1</span> section 1.1 </h3>
|
113
|
+
<div class="outline-text-3" id="text-1.1">
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
<div id="outline-container-1.1.1" class="outline-4">
|
119
|
+
<h4 id="sec-1.1.1"><span class="section-number-4">1.1.1</span> section 1.1.1 </h4>
|
120
|
+
<div class="outline-text-4" id="text-1.1.1">
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<div id="outline-container-1.1.2" class="outline-4">
|
127
|
+
<h4 id="sec-1.1.2"><span class="section-number-4">1.1.2</span> section 1.1.2 </h4>
|
128
|
+
<div class="outline-text-4" id="text-1.1.2">
|
129
|
+
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<div id="outline-container-1.2" class="outline-3">
|
136
|
+
<h3 id="sec-1.2"><span class="section-number-3">1.2</span> section 1.2 </h3>
|
137
|
+
<div class="outline-text-3" id="text-1.2">
|
138
|
+
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div id="outline-container-2" class="outline-2">
|
145
|
+
<h2 id="sec-2"><span class="section-number-2">2</span> section 2 </h2>
|
146
|
+
<div class="outline-text-2" id="text-2">
|
147
|
+
|
148
|
+
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<div id="outline-container-2.1" class="outline-4">
|
152
|
+
<h4 id="sec-2.1"><span class="section-number-4">2.1</span> section 2.1 </h4>
|
153
|
+
<div class="outline-text-4" id="text-2.1">
|
154
|
+
|
155
|
+
<ul>
|
156
|
+
<li id="sec-2.1.1">section 2.1.1 <br/>
|
157
|
+
</li>
|
158
|
+
<li id="sec-2.1.2">section 2.1.2 <br/>
|
159
|
+
</li>
|
160
|
+
</ul>
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
<div id="postamble">
|
165
|
+
<p class="author"> Author: Kensei Nakamura
|
166
|
+
<a href="mailto:kensei@dalmore.artifarm.com"><kensei@dalmore.artifarm.com></a>
|
167
|
+
</p>
|
168
|
+
<p class="date"> Date: 2010-03-09 11:42:06 JST</p>
|
169
|
+
<p class="creator">HTML generated by org-mode 6.34c in emacs 23</p>
|
170
|
+
</div>
|
171
|
+
</div>
|
172
|
+
</body>
|
173
|
+
</html>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
Org-mode document structure
|
2
|
+
|
3
|
+
* Document
|
4
|
+
ダミーセクション + 本文
|
5
|
+
dummy_section : DOCUMENT_START
|
6
|
+
| DOCUMENT_START items
|
7
|
+
** セクション section
|
8
|
+
HEADLINE items
|
9
|
+
items は、以下の要素の集まり
|
10
|
+
*** パラグラフ
|
11
|
+
テキストブロックの集まり
|
12
|
+
**** テキストブロック
|
13
|
+
文字列行の集まり
|
14
|
+
*** リスト
|
15
|
+
ul, el, dl の3種類
|
16
|
+
**** リストアイテム
|
17
|
+
以下の要素の集まり
|
18
|
+
***** パラグラフ
|
19
|
+
***** リスト
|
20
|
+
***** ブロック
|
21
|
+
***** 空行
|
22
|
+
*** ブロック
|
23
|
+
以下の要素の集まり
|
24
|
+
**** パラグラフ
|
25
|
+
**** リスト
|
26
|
+
**** ブロック
|
27
|
+
**** 空行
|
28
|
+
|
29
|
+
* Node
|
30
|
+
** ContainerNode
|
31
|
+
他のノードを children に持つ Node
|
32
|
+
*** RootNode
|
33
|
+
全てのノードの親となるノード
|
34
|
+
*** DummySectionNode
|
35
|
+
文書の先頭ノード
|
36
|
+
文書の先頭部分に、セクションが無い場合、items の内容を保持する
|
37
|
+
*** SectionNode
|
38
|
+
ヘッドライン 〜 ヘッドラインの直前
|
39
|
+
|
40
|
+
*** ParagraphNode
|
41
|
+
テキスト行の集まり
|
42
|
+
*** リスト
|
43
|
+
ul, ol, dl を保持する
|
44
|
+
*** ブロック
|
45
|
+
=#+BEGIN ... #+END= で囲まれた部分
|
46
|
+
*** 空行
|
47
|
+
** LeafNode
|
48
|
+
*** TextNode
|
49
|
+
1行分のテキスト
|
50
|
+
*** VariableNode
|
51
|
+
変数情報保持
|
52
|
+
*** HeadlineNode
|
53
|
+
ヘッドラインの情報保持
|
data/test/data/table.org
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
* Ordered list
|
2
|
+
1. first list: first item
|
3
|
+
1) second list: first item
|
4
|
+
- unordered list
|
5
|
+
- unordered list
|
6
|
+
1) second list: second item
|
7
|
+
|
8
|
+
this has brank line
|
9
|
+
1. I can't count mmm.
|
10
|
+
|
11
|
+
#+OPTIONS: toc:nil author:nil timestamp:nil creator:nil
|
12
|
+
#+LANGUAGE: ja
|
data/test/data/text.org
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml"
|
5
|
+
lang="ja" xml:lang="ja">
|
6
|
+
<head>
|
7
|
+
<title>no lines before 1st headline</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
9
|
+
<meta name="generator" content="Org-mode"/>
|
10
|
+
<meta name="generated" content="2010-03-05 11:24:21 JST"/>
|
11
|
+
<meta name="author" content="Kensei Nakamura"/>
|
12
|
+
<meta name="description" content=""/>
|
13
|
+
<meta name="keywords" content=""/>
|
14
|
+
<style type="text/css">
|
15
|
+
<!--/*--><![CDATA[/*><!--*/
|
16
|
+
html { font-family: Times, serif; font-size: 12pt; }
|
17
|
+
.title { text-align: center; }
|
18
|
+
.todo { color: red; }
|
19
|
+
.done { color: green; }
|
20
|
+
.tag { background-color: #add8e6; font-weight:normal }
|
21
|
+
.target { }
|
22
|
+
.timestamp { color: #bebebe; }
|
23
|
+
.timestamp-kwd { color: #5f9ea0; }
|
24
|
+
p.verse { margin-left: 3% }
|
25
|
+
pre {
|
26
|
+
border: 1pt solid #AEBDCC;
|
27
|
+
background-color: #F3F5F7;
|
28
|
+
padding: 5pt;
|
29
|
+
font-family: courier, monospace;
|
30
|
+
font-size: 90%;
|
31
|
+
overflow:auto;
|
32
|
+
}
|
33
|
+
table { border-collapse: collapse; }
|
34
|
+
td, th { vertical-align: top; }
|
35
|
+
dt { font-weight: bold; }
|
36
|
+
div.figure { padding: 0.5em; }
|
37
|
+
div.figure p { text-align: center; }
|
38
|
+
.linenr { font-size:smaller }
|
39
|
+
.code-highlighted {background-color:#ffff00;}
|
40
|
+
.org-info-js_info-navigation { border-style:none; }
|
41
|
+
#org-info-js_console-label { font-size:10px; font-weight:bold;
|
42
|
+
white-space:nowrap; }
|
43
|
+
.org-info-js_search-highlight {background-color:#ffff00; color:#000000;
|
44
|
+
font-weight:bold; }
|
45
|
+
/*]]>*/-->
|
46
|
+
</style>
|
47
|
+
<script type="text/javascript">
|
48
|
+
<!--/*--><![CDATA[/*><!--*/
|
49
|
+
function CodeHighlightOn(elem, id)
|
50
|
+
{
|
51
|
+
var target = document.getElementById(id);
|
52
|
+
if(null != target) {
|
53
|
+
elem.cacheClassElem = elem.className;
|
54
|
+
elem.cacheClassTarget = target.className;
|
55
|
+
target.className = "code-highlighted";
|
56
|
+
elem.className = "code-highlighted";
|
57
|
+
}
|
58
|
+
}
|
59
|
+
function CodeHighlightOff(elem, id)
|
60
|
+
{
|
61
|
+
var target = document.getElementById(id);
|
62
|
+
if(elem.cacheClassElem)
|
63
|
+
elem.className = elem.cacheClassElem;
|
64
|
+
if(elem.cacheClassTarget)
|
65
|
+
target.className = elem.cacheClassTarget;
|
66
|
+
}
|
67
|
+
/*]]>*///-->
|
68
|
+
</script>
|
69
|
+
</head>
|
70
|
+
<body>
|
71
|
+
<div id="content">
|
72
|
+
|
73
|
+
<h1 class="title">no lines before 1st headline</h1>
|
74
|
+
|
75
|
+
|
76
|
+
<div id="outline-container-1" class="outline-2">
|
77
|
+
<h2 id="sec-1"><span class="section-number-2">1</span> title </h2>
|
78
|
+
<div class="outline-text-2" id="text-1">
|
79
|
+
|
80
|
+
<p>there is no lines before 1st headline.
|
81
|
+
ヘッドラインの前に文章が無い場合。
|
82
|
+
</p></div>
|
83
|
+
</div>
|
84
|
+
<div id="postamble">
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
</body>
|
88
|
+
</html>
|
data/test/data/title.org
ADDED
data/test/data/verse.org
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
VERSE example
|
2
|
+
|
3
|
+
#+BEGIN_VERSE
|
4
|
+
Great clouds overhead
|
5
|
+
Tiny *black* birds /rise/ and fall
|
6
|
+
Snow covers Emacs
|
7
|
+
|
8
|
+
-- AlexSchroeder
|
9
|
+
#+END_VERSE
|
10
|
+
|
11
|
+
#+BEGIN_VERSE
|
12
|
+
- list in verse
|
13
|
+
there is many lines.
|
14
|
+
|
15
|
+
with indent
|
16
|
+
- next list item
|
17
|
+
#+END_VERSE
|
18
|
+
|
19
|
+
- list out verse
|
20
|
+
there is many lines.
|
21
|
+
|
22
|
+
with indent
|
23
|
+
- next list item
|
24
|
+
|
25
|
+
#+BEGIN_VERSE
|
26
|
+
VERSE in list?
|
27
|
+
#+END_VERSE
|
28
|
+
|
29
|
+
* out line
|
30
|
+
#+BEGIN_VERSE
|
31
|
+
in out line
|
32
|
+
|
33
|
+
** in verse
|
34
|
+
#+END_VERSE
|
35
|
+
|
36
|
+
+ list start
|
37
|
+
#+BEGIN_VERSE
|
38
|
+
this line is in verse
|
39
|
+
is OK?
|
40
|
+
indent check!
|
41
|
+
#+END_VERSE
|
42
|
+
in list item
|
43
|
+
connect the lines
|
44
|
+
+ next item
|
45
|
+
|
46
|
+
out of list
|
47
|
+
in paragraph
|
48
|
+
connect the lines
|
data/test/helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'shoulda'
|
4
|
+
require 'nokogiri'
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
7
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
|
+
require 'org-parse'
|
9
|
+
|
10
|
+
class Test::Unit::TestCase
|
11
|
+
@@data_dir = File.join(File.dirname(__FILE__), 'data')
|
12
|
+
|
13
|
+
def load_data(fname)
|
14
|
+
f = File.open(File.join(@@data_dir,fname))
|
15
|
+
str = f.read
|
16
|
+
f.close
|
17
|
+
str
|
18
|
+
end
|
19
|
+
|
20
|
+
def do_parse(str, title)
|
21
|
+
@parser = OrgParse::StructParser.new(str, title)
|
22
|
+
@parser.parse
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_html(str, title)
|
26
|
+
@root = do_parse str, title
|
27
|
+
@visitor = OrgParse::HtmlVisitor.new(@root)
|
28
|
+
@visitor.build
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|