notroff 0.2.2 → 0.2.3
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/lib/notroff/docbook_renderer.rb +14 -7
- data/lib/notroff/skel.odt +0 -0
- metadata +1 -1
@@ -29,6 +29,17 @@ class DocbookRenderer < Processor
|
|
29
29
|
doc
|
30
30
|
end
|
31
31
|
|
32
|
+
def current_chapter
|
33
|
+
@chapter || new_chapter
|
34
|
+
end
|
35
|
+
|
36
|
+
def new_chapter
|
37
|
+
@chapter = Element.new('chapter')
|
38
|
+
@chapters << @chapter
|
39
|
+
@section = nil
|
40
|
+
@chapter
|
41
|
+
end
|
42
|
+
|
32
43
|
def element_for(type, text)
|
33
44
|
result = Element.new(type)
|
34
45
|
result.add_text(text)
|
@@ -48,16 +59,14 @@ class DocbookRenderer < Processor
|
|
48
59
|
@author = text
|
49
60
|
when :chapter
|
50
61
|
Logger.log "adding chapter #{text}"
|
51
|
-
|
52
|
-
@chapters << @chapter
|
53
|
-
@section = nil
|
62
|
+
new_chapter
|
54
63
|
title_element = Element.new('title')
|
55
64
|
add_body_text(title_element, text)
|
56
65
|
@chapter.add_element(title_element)
|
57
66
|
when :section
|
58
67
|
Logger.log "adding section #{text}"
|
59
68
|
@section = Element.new('section')
|
60
|
-
|
69
|
+
current_chapter.add(@section)
|
61
70
|
title_element = Element.new('title')
|
62
71
|
add_body_text(title_element, text)
|
63
72
|
@section.add_element(title_element)
|
@@ -76,10 +85,8 @@ class DocbookRenderer < Processor
|
|
76
85
|
def add_content_element(el)
|
77
86
|
if @section
|
78
87
|
@section.add_element(el)
|
79
|
-
elsif @chapter
|
80
|
-
@chapter.add_element(el)
|
81
88
|
else
|
82
|
-
|
89
|
+
current_chapter.add_element(el)
|
83
90
|
end
|
84
91
|
end
|
85
92
|
|
data/lib/notroff/skel.odt
CHANGED
Binary file
|