fastreader 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fastreader might be problematic. Click here for more details.
- data/lib/display.rb +15 -9
- data/lib/entry_window.rb +7 -3
- data/lib/fastreader.rb +1 -1
- metadata +1 -1
data/lib/display.rb
CHANGED
@@ -84,10 +84,10 @@ class Display
|
|
84
84
|
def display_raw_entry_content(entry)
|
85
85
|
out = []
|
86
86
|
if entry.description
|
87
|
-
out << divider + "Entry Summary\n\n" + entry.description
|
87
|
+
out << divider + "Entry Summary\n\n" + process_entities_and_utf(entry.description)
|
88
88
|
end
|
89
89
|
if entry.content
|
90
|
-
out << "Entry Content\n\n" + entry.content
|
90
|
+
out << "Entry Content\n\n" + process_entities_and_utf(entry.content)
|
91
91
|
end
|
92
92
|
wrap_text(out.join(divider)).strip
|
93
93
|
end
|
@@ -132,10 +132,6 @@ class Display
|
|
132
132
|
|
133
133
|
doc.search('//comment()').remove
|
134
134
|
|
135
|
-
doc.search('p, div') do |p|
|
136
|
-
p.swap( "\n\n" + p.inner_html.gsub("\n", ' ').squeeze(' ').strip + "\n\n" )
|
137
|
-
end
|
138
|
-
|
139
135
|
doc.search('blockquote, pre') do |x|
|
140
136
|
# compress extra spaces
|
141
137
|
text = x.inner_text.squeeze(' ').strip
|
@@ -163,7 +159,7 @@ class Display
|
|
163
159
|
doc.search('i, b, strong, em') do |p|
|
164
160
|
p.swap( "*#{p.inner_text}*" )
|
165
161
|
end
|
166
|
-
doc.search('abbr') do |p|
|
162
|
+
doc.search('abbr, code') do |p|
|
167
163
|
p.swap( "+#{p.inner_text}+" )
|
168
164
|
end
|
169
165
|
#
|
@@ -199,10 +195,20 @@ class Display
|
|
199
195
|
doc.search('ul, ol, dl') do |s|
|
200
196
|
s.swap( s.inner_text.strip )
|
201
197
|
end
|
198
|
+
|
199
|
+
doc.search('p') do |p|
|
200
|
+
p.swap( "\n\n" + p.inner_text.gsub("\n", ' ').squeeze(' ').strip + "\n\n" )
|
201
|
+
end
|
202
|
+
|
203
|
+
|
204
|
+
doc.search('div') do |p|
|
205
|
+
p.swap( "\n\n" + p.inner_text.gsub("\n", ' ').squeeze(' ').strip + "\n\n" )
|
206
|
+
end
|
207
|
+
|
202
208
|
doc.to_s
|
203
|
-
end
|
204
209
|
|
205
|
-
|
210
|
+
end
|
211
|
+
def links_to_footnotes(html)
|
206
212
|
doc = Hpricot(html)
|
207
213
|
footnotes = []
|
208
214
|
doc.search('//a[@href]') do |link|
|
data/lib/entry_window.rb
CHANGED
@@ -77,9 +77,13 @@ class EntryWindow
|
|
77
77
|
@window.setpos(0, 0)
|
78
78
|
@window.clear
|
79
79
|
if @search_string
|
80
|
-
|
80
|
+
page_content.each do |line|
|
81
|
+
addstr_with_highlighting(line + "\n", @search_string)
|
82
|
+
end
|
81
83
|
else
|
82
|
-
|
84
|
+
page_content.each do |line|
|
85
|
+
@window.addstr(line + "\n")
|
86
|
+
end
|
83
87
|
end
|
84
88
|
|
85
89
|
@window.refresh
|
@@ -114,7 +118,7 @@ class EntryWindow
|
|
114
118
|
|
115
119
|
def page_content
|
116
120
|
line_offset = @page_index * @height
|
117
|
-
@lines[line_offset, @height]
|
121
|
+
@lines[line_offset, @height]
|
118
122
|
end
|
119
123
|
|
120
124
|
def toggle_flag
|
data/lib/fastreader.rb
CHANGED