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.
Files changed (68) hide show
  1. data/.document +5 -0
  2. data/.gitignore +23 -0
  3. data/ChangeLog +4 -0
  4. data/LICENSE +20 -0
  5. data/README.rdoc +68 -0
  6. data/Rakefile +54 -0
  7. data/VERSION.yml +5 -0
  8. data/bin/org-parse +51 -0
  9. data/bin/org-test +74 -0
  10. data/doc/images/org-parse-struct_1ffae50f0c5eb867f9418df6800f40a5cc3d1751.png +0 -0
  11. data/doc/org-parse.html +203 -0
  12. data/doc/org-parse.org +71 -0
  13. data/doc/struct.dot +10 -0
  14. data/doc/struct.png +0 -0
  15. data/examples/body-only.html.erb +1 -0
  16. data/examples/dot.org-parse-rc +21 -0
  17. data/lib/org-parse/inline-parser.output +945 -0
  18. data/lib/org-parse/inline-parser.rb +219 -0
  19. data/lib/org-parse/inline-parser.ry +77 -0
  20. data/lib/org-parse/inline-parser.tab.rb +411 -0
  21. data/lib/org-parse/node.rb +329 -0
  22. data/lib/org-parse/struct-parser.output +1019 -0
  23. data/lib/org-parse/struct-parser.rb +78 -0
  24. data/lib/org-parse/struct-parser.ry +125 -0
  25. data/lib/org-parse/struct-parser.tab.rb +608 -0
  26. data/lib/org-parse/struct-scanner.rb +272 -0
  27. data/lib/org-parse/templates/single.html.erb +118 -0
  28. data/lib/org-parse/textile-visitor.rb +296 -0
  29. data/lib/org-parse/utils.rb +15 -0
  30. data/lib/org-parse/visitor.rb +542 -0
  31. data/lib/org-parse.rb +46 -0
  32. data/org-parse.gemspec +113 -0
  33. data/rakelib/racc.rake +16 -0
  34. data/test/data/blocks.org +67 -0
  35. data/test/data/emphasis.org +7 -0
  36. data/test/data/footnote.html +136 -0
  37. data/test/data/footnote.org +8 -0
  38. data/test/data/html-export.html +1062 -0
  39. data/test/data/html-export.org +342 -0
  40. data/test/data/images.html +179 -0
  41. data/test/data/images.org +30 -0
  42. data/test/data/index.org +242 -0
  43. data/test/data/lily20100228.jpg +0 -0
  44. data/test/data/lily20100228t.jpg +0 -0
  45. data/test/data/link.org +7 -0
  46. data/test/data/list_before_1st_headline.html +119 -0
  47. data/test/data/list_before_1st_headline.org +7 -0
  48. data/test/data/lists.html +284 -0
  49. data/test/data/lists.org +78 -0
  50. data/test/data/no-headline.org +6 -0
  51. data/test/data/one-headline.org +2 -0
  52. data/test/data/paragraph.org +13 -0
  53. data/test/data/quote.org +15 -0
  54. data/test/data/sections.html +173 -0
  55. data/test/data/sections.org +9 -0
  56. data/test/data/simple-list.org +6 -0
  57. data/test/data/skip_t.org +3 -0
  58. data/test/data/structure.org +53 -0
  59. data/test/data/table.org +14 -0
  60. data/test/data/test-list.org +12 -0
  61. data/test/data/text-bef-hl.org +5 -0
  62. data/test/data/text.org +6 -0
  63. data/test/data/title.html +88 -0
  64. data/test/data/title.org +6 -0
  65. data/test/data/verse.org +48 -0
  66. data/test/helper.rb +31 -0
  67. data/test/test_org-parse.rb +148 -0
  68. metadata +134 -0
data/rakelib/racc.rake ADDED
@@ -0,0 +1,16 @@
1
+ namespace "racc" do
2
+ srcs = FileList["lib/**/*.ry"]
3
+ tabs = srcs.ext("tab.rb")
4
+
5
+ desc "Generate tab files"
6
+ file :gen => tabs do |t|
7
+ #
8
+ end
9
+
10
+ tabs.each do |t|
11
+ s = t.sub('.tab.rb', '.ry')
12
+ file t => s do
13
+ sh "racc -v #{s}"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,67 @@
1
+ Blocks
2
+
3
+ * paragraphs
4
+ セクションは、パラグラフから始まる?
5
+
6
+ paragraph 1
7
+
8
+ paragraph 2
9
+ indent deeper
10
+ indent shallower
11
+
12
+ paragraph 3
13
+ ** list only section
14
+ - list1
15
+ - list2
16
+ * blocks
17
+ ** Verse
18
+ verse ブロック内では、改行が保存される。//
19
+ <p class="verse"> 〜 </p> でくくる。//
20
+
21
+ インデントは、ブロック指定行のインデントを基準に、
22
+ 各行のインデント * 2 の &nbsp; に置き換わる。
23
+ #+begin_Verse
24
+ verse line1
25
+ verse line2
26
+ verse line3
27
+ verse line4
28
+ #+end_verse
29
+ ** Example
30
+ example ブロックは、<pre class="example"></pre>でくくる
31
+
32
+ インデントは、 *ブロック* 先頭行のインデント位置からの
33
+ インデントに変換される。[[blocks.html]]
34
+ #+begin_example
35
+ # *非破壊的*
36
+ def expand_tab( str )
37
+ str.gsub(/([^\t]{8})|([^\t]*)\t/n) { [$+].pack("A8") }
38
+ end
39
+
40
+ * example の内部は、解釈されないわけね
41
+
42
+ # 破壊的 [[link]]
43
+ def expand_tab!( str )
44
+ 1 while str.sub!(/(^[^\t]*)\t(\t*)/) { $1 + ' ' * (8-$1.size%8+8*$2.size) }
45
+ end
46
+
47
+ # 破壊的 (2)
48
+ def expand_tab!( str )
49
+ 1 while str.sub!(/\t(\t*)/) {' ' * (8-$~.begin(0)%8+8*$1.size) }
50
+ end
51
+ #+end_example
52
+
53
+ #+BEGIN_EXAMPLE -t -w 40
54
+ (defun org-xor (a b)
55
+ "Exclusive or."
56
+ (if a (not b) b))
57
+ #+END_EXAMPLE
58
+
59
+
60
+ ** Quote
61
+ #+BEGIN_QUOTE
62
+ blockquote も書ける
63
+ #+END_QUOTE
64
+ * section 3
65
+ - list1
66
+ - list1-1
67
+ - list2
@@ -0,0 +1,7 @@
1
+ Emphasis
2
+
3
+ *bold and /italic/* _underlined and *bold*_ ~verbatim without *bold*~
4
+ =code without *bold*=
5
+ *bold [[link][link]]* =code is [[link][link]] allowed= *bold =code* code=
6
+ *bold in *bold* is* not bold *1234*
7
+ *bold [[link]]*, [[link][ *bold* ]]
@@ -0,0 +1,136 @@
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="en" xml:lang="en">
6
+ <head>
7
+ <title>Footnotes</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-09 11:34:56 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">Footnotes</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 name only </a></li>
81
+ <li><a href="#sec-2">2 definition <i>only</i> </a></li>
82
+ <li><a href="#sec-3">3 with name and definition </a></li>
83
+ </ul>
84
+ </div>
85
+ </div>
86
+
87
+ <div id="outline-container-1" class="outline-2">
88
+ <h2 id="sec-1"><span class="section-number-2">1</span> name only<sup><a class="footref" name="fnr.1" href="#fn.1">1</a></sup> </h2>
89
+ <div class="outline-text-2" id="text-1">
90
+
91
+ <p>name only
92
+ </p></div>
93
+
94
+ </div>
95
+
96
+ <div id="outline-container-2" class="outline-2">
97
+ <h2 id="sec-2"><span class="section-number-2">2</span> definition <i>only</i> </h2>
98
+ <div class="outline-text-2" id="text-2">
99
+
100
+ <p>footnote definition only<sup><a class="footref" name="fnr.2" href="#fn.2">2</a></sup>[link]]]
101
+ </p></div>
102
+
103
+ </div>
104
+
105
+ <div id="outline-container-3" class="outline-2">
106
+ <h2 id="sec-3"><span class="section-number-2">3</span> with name and definition </h2>
107
+ <div class="outline-text-2" id="text-3">
108
+
109
+ <p>footnote name and definition<sup><a class="footref" name="fnr.3" href="#fn.3">3</a></sup>
110
+ </p>
111
+
112
+
113
+
114
+ </div>
115
+ </div>
116
+ <div id="footnotes">
117
+ <h2 class="footnotes">Footnotes: </h2>
118
+ <div id="text-footnotes">
119
+ <p class="footnote"><sup><a class="footnum" name="fn.1" href="#fnr.1">1</a></sup> definition is here
120
+ </p>
121
+ <p class="footnote"><sup><a class="footnum" name="fn.2" href="#fnr.2">2</a></sup> <b>definition</b> inline with [[html-export.html
122
+ </p>
123
+ <p class="footnote"><sup><a class="footnum" name="fn.3" href="#fnr.3">3</a></sup> name with definition
124
+ </p>
125
+ </div>
126
+ </div>
127
+ <div id="postamble">
128
+ <p class="author"> Author: Kensei Nakamura
129
+ <a href="mailto:kensei@dalmore.artifarm.com">&lt;kensei@dalmore.artifarm.com&gt;</a>
130
+ </p>
131
+ <p class="date"> Date: 2010-03-09 11:34:56 JST</p>
132
+ <p class="creator">HTML generated by org-mode 6.34c in emacs 23</p>
133
+ </div>
134
+ </div>
135
+ </body>
136
+ </html>
@@ -0,0 +1,8 @@
1
+ Footnotes
2
+ * name only[fn:1]
3
+ name only
4
+ [fn:1] definition is here
5
+ * definition /only/
6
+ footnote definition only[fn:: *definition* inline with [[html-export.html][link]]]
7
+ * with name and definition
8
+ footnote name and definition[fn:2: name with definition]