plain_text 0.5 → 0.7
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.
- checksums.yaml +4 -4
- data/ChangeLog +23 -0
- data/Makefile +2 -1
- data/README.en.rdoc +39 -30
- data/bin/yard2md_afterclean +21 -10
- data/lib/plain_text/parse_rule.rb +6 -6
- data/lib/plain_text/part.rb +48 -49
- data/lib/plain_text/split.rb +9 -8
- data/lib/plain_text/util.rb +6 -6
- data/lib/plain_text.rb +47 -47
- data/plain_text.gemspec +5 -5
- data/test/test_plain_text_part.rb +6 -6
- data/test/testyard2md_afterclean.rb +38 -2
- metadata +12 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21f798fe1e22424b48114466382f56a8c27a065ee63d6e9c68c98f5c7e505f14
|
4
|
+
data.tar.gz: 0dde006503a336e1e96960dedd7e04c09ea88723495df93ca11bfa177d0f390e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30a1f8819371a6b2204df7e47b671c95b227fe14d8b134373c3d0768e35e89bd0c3386707cebbc499aab026631aa0b6fb3838112f198a46ae35328e19ab66eec
|
7
|
+
data.tar.gz: baca6464f9e66e01154fe72c7fee869ae8218f4a65f46679b2d9f934780eeef0f893f7d01c3a417a9beb007c390ce0b6c7f3aa40b9c49130ca4dcc5a40c2ba4e
|
data/ChangeLog
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
-----
|
2
|
+
(Version: 0.7)
|
3
|
+
2022-08-25 Masa Sakano
|
4
|
+
* fixed many yard-doc warnings.
|
5
|
+
|
6
|
+
-----
|
7
|
+
2022-08-25 Masa Sakano
|
8
|
+
* Now auto-judges languages. Fixed a bug of chopping some tails.
|
9
|
+
|
10
|
+
-----
|
11
|
+
2019-11-07 Masa Sakano
|
12
|
+
* Modified .github/README.md
|
13
|
+
|
14
|
+
-----
|
15
|
+
(Version: 0.6)
|
16
|
+
2019-11-07 Masa Sakano
|
17
|
+
* Introduces a new concept "Para" and accordingly renamed some methods like Part#parts to Part#paras
|
18
|
+
|
19
|
+
-----
|
20
|
+
(Version: 0.5.1)
|
21
|
+
2019-11-07 Masa Sakano
|
22
|
+
* Minor update of gemspec (for RubyGems.org).
|
23
|
+
|
1
24
|
-----
|
2
25
|
(Version: 0.5)
|
3
26
|
2019-11-07 Masa Sakano
|
data/Makefile
CHANGED
@@ -18,6 +18,7 @@ clean:
|
|
18
18
|
test:
|
19
19
|
rake test
|
20
20
|
|
21
|
+
## yard2md_afterclean in Gem plain_text https://rubygems.org/gems/plain_text
|
21
22
|
doc:
|
22
|
-
yard doc
|
23
|
+
yard doc; [[ -x ".github" && ( "README.en.rdoc" -nt ".github/README.md" ) ]] && ( ruby -r rdoc -e 'puts RDoc::Markup::ToMarkdown.new.convert ARGF.read' < README.en.rdoc | yard2md_afterclean | ruby -e 'puts ARGF.read.sub(/(```)ruby(\nPart )/){$$1+"text"+$$2}' > .github/.README.md && mv .github/.README.md .github/README.md && echo ".github/README.md is updated." ) || exit 0
|
23
24
|
|
data/README.en.rdoc
CHANGED
@@ -9,7 +9,7 @@ which represent the logical structure of a document and another class
|
|
9
9
|
ParseRule, which describes the rules to parse plain text to produce a Part-type Ruby instance.
|
10
10
|
This package also provides a few command-line programs, such as counting the number
|
11
11
|
of characters (especially useful for documents in Asian (CJK)
|
12
|
-
|
12
|
+
characters) and advanced head/tail commands.
|
13
13
|
|
14
14
|
The master of this README file, as well as the document for all the methods, is found in
|
15
15
|
{RubyGems/plain_text}[https://rubygems.org/gems/plain_text]
|
@@ -30,9 +30,9 @@ such as, {PlainText.clean_text} and {PlainText.count_char}.
|
|
30
30
|
=== PlainText::Part - Core class to describe the logical structure
|
31
31
|
|
32
32
|
In the namespace of this module, it contains {PlainText::Part} class,
|
33
|
-
which is the heart to describe the logical structure of
|
33
|
+
which is the heart to describe the logical structure of a document.
|
34
34
|
It is basically a container class and indeed a sub-class of Array. It
|
35
|
-
can contain either of
|
35
|
+
can contain either of other (multiple) {PlainText::Part} or more basic
|
36
36
|
components of either of {PlainText::Part::Paragraph} and
|
37
37
|
{PlainText::Part::Boundary}, both of which are sub-classes of String.
|
38
38
|
|
@@ -64,7 +64,7 @@ An example instance looks like this:
|
|
64
64
|
(5) Boundary::General
|
65
65
|
)
|
66
66
|
|
67
|
-
where the
|
67
|
+
where the names of the subclasses (or constants) here are arbitrary, except for
|
68
68
|
{PlainText::Part::Paragraph::Empty} and
|
69
69
|
{PlainText::Part::Boundary::Empty}, which are pre-defined. Users can
|
70
70
|
define their own subclasses to help organize the logical structure at
|
@@ -73,9 +73,18 @@ their will.
|
|
73
73
|
Basically, at every layer, every {PlainText::Part} or
|
74
74
|
{PlainText::Part::Paragraph} is sandwiched by
|
75
75
|
{PlainText::Part::Boundary}, except for the very first one.
|
76
|
+
The former contains something significant on its own, whereas the
|
77
|
+
latter (Boundary) contains nothing significant on its own, except they
|
78
|
+
may indicate the type of the following (or preceding) entity, such as
|
79
|
+
a title or section.
|
76
80
|
|
77
|
-
|
78
|
-
|
81
|
+
In this library (document, classes and modules), the former and latter
|
82
|
+
are collectively referred to as Para (or Paras) and Boundary (or
|
83
|
+
Boundaries), respectively. Namely, a Para means either of
|
84
|
+
{PlainText::Part} and {PlainText::Part::Paragraph}.
|
85
|
+
|
86
|
+
By performing +Part#join+ method, one can retrieve the entire document as a
|
87
|
+
String instance any time, just like +Array#join+.
|
79
88
|
|
80
89
|
=== PlainText::ParseRule - Class to describe the rule of how to parse
|
81
90
|
|
@@ -87,13 +96,13 @@ A rule, Proc, is defined by a user and is designed to receive either
|
|
87
96
|
String (the first application only) or {PlainText::ParseRule} (Array)
|
88
97
|
and to return a fully (or partially) parsed {PlainText::ParseRule}.
|
89
98
|
In short, the rule descries how to determine from where to where a
|
90
|
-
|
91
|
-
sections and sub-sections and so on are.
|
99
|
+
Paras and Boundaries are located — for example, what and where the
|
100
|
+
sections and sub-sections are and so on are.
|
92
101
|
|
93
102
|
For example, if a rule is Regexp, it describes how to split a String;
|
94
103
|
it is applied to String in the first application, but if it is
|
95
|
-
applied (and maybe registered as such) at the second or later
|
96
|
-
it is applied to each
|
104
|
+
applied (and maybe registered as such) at the second or later stages,
|
105
|
+
it is applied to each Para separately to split them further.
|
97
106
|
|
98
107
|
{PlainText::ParseRule#apply} and {PlainText::Part.parse} are the
|
99
108
|
standard methods to apply the rules to an object (either String or
|
@@ -110,7 +119,7 @@ Counts the number of characters in a file(s) or STDIN.
|
|
110
119
|
|
111
120
|
The simplest example to run the command-line script is
|
112
121
|
|
113
|
-
countchar YourFile.txt
|
122
|
+
% countchar YourFile.txt
|
114
123
|
|
115
124
|
=== textclean
|
116
125
|
|
@@ -123,30 +132,30 @@ into 2. See the reference of {PlainText.clean_text} for detail.
|
|
123
132
|
This gives advanced functions, in addition to the standard +head+, including
|
124
133
|
|
125
134
|
Regexp:: It can accept Ruby Regexp to determine the boundary (beginning to the first-matched line), including ignore-case, multi-line, extra *padding-line* etc.
|
126
|
-
Character-based:: With +--char+ option, it handles the file in units of a
|
127
|
-
Reverse:: It can *
|
135
|
+
Character-based:: With +--char+ option, it handles the file in units of a character, which is especially handy to deal with multi-byte characters like UTF-8.
|
136
|
+
Reverse:: It can *reverse* the behaviour - inverse the counting to output everything but initial NUM lines.
|
128
137
|
|
129
138
|
A few examples are
|
130
139
|
|
131
|
-
head.rb -n 5 < try.txt
|
140
|
+
% head.rb -n 5 < try.txt
|
132
141
|
# the same as the UNIX head; printing the first 5 lines
|
133
142
|
|
134
|
-
head.rb -i -n 5 try.txt
|
143
|
+
% head.rb -i -n 5 try.txt
|
135
144
|
# printing everything but the first 5 lines
|
136
145
|
# The same as the UNIX command: tail -n +5
|
137
146
|
|
138
|
-
head.rb -e '^===+' try.txt
|
147
|
+
% head.rb -e '^===+' try.txt
|
139
148
|
# => from the top up to the line that begins with more than 3 "="
|
140
149
|
|
141
|
-
head.rb -x -e '^===+' try.txt
|
150
|
+
% head.rb -x -e '^===+' try.txt
|
142
151
|
# => from the top up to the line before what begins with more than 3 "="
|
143
152
|
|
144
|
-
head.rb -e '^===+' -p 3 try.txt
|
153
|
+
% head.rb -e '^===+' -p 3 try.txt
|
145
154
|
# => from the top up to 3 lines after what begins with more than 3 "="
|
146
155
|
|
147
|
-
head.rb -e '([a-z])\1$' --padding=-2 try.txt
|
156
|
+
% head.rb -e '([a-z])\1$' --padding=-2 try.txt
|
148
157
|
# => from the top up to 2 lines before what ends with 2
|
149
|
-
# consecutive same letters (case-
|
158
|
+
# consecutive same letters (case-insensitive) like "AA" or "qQ"
|
150
159
|
|
151
160
|
The suffix +.rb+ is used to distinguish this command from the UNIX-shell standard command.
|
152
161
|
|
@@ -155,18 +164,18 @@ The suffix +.rb+ is used to distinguish this command from the UNIX-shell standar
|
|
155
164
|
This gives advanced functions, in addition to the standard +tail+, including
|
156
165
|
|
157
166
|
Regexp:: It can accept Ruby Regexp to determine the boundary (last-matched line to the end), including ignore-case, multi-line, extra *padding-line* etc.
|
158
|
-
Character-based:: With +--char+ option, it handles the file in units of a
|
159
|
-
Reverse:: It can *
|
167
|
+
Character-based:: With +--char+ option, it handles the file in units of a character, which is especially handy to deal with multi-byte characters like UTF-8.
|
168
|
+
Reverse:: It can *reverse* the behaviour - inverse the counting to output everything but the last NUM lines.
|
160
169
|
|
161
170
|
See +head.rb+ for practical examples.
|
162
171
|
|
163
172
|
Note the UNIX form of
|
164
173
|
|
165
|
-
tail -n +5
|
174
|
+
% tail -n +5
|
166
175
|
|
167
|
-
(which I think is a bit counter-
|
176
|
+
(which I think is a bit counter-intuitive format) is equivalent to
|
168
177
|
|
169
|
-
head.rb -i -n 5
|
178
|
+
% head.rb -i -n 5
|
170
179
|
|
171
180
|
The suffix +.rb+ is used to distinguish this command from the UNIX-shell standard command.
|
172
181
|
|
@@ -176,7 +185,7 @@ This stands for "yard to markdown - after-clean".
|
|
176
185
|
|
177
186
|
The standard conversion way of RDoc (written for yard) with +rdoc+ library
|
178
187
|
|
179
|
-
RDoc::Markup::ToMarkdown.new.convert
|
188
|
+
RDoc::Markup::ToMarkdown.new.convert
|
180
189
|
|
181
190
|
is limited, with the produced markdown having a fair number of flaws.
|
182
191
|
This command tries to botch-fix it. The result is
|
@@ -213,7 +222,7 @@ Work in progress...
|
|
213
222
|
== Install
|
214
223
|
|
215
224
|
This script requires {Ruby}[http://www.ruby-lang.org] Version 2.0
|
216
|
-
or above (
|
225
|
+
or above (possibly 2.2 or above?).
|
217
226
|
|
218
227
|
For use of the library, if your Ruby script declares
|
219
228
|
|
@@ -234,7 +243,7 @@ You may need to modify the first line (Shebang line) of the script to suit your
|
|
234
243
|
environment (it should be unnecessary for Linux and MacOS), or run it
|
235
244
|
explicitly with your Ruby command as
|
236
245
|
|
237
|
-
|
246
|
+
% /YOUR/ENV/ruby /YOUR/INSTALLED/countchar
|
238
247
|
|
239
248
|
== Developer's note
|
240
249
|
|
@@ -243,8 +252,8 @@ can view it in
|
|
243
252
|
{RubyGems/plain_text}[https://rubygems.org/gems/plain_text] .
|
244
253
|
|
245
254
|
The source code is maintained also in
|
246
|
-
{Github}[https://github.com/masasakano/plain_text]
|
247
|
-
interface for annotation
|
255
|
+
{Github}[https://github.com/masasakano/plain_text] with no intuitive
|
256
|
+
interface for annotation but with easily-browsable {ChangeLog}[https://github.com/masasakano/plain_text/blob/master/ChangeLog]
|
248
257
|
|
249
258
|
=== Tests
|
250
259
|
|
data/bin/yard2md_afterclean
CHANGED
@@ -8,6 +8,7 @@ require 'plain_text'
|
|
8
8
|
BANNER = <<"__EOF__"
|
9
9
|
USAGE: #{File.basename($0)} [options] [INFILE.txt] < STDIN
|
10
10
|
Clean the partially ill-formated (Github) Markdown converted from yard-Rdoc.
|
11
|
+
Create <dl>, fix "+", add code-block languages etc.
|
11
12
|
__EOF__
|
12
13
|
|
13
14
|
# Initialising the hash for the command-line options.
|
@@ -25,7 +26,7 @@ OPTS = {
|
|
25
26
|
#
|
26
27
|
def handle_argv
|
27
28
|
opt = OptionParser.new(BANNER)
|
28
|
-
opt.on( '--lang=LANGUAGE', sprintf("Programming Language like ruby (Def: %s).", OPTS[:lang])) { |v| OPTS[:lang]=v.strip }
|
29
|
+
opt.on( '--lang=LANGUAGE', sprintf("Programming Language like ruby (Def: %s).", OPTS[:lang]), ' NOTE: blocks starting with "% " => sh, "<[a-z]" => HTML in default.') { |v| OPTS[:lang]=v.strip }
|
29
30
|
# opt.on( '--version', "Display the version and exits.", TrueClass) {|v| OPTS[:version] = v} # Consider opts.on_tail
|
30
31
|
opt.on( '--[no-]debug', "Debug (Def: false)", TrueClass) {|v| OPTS[:debug] = v}
|
31
32
|
# opt.separator "" # Way to control a help message.
|
@@ -65,7 +66,7 @@ end
|
|
65
66
|
def fix_def_list(str)
|
66
67
|
str.gsub(/^(\S+[^\n]*)\n:((?:\s+[^\n]+(?:\n|\z))+)/m){
|
67
68
|
sdt, sdd = $1, $2
|
68
|
-
"<dt>%s</dt>\n<dd>%s</dd>\n"%[remove_mdfmt_raw(sdt), remove_mdfmt(sdd.
|
69
|
+
"<dt>%s</dt>\n<dd>%s</dd>\n"%[remove_mdfmt_raw(sdt), remove_mdfmt(sdd.chomp)]
|
69
70
|
}.gsub(/(\s+\n|\A)(<dt>)/m, '\1<dl>'+"\n"+'\2').gsub(%r@(</dd>[[:blank:]]*)(\n(?:\s+|\z))@, '\1'+"\n"+'</dl>\2')
|
70
71
|
end
|
71
72
|
|
@@ -124,7 +125,7 @@ end
|
|
124
125
|
# @return [Integer]
|
125
126
|
def min_indent(str, lb=$/)
|
126
127
|
return 0 if str.empty?
|
127
|
-
lines = PlainText::Part.parse(str).
|
128
|
+
lines = PlainText::Part.parse(str).paras.join("\n").split("\n")
|
128
129
|
lines.map{|ec| indent_line(ec)}.min
|
129
130
|
end
|
130
131
|
|
@@ -149,7 +150,7 @@ end
|
|
149
150
|
# @return [Integer]
|
150
151
|
def last_indent(str, indent_prev=0, lb=$/)
|
151
152
|
return indent_prev if !str || str.empty?
|
152
|
-
lines = PlainText::Part.parse(str).
|
153
|
+
lines = PlainText::Part.parse(str).paras.join("\n").split("\n")
|
153
154
|
# Note: numsps = 2 # "2." takes up 2 spaces, whereas "12." takes 3.
|
154
155
|
lines.each do |ec|
|
155
156
|
cind = indent_line(ec)
|
@@ -184,10 +185,10 @@ opts = handle_argv()
|
|
184
185
|
|
185
186
|
strin = ARGF.read
|
186
187
|
## split to paras, fixing inline code blocks
|
187
|
-
|
188
|
+
mdpara = PlainText::Part.parse(strin)
|
188
189
|
|
189
|
-
indent_prev = last_indent(
|
190
|
-
|
190
|
+
indent_prev = last_indent(mdpara[0])
|
191
|
+
mdpara.merge_para_if{ |pbp, _, _|
|
191
192
|
prev_cb = md_code_block?(pbp[0], indent_prev)
|
192
193
|
next_cb = md_code_block?(pbp[2], indent_prev)
|
193
194
|
next true if prev_cb && next_cb
|
@@ -195,17 +196,27 @@ mdpart.merge_para_if{ |pbp, _, _|
|
|
195
196
|
false
|
196
197
|
}
|
197
198
|
|
199
|
+
## Add a programming language to each code block.
|
198
200
|
indent_next = 0
|
199
|
-
|
201
|
+
mdpara = mdpara.map_para{|ec|
|
200
202
|
indent_prev = indent_next
|
201
203
|
indent_next = last_indent(ec, indent_prev)
|
202
204
|
next fix_string_based(ec) if !md_code_block?(ec, indent_prev)
|
203
205
|
inde = " "*indent_prev
|
204
206
|
st = ec.gsub(/^ /, '')
|
205
|
-
|
207
|
+
lang =
|
208
|
+
if (/\A\s*<[a-z]/i =~ st) && /^(javascript|x?html|xml|rss|xsd|wsdl)$/ !~ opts[:lang].downcase.strip
|
209
|
+
'html'
|
210
|
+
elsif (/\A\s*[%\$] /i =~ st) && /^(bash|zsh|shell-script|tex|latex)$/ !~ opts[:lang].downcase.strip
|
211
|
+
# NOTE: "postscr" (PostScript) starts from "%!PS" with no spaces in between.
|
212
|
+
'sh'
|
213
|
+
else
|
214
|
+
opts[:lang]
|
215
|
+
end
|
216
|
+
"%s```%s\n%s\n%s```"%[inde, lang, st, inde]
|
206
217
|
}
|
207
218
|
|
208
|
-
puts
|
219
|
+
puts mdpara.join('')
|
209
220
|
|
210
221
|
exit
|
211
222
|
|
@@ -12,8 +12,8 @@ module PlainText
|
|
12
12
|
# which returns an Array (referred to as +ary+ hereafter).
|
13
13
|
#
|
14
14
|
# The returned array +ary+ may contain Strings at the basic level. In that case,
|
15
|
-
# any
|
16
|
-
# semantically {PlainText::Part::Paragraph} or {PlainText::Part}, which can be further parsed
|
15
|
+
# any odd-index elements are semantically Boundaries ({PlainText::Part::Boundary}) and any even-index elements are
|
16
|
+
# semantically Paras ({PlainText::Part::Paragraph} or {PlainText::Part}), which can be further parsed
|
17
17
|
# in the later processing.
|
18
18
|
#
|
19
19
|
# Alternatively, the returned array +ary+ may contain
|
@@ -78,7 +78,7 @@ module PlainText
|
|
78
78
|
#
|
79
79
|
# Then,
|
80
80
|
#
|
81
|
-
# pt1.
|
81
|
+
# pt1.paras[0].paras[1] # => Paragraph::Title("Breaking!")
|
82
82
|
# pt1.boundaries[1] # => Boundary("\n======\n")
|
83
83
|
#
|
84
84
|
# @todo
|
@@ -122,7 +122,7 @@ module PlainText
|
|
122
122
|
# Optionally, when a non-Array argument or block is given, a name can be specified as the human-readable name for the rule.
|
123
123
|
#
|
124
124
|
# @option rule [ParseRule, Array, Regexp, Proc]
|
125
|
-
# @param name
|
125
|
+
# @param name [String, Symbol]
|
126
126
|
#
|
127
127
|
# @yield [inprm] Block to register.
|
128
128
|
# @yieldparam [String, Array<Part, Paragraph, Boundary>, Part] inprm Input String/Part/Array to apply the rule to.
|
@@ -221,7 +221,7 @@ module PlainText
|
|
221
221
|
# Optionally, providing non-Array argument or block is given, a name can be specified as the human-readable name for the rule.
|
222
222
|
#
|
223
223
|
# @option *rule [Regexp, Proc]
|
224
|
-
# @param name
|
224
|
+
# @param name [String, Symbol, NilClass, Array<String, Symbol, NilClass>] Array is not supported, yet.
|
225
225
|
# @return [self]
|
226
226
|
#
|
227
227
|
# @yield [inprm] Block to register.
|
@@ -398,7 +398,7 @@ module PlainText
|
|
398
398
|
# #=> ["abc", "==", "DEF", "==\n"])
|
399
399
|
#
|
400
400
|
# @param inprm [String, Array, PlainText::Part]
|
401
|
-
# @param index
|
401
|
+
# @param index [Array, Range, Integer, String, Symbol] If given, the rule(s) at the given index (indices) or key(s) only are applied in the given order.
|
402
402
|
# @return [Array] array of String, Paragraph, Boundary, Array, Part, etc
|
403
403
|
def apply(inprm, index: nil, from_string: true, from_array: true)
|
404
404
|
allrules = (index ? rules_at(index) : @rules)
|
data/lib/plain_text/part.rb
CHANGED
@@ -42,7 +42,7 @@ module PlainText
|
|
42
42
|
# (5) Boundary::General
|
43
43
|
# )
|
44
44
|
#
|
45
|
-
# A Section (Part) always has an even number of elements: pairs of ({Part}|{Paragraph}) and {Boundary} in this order.
|
45
|
+
# A Section (Part) always has an even number of elements: pairs of a Para ({Part}|{Paragraph}) and {Boundary} in this order.
|
46
46
|
#
|
47
47
|
# Note some standard destructive Array operations, most notably +#delete+, +#delete_if+, +#reject!+,
|
48
48
|
# +#select!+, +#filter!+, +#keep_if+, +#flatten!+, +#uniq!+ may alter the content in a way
|
@@ -83,7 +83,7 @@ module PlainText
|
|
83
83
|
}
|
84
84
|
private_constant :ERR_MSGS
|
85
85
|
|
86
|
-
# @param arin [Array] of [Paragraph1, Boundary1, Para2, Bd2, ...] or
|
86
|
+
# @param arin [Array] of [Paragraph1, Boundary1, Para2, Bd2, ...] or just Paragraphs if boundaries is given as the second arguments
|
87
87
|
# @param boundaries [Array] of Boundary
|
88
88
|
# @option recursive: [Boolean] if true (Default), normalize recursively.
|
89
89
|
# @option compact: [Boolean] if true (Default), pairs of nil paragraph and boundary are removed. Otherwise, nil is converted to an empty string.
|
@@ -122,10 +122,10 @@ module PlainText
|
|
122
122
|
# Unique instance methods (not existing in Array)
|
123
123
|
##########
|
124
124
|
|
125
|
-
# Returns an array of
|
125
|
+
# Returns an array of boundaries (odd-number-index elements), consisting of Boundaries
|
126
126
|
#
|
127
127
|
# @return [Array<Boundary>]
|
128
|
-
# @see #
|
128
|
+
# @see #paras
|
129
129
|
def boundaries
|
130
130
|
select.with_index { |_, i| i.odd? } rescue select.each_with_index { |_, i| i.odd? } # Rescue for Ruby 2.1 or earlier
|
131
131
|
end
|
@@ -167,20 +167,20 @@ module PlainText
|
|
167
167
|
map_boundary_core(map: false, with_index: true, **kwd, &bl)
|
168
168
|
end
|
169
169
|
|
170
|
-
# each method for
|
170
|
+
# each method for Paras only, providing also the index (always an even number) to the block.
|
171
171
|
#
|
172
|
-
# For just looping over the elements of {#
|
172
|
+
# For just looping over the elements of {#paras}, do simply
|
173
173
|
#
|
174
|
-
#
|
174
|
+
# paras.each do |ec|
|
175
175
|
# end
|
176
176
|
#
|
177
177
|
# The indices provided in this method are for the main Array,
|
178
|
-
# and hence different from {#
|
178
|
+
# and hence different from {#paras}.each_with_index
|
179
179
|
#
|
180
|
-
# @param (see #
|
180
|
+
# @param (see #map_para_with_index)
|
181
181
|
# @return as self
|
182
|
-
def
|
183
|
-
|
182
|
+
def each_para_with_index(**kwd, &bl)
|
183
|
+
map_para_core(map: false, with_index: false, **kwd, &bl)
|
184
184
|
end
|
185
185
|
|
186
186
|
# The first significant (=non-empty) element.
|
@@ -210,7 +210,7 @@ module PlainText
|
|
210
210
|
#
|
211
211
|
# @param i [Integer] index for the array of self
|
212
212
|
# @option skip_check: [Boolean] if true (Default: false), skip conversion of the negative index to positive.
|
213
|
-
# @see #
|
213
|
+
# @see #paras
|
214
214
|
def index_para?(i, skip_check: false)
|
215
215
|
skip_check ? i.even? : positive_array_index_checked(i, self).even?
|
216
216
|
end
|
@@ -261,9 +261,9 @@ module PlainText
|
|
261
261
|
map_boundary_core(with_index: true, **kwd, &bl)
|
262
262
|
end
|
263
263
|
|
264
|
-
# map method for
|
264
|
+
# map method for Paras only, returning a copied self.
|
265
265
|
#
|
266
|
-
# If recursive is true (Default), any
|
266
|
+
# If recursive is true (Default), any Paras in the descendant Parts are also handled.
|
267
267
|
#
|
268
268
|
# If a Paragraph is set nil or empty, along with the following Boundary,
|
269
269
|
# the pair is removed from the returned instance in Default (:compact and :compacter options
|
@@ -272,30 +272,30 @@ module PlainText
|
|
272
272
|
# @option recursive: [Boolean] if true (Default), map is performed recursively.
|
273
273
|
# @return as self
|
274
274
|
# @see #initialize for the other options (:compact and :compacter)
|
275
|
-
def
|
276
|
-
|
275
|
+
def map_para(**kwd, &bl)
|
276
|
+
map_para_core(with_index: false, **kwd, &bl)
|
277
277
|
end
|
278
278
|
|
279
|
-
# map method for
|
279
|
+
# map method for paras only, providing also the index (always an even number) to the block, returning a copied self.
|
280
280
|
#
|
281
|
-
# @param (see #
|
281
|
+
# @param (see #map_para)
|
282
282
|
# @return as self
|
283
|
-
def
|
284
|
-
|
283
|
+
def map_para_with_index(**kwd, &bl)
|
284
|
+
map_para_core(with_index: false, **kwd, &bl)
|
285
285
|
end
|
286
286
|
|
287
|
-
# merge
|
287
|
+
# merge Paras if they satisfy the conditions.
|
288
288
|
#
|
289
|
-
# A group of two
|
289
|
+
# A group of two Paras and the Boundaries in between and before and after
|
290
290
|
# is passed to the block consecutively.
|
291
291
|
#
|
292
292
|
# @yield [ary, b1, b2, i] Returns true if the two paragraphs should be merged.
|
293
293
|
# @yieldparam [Array] ary of [Para1st, BoundaryBetween, Para2nd]
|
294
|
-
# @yieldparam [Boundary] b1 Boundary-String before the first
|
295
|
-
# @yieldparam [Boundary] b2 Boundary-String after the second
|
294
|
+
# @yieldparam [Boundary] b1 Boundary-String before the first Para (nil for the first one)
|
295
|
+
# @yieldparam [Boundary] b2 Boundary-String after the second Para
|
296
296
|
# @yieldparam [Integer] i Index of the first Para
|
297
297
|
# @yieldreturn [Boolean, Symbol] True if they should be merged. :abort if cancel it.
|
298
|
-
# @return [self, false] false if no pairs of
|
298
|
+
# @return [self, false] false if no pairs of Paras are merged, else self.
|
299
299
|
def merge_para_if()
|
300
300
|
arind2del = [] # Indices to delete (both paras and boundaries)
|
301
301
|
each_index do |ei|
|
@@ -328,7 +328,7 @@ module PlainText
|
|
328
328
|
# @overload set(range)
|
329
329
|
# With a range of the indices to merge. Unless use_para_index is true, this means the main Array index. See the first overload set about it.
|
330
330
|
# @param range [Range] describe value param
|
331
|
-
# @param use_para_index
|
331
|
+
# @param use_para_index [Boolean] If false (Default), the indices are for the main indices (alternative between Paras and Boundaries, starting from Para). If true, the indices are as obtained with {#paras}, namely the array containing only Paras.
|
332
332
|
# @return [self, nil] nil if nothing is merged (because of wrong indices).
|
333
333
|
def merge_para!(*rest, use_para_index: false)
|
334
334
|
$myd = true
|
@@ -348,7 +348,7 @@ $myd = true
|
|
348
348
|
# while Boundary(5) stays as it is.
|
349
349
|
#
|
350
350
|
# @param (see #merge_para!)
|
351
|
-
# @param use_para_index
|
351
|
+
# @param use_para_index [Boolean] false
|
352
352
|
# @return [Range, nil] nil if no range is selected.
|
353
353
|
def build_index_range_for_merge_para!(*rest, use_para_index: false)
|
354
354
|
#warn "DEBUG:b0: #{rest.inspect} to_a=#{to_a}\n"
|
@@ -449,21 +449,20 @@ $myd = false
|
|
449
449
|
end
|
450
450
|
|
451
451
|
|
452
|
-
# Returns an array of
|
452
|
+
# Returns an array of Paras (even-number-index elements), consisting of Part and/or Paragraph
|
453
453
|
#
|
454
454
|
# @return [Array<Part, Paragraph>]
|
455
455
|
# @see #boundaries
|
456
|
-
def
|
456
|
+
def paras
|
457
457
|
select.with_index { |_, i| i.even? } rescue select.each_with_index { |_, i| i.even? } # Rescue for Ruby 2.1 or earlier
|
458
458
|
# ret.freeze
|
459
459
|
end
|
460
460
|
|
461
461
|
# Reparses self or a part of it.
|
462
462
|
#
|
463
|
-
# @
|
464
|
-
# @option
|
465
|
-
# @option
|
466
|
-
# @option range: [Range, nil] Range of indices of self to reparse. In Default, the entire self.
|
463
|
+
# @option rule [PlainText::ParseRule] (PlainText::ParseRule::RuleConsecutiveLbs)
|
464
|
+
# @option name [String, Symbol, Integer, nil] Identifier of rule, if need to specify.
|
465
|
+
# @option range [Range, nil] Range of indices of self to reparse. In Default, the entire self.
|
467
466
|
# @return [self]
|
468
467
|
def reparse!(rule: PlainText::ParseRule::RuleConsecutiveLbs, name: nil, range: (0..-1))
|
469
468
|
insert range.begin, self.class.parse((range ? self[range] : self), rule: rule, name: name)
|
@@ -581,7 +580,7 @@ $myd = false
|
|
581
580
|
# @param other [Object]
|
582
581
|
def ==(other)
|
583
582
|
return false if !other.class.method_defined?(:to_ary)
|
584
|
-
%i(
|
583
|
+
%i(paras boundaries).each do |ea_m| # %i(...) defined in Ruby 2.0 and later
|
585
584
|
return false if !other.class.method_defined?(ea_m) || (self.public_send(ea_m) != other.public_send(ea_m)) # public_send() defined in Ruby 2.0 (1.9?) and later
|
586
585
|
end
|
587
586
|
super
|
@@ -603,20 +602,20 @@ $myd = false
|
|
603
602
|
# @return as self
|
604
603
|
def +(other)
|
605
604
|
# ## The following is strict, but a bit redundant.
|
606
|
-
# #
|
607
|
-
# # %i(to_ary
|
608
|
-
# #
|
605
|
+
# # is_para = true # Whether "other" is a Part class instance.
|
606
|
+
# # %i(to_ary paras boundaries).each do |ea_m| # %i(...) defined in Ruby 2.0 and later
|
607
|
+
# # is_para &&= other.class.method_defined?(ea_m)
|
609
608
|
# # end
|
610
609
|
|
611
610
|
# begin
|
612
611
|
# other_even_odd =
|
613
|
-
# ([other.
|
612
|
+
# ([other.paras, other.boundaries] rescue even_odd_arrays(self, size_even: true, filler: ""))
|
614
613
|
# rescue NoMethodError
|
615
614
|
# raise TypeError, sprintf("no implicit conversion of %s into %s", other.class.name, self.class.name)
|
616
615
|
# end
|
617
616
|
|
618
617
|
# # eg., if self is PlainText::Part::Section, the returned object is the same.
|
619
|
-
# ret = self.class.new(self.
|
618
|
+
# ret = self.class.new(self.paras+other_even_odd[0], self.boundaries+other_even_odd[1])
|
620
619
|
ret = self.class.new super
|
621
620
|
ret.normalize!
|
622
621
|
end
|
@@ -733,7 +732,7 @@ $myd = false
|
|
733
732
|
# The result may not be in an even number anymore. Correct it.
|
734
733
|
Boundary.insert_original_b4_part(size, "") if size.odd?
|
735
734
|
|
736
|
-
# Original method may fill some
|
735
|
+
# Original method may fill some elements of the array with String or even nil.
|
737
736
|
normalize!
|
738
737
|
ret
|
739
738
|
end
|
@@ -825,7 +824,7 @@ $myd = false
|
|
825
824
|
#
|
826
825
|
# @see #insert
|
827
826
|
#
|
828
|
-
# @param
|
827
|
+
# @param rest [Array<Array>]
|
829
828
|
# @return [self]
|
830
829
|
def concat(*rest)
|
831
830
|
insert(size, *(rest.sum([])))
|
@@ -835,7 +834,7 @@ $myd = false
|
|
835
834
|
#
|
836
835
|
# @see #concat
|
837
836
|
#
|
838
|
-
# @param
|
837
|
+
# @param rest [Array]
|
839
838
|
# @return [self]
|
840
839
|
def push(*rest)
|
841
840
|
concat(rest)
|
@@ -892,7 +891,7 @@ $myd = false
|
|
892
891
|
# @return [Integer, nil] nil if a too large index is specified.
|
893
892
|
def get_valid_ipos_for_boundary(index)
|
894
893
|
i_pos = positive_array_index_checked(index, self)
|
895
|
-
raise ArgumentError, "Index #{index} specified was for
|
894
|
+
raise ArgumentError, "Index #{index} specified was for Para, which should be for Boundary." if index_para?(i_pos, skip_check: true)
|
896
895
|
(i_pos > size - 1) ? nil : i_pos
|
897
896
|
end
|
898
897
|
private :get_valid_ipos_for_boundary
|
@@ -920,16 +919,16 @@ $myd = false
|
|
920
919
|
end
|
921
920
|
private :map_boundary_core
|
922
921
|
|
923
|
-
# Core routine for {#
|
922
|
+
# Core routine for {#map_para}
|
924
923
|
#
|
925
924
|
# @option map: [Boolean] if true (Default), map is performed. Else just each.
|
926
925
|
# @option with_index: [Boolean] if true (Default: false), yield with also index
|
927
926
|
# @option recursive: [Boolean] if true (Default), map is performed recursively.
|
928
927
|
# @return as self
|
929
928
|
# @see #initialize for the other options (:compact and :compacter)
|
930
|
-
def
|
929
|
+
def map_para_core(map: true, with_index: false, recursive: true, **kwd, &bl)
|
931
930
|
ind = -1
|
932
|
-
|
931
|
+
new_paras = paras.map{ |ec|
|
933
932
|
ind += 1
|
934
933
|
if recursive && ec.class.method_defined?(__method__)
|
935
934
|
ec.public_send(__method__, recursive: true, **kwd, &bl)
|
@@ -937,9 +936,9 @@ $myd = false
|
|
937
936
|
with_index ? yield(ec, ind) : yield(ec)
|
938
937
|
end
|
939
938
|
}
|
940
|
-
self.class.new
|
939
|
+
self.class.new new_paras, boundaries, recursive: recursive, **kwd if map
|
941
940
|
end
|
942
|
-
private :
|
941
|
+
private :map_para_core
|
943
942
|
|
944
943
|
# Core routine for {#normalize!} and {#normalize}
|
945
944
|
#
|
@@ -1051,7 +1050,7 @@ class Array
|
|
1051
1050
|
# @param other [Object]
|
1052
1051
|
def ==(other)
|
1053
1052
|
return false if !other.class.method_defined?(:to_ary)
|
1054
|
-
%i(
|
1053
|
+
%i(paras boundaries).each do |ea_m| # %i(...) defined in Ruby 2.0 and later
|
1055
1054
|
return equal_original_b4_part?(other) if !other.class.method_defined?(ea_m)
|
1056
1055
|
return false if !self.class.method_defined?(ea_m) || (self.public_send(ea_m) != other.public_send(ea_m)) # public_send() defined in Ruby 2.0 (1.9?) and later
|
1057
1056
|
end
|
data/lib/plain_text/split.rb
CHANGED
@@ -52,8 +52,8 @@ module PlainText
|
|
52
52
|
#
|
53
53
|
# @param instr [String] String that is examined.
|
54
54
|
# @param re_in [Regexp, String] If String, it is interpreted literally as in String#split.
|
55
|
-
# @param like_linenum
|
56
|
-
# @param with_if_end
|
55
|
+
# @param like_linenum [Boolean] if true (Def: false), it counts like the line number.
|
56
|
+
# @param with_if_end [Boolean] a special case (see the description).
|
57
57
|
# @return [Integer] always positive
|
58
58
|
# @see PlainText::Split#count_regexp
|
59
59
|
def self.count_regexp(instr, re_in, like_linenum: false, with_if_end: false)
|
@@ -72,7 +72,7 @@ module PlainText
|
|
72
72
|
# One more parameter (input String) is required to specify.
|
73
73
|
#
|
74
74
|
# @param instr [String] String that is examined.
|
75
|
-
# @param linebreak
|
75
|
+
# @param linebreak [String] +\n+ etc (Default: $/).
|
76
76
|
# @return [Integer] always positive
|
77
77
|
# @see #count_lines
|
78
78
|
def self.count_lines(instr, linebreak: $/)
|
@@ -124,7 +124,7 @@ module PlainText
|
|
124
124
|
# s.split_with_delimiter(/X+(Q?)/)
|
125
125
|
# #=> ["", "XQ", "ab", "XX", "c", "XQ"]
|
126
126
|
#
|
127
|
-
# @param
|
127
|
+
# @param rest [Regexp, String] If String, it is interpreted literally as in String#split.
|
128
128
|
# @return [Array]
|
129
129
|
def split_with_delimiter(*rest)
|
130
130
|
PlainText::Split.public_send(__method__, self, *rest)
|
@@ -150,9 +150,10 @@ module PlainText
|
|
150
150
|
# (This parameter is introduced just to reduce the overhead of
|
151
151
|
# potentially calling this routine twice or user's making their own check.)
|
152
152
|
#
|
153
|
-
# @param
|
154
|
-
# @param like_linenum:
|
155
|
-
#
|
153
|
+
# @param rest [Regexp, String] re_in: If String, it is interpreted literally as in String#split.
|
154
|
+
# @param kwd [Hash<like_linenum: Boolean, with_if_end: Boolean>]
|
155
|
+
# if like_linenum: true (Def: false), it counts like the line number.
|
156
|
+
# with_if_end: a special case (see the description).
|
156
157
|
# @return [Integer, Array<Integer, Boolean>] always positive
|
157
158
|
# @see PlainText::Split#count_regexp
|
158
159
|
def count_regexp(*rest, **kwd)
|
@@ -161,7 +162,7 @@ module PlainText
|
|
161
162
|
|
162
163
|
# Returns the number of lines.
|
163
164
|
#
|
164
|
-
# @param linebreak:
|
165
|
+
# @param kwd [Hash<linebreak: String>] +\n+ etc (Default: $/).
|
165
166
|
# @return [Integer] always positive
|
166
167
|
# @see PlainText::Split#count_regexp
|
167
168
|
def count_lines(**kwd)
|
data/lib/plain_text/util.rb
CHANGED
@@ -44,8 +44,8 @@ module PlainText
|
|
44
44
|
# # => [[33, 55], [44, ""]]
|
45
45
|
#
|
46
46
|
# @param ary [Array]
|
47
|
-
# @param size_even
|
48
|
-
# @param filler
|
47
|
+
# @param size_even [Boolean] if true (Def: false), the sizes of the returned arrays are guaranteed to be identical.
|
48
|
+
# @param filler [Object] if size_even: is true and if matching is performed, this filler is added at the end of the last element.
|
49
49
|
def even_odd_arrays(ary, size_even: false, filler: "")
|
50
50
|
ar_even = select.with_index { |_, i| i.even? } rescue select.each_with_index { |_, i| i.even? } # Rescue for Ruby 2.1 or earlier
|
51
51
|
ar_odd = select.with_index { |_, i| i.odd? } rescue select.each_with_index { |_, i| i.odd? } # Rescue for Ruby 2.1 or earlier
|
@@ -83,8 +83,8 @@ module PlainText
|
|
83
83
|
#
|
84
84
|
# @param index_in [Integer] Index to check and convert from. Potentially negative integer.
|
85
85
|
# @param ary [Array, Integer, nil] Reference Array or its size (Array#size) or nil (interpreted as self#size (untested)).
|
86
|
-
# @param accept_too_big
|
87
|
-
# @param varname
|
86
|
+
# @param accept_too_big [Boolean, NilClass] if true (Default), a positive index larger than the last array index is returned as it is. If nil, the last index + 1 is accepted but raises an Exception for anything larger. If false, any index larger than the last index raises an Exception.
|
87
|
+
# @param varname [NilClass, String] Name of the variable (or nil) to be used for error messages.
|
88
88
|
# @return [Integer] Non-negative index; i.e., if index=-1 is specified for an Array with a size of 3, the returned value is 2 (the last index of it).
|
89
89
|
# @raise [IndexError] if the index is out of the range to negative.
|
90
90
|
# @raise [ArgumentError] if ary is neither an Array nor Integer, or more specifically, it does not have size method or ary.size does not return Integer or similar.
|
@@ -115,8 +115,8 @@ module PlainText
|
|
115
115
|
#
|
116
116
|
# @param from [Array, Range]
|
117
117
|
# @param arref [Array, Integer] Reference Array or its size (Array#size) or nil (interpreted as self#size).
|
118
|
-
# @param flatten
|
119
|
-
# @param sortuniq
|
118
|
+
# @param flatten [Boolean] If true (Default), if elements are Range, they are unfolded. If false and if an Array containing a Range, Exception is raised.
|
119
|
+
# @param sortuniq [Boolean] If true (Default), the return is sorted and uniq-ed.
|
120
120
|
# @return [Array, nil] nil if arref is empty or if out of range to the negative. Note in most cases in Ruby default, it raises IndexError. See the code of {#positive_array_index_checked}
|
121
121
|
# @raise [TypeError] if non-integer is specified.
|
122
122
|
# @raise [ArgumentError] if arref is neither an Array nor Integer, or more specifically, it does not have size method or arref.size does not return Integer or similar.
|
data/lib/plain_text.rb
CHANGED
@@ -131,18 +131,18 @@ module PlainText
|
|
131
131
|
# /(\A[[:blank:]]+|\n[[:space:]]+)/
|
132
132
|
#
|
133
133
|
# @param prt [PlainText:Part, String] {Part} or String to examine.
|
134
|
-
# @param preserve_paragraph
|
135
|
-
# @param boundary_style
|
136
|
-
# @param lbs_style
|
137
|
-
# @param sps_style
|
138
|
-
# @param lb_is_space
|
139
|
-
# @param delete_asian_space
|
140
|
-
# @param linehead_style
|
141
|
-
# @param linetail_style
|
142
|
-
# @param firstlbs_style
|
143
|
-
# @param lastsps_style
|
144
|
-
# @param lb
|
145
|
-
# @param lb_out
|
134
|
+
# @param preserve_paragraph [Boolean] Paragraphs are taken into account if true (Def: False). In the input, paragraphs are defined to be separated with more than one +lb+ with potentially some space characters in between. Their output style is specified with +boundary_style+.
|
135
|
+
# @param boundary_style [String, Symbol] One of +(:truncate|:truncate2|:delete|:none)+ or String. If String, the boundaries between paragraphs are replaced with this String (Def: +lb_out*2+). If +:truncate+, consecutive linebreaks and spaces are truncated into 2 linebreaks. +:truncate2+ are similar, but they are not truncated beyond 3 linebreaks (ie., up to 2 blank lines between Paragraphs). If +:none+, nothing is done about them. Unless :none, all the white spaces between linebreaks are deleted.
|
136
|
+
# @param lbs_style [Symbol] One of +(:truncate|:delete|:none)+ (Def: +:truncate+). If :delete, all the linebreaks within paragraphs are deleted. +:truncate+ is meaningful only when +preserve_paragraph=false+ and consecutive linebreaks are truncated into 1 linebreak.
|
137
|
+
# @param sps_style [Symbol] One of +(:truncate|:delete|:none)+ (Def: +:truncate+). If +:truncate+, the consecutive white spaces within paragraphs, *except* for those at the line-head or line-tail (which are controlled by +linehead_style+ and +linehead_style+, respectively), are truncated into a single white space. If :delete, they are deleted.
|
138
|
+
# @param lb_is_space [Boolean] If true, a line-break, except those for the boundaries (unless +preserve_paragraph+ is false), is equivalent to a space (Def: False).
|
139
|
+
# @param delete_asian_space [Boolean] Any spaces between, before, after Asian characters (but punctuation) are deleted, if true (Default).
|
140
|
+
# @param linehead_style [Symbol] One of +(:truncate|:delete|:none)+ (Def: :none). Determine how to handle consecutive white spaces at the beggining of each line.
|
141
|
+
# @param linetail_style [Symbol] One of +(:truncate|:delete|:markdown|:none)+ (Def: :delete). Determine how to handle consecutive white spaces at the end of each line. If +:markdown, 1 space is always deleted, and two or more spaces are truncated into two ASCII whitespaces *if* the last two spaces are ASCII whitespaces, or else untouched.
|
142
|
+
# @param firstlbs_style [Symbol, String] One of +(:truncate|:delete|:none)+ or String (Def: :default). If +:truncate+, any linebreaks at the very beginning of self (and whitespaces in between), if exist, are truncated to a single linebreak. If String, they are, even if not exists, replaced with the specified String (such as a linebreak). If +:delete+, they are deleted. Note This option has nothing to do with the whitespaces at the beginning of the first significant line (hence the name of the option). Note if a (random) Part is given, this option only considers the first significant element of it.
|
143
|
+
# @param lastsps_style [Symbol, String] One of +(:truncate|:delete|:none|:linebreak)+ or String (Def: :truncate). If +:truncate+, any of linebreaks *AND* white spaces at the tail of self, if exist, are truncated to a single linebreak. If +:delete+, they are deleted. If String, they are, even if not exists, replaced with the specified String (such as a linebreak, in which case +lb_out+ is used as String, i.e., it guarantees only 1 linebreak to exist at the end of the String). Note if a (random) Part is given, this option only considers the last significant element of it.
|
144
|
+
# @param lb [String] Linebreak character like +\n+ etc (Default: $/). If this is one of the standard line-breaks, irregular line-breaks (for example, existence of CR when only LF should be there) are corrected.
|
145
|
+
# @param lb_out [String] Linebreak used for output (Default: +lb+)
|
146
146
|
# @return same as prt
|
147
147
|
#
|
148
148
|
def self.clean_text(
|
@@ -336,9 +336,9 @@ module PlainText
|
|
336
336
|
# Linebreaks and spaces
|
337
337
|
case lbs_style
|
338
338
|
when :truncate, :t
|
339
|
-
prt.
|
339
|
+
prt.paras.each{|ec| ec.gsub!(/\n{2,}/m, "\n")}
|
340
340
|
when :delete, :d
|
341
|
-
prt.
|
341
|
+
prt.paras.each{|ec| ec.gsub!(/\n/m, "")}
|
342
342
|
when :none, :n
|
343
343
|
# Does nothing
|
344
344
|
else
|
@@ -350,13 +350,13 @@ module PlainText
|
|
350
350
|
|
351
351
|
# Linebreaks become spaces
|
352
352
|
if lb_is_space
|
353
|
-
prt.
|
353
|
+
prt.paras.each{|ec| ec.gsub!(/\n/m, " ")}
|
354
354
|
clean_text_sps!(prt, sps_style: sps_style, is_debug: is_debug) if sps_style == :truncate
|
355
355
|
end
|
356
356
|
|
357
357
|
# Ignore spaces between, before, and after Asian characters.
|
358
358
|
if delete_asian_space
|
359
|
-
prt.
|
359
|
+
prt.paras.each do |ea_p|
|
360
360
|
PlainText.extend_this(ea_p)
|
361
361
|
ea_p.delete_spaces_bw_cjk_european! # Destructive change in prt.
|
362
362
|
end
|
@@ -380,9 +380,9 @@ module PlainText
|
|
380
380
|
# Head of each line
|
381
381
|
case linehead_style
|
382
382
|
when :truncate, :t
|
383
|
-
prt.
|
383
|
+
prt.paras.each{|ec| ec.gsub!(/^[[:blank:]]+/, " ")}
|
384
384
|
when :delete, :d
|
385
|
-
prt.
|
385
|
+
prt.paras.each{|ec| ec.gsub!(/^[[:blank:]]+/, "")}
|
386
386
|
when :none, :n
|
387
387
|
# Do nothing
|
388
388
|
else
|
@@ -392,13 +392,13 @@ module PlainText
|
|
392
392
|
# Tail of each line
|
393
393
|
case linetail_style
|
394
394
|
when :truncate, :t
|
395
|
-
prt.
|
395
|
+
prt.paras.each{|ec| ec.gsub!(/[[:blank:]]+$/, " ")}
|
396
396
|
when :delete, :d
|
397
|
-
prt.
|
397
|
+
prt.paras.each{|ec| ec.gsub!(/[[:blank:]]+$/, "")}
|
398
398
|
when :markdown, :m
|
399
399
|
# Two spaces are preserved
|
400
|
-
prt.
|
401
|
-
prt.
|
400
|
+
prt.paras.each{|ec| ec.gsub!(/(?:^|(?<![[:blank:]]))[[:blank:]]$/, "")} # A single space is deleted.
|
401
|
+
prt.paras.each{|ec| ec.gsub!(/[[:blank:]]+ $/, " ")} # 3 or more spaces are truncated into 2 spaces, only IF the last two spaces are the ASCII spaces.
|
402
402
|
when :none, :n
|
403
403
|
# Do nothing
|
404
404
|
else
|
@@ -499,10 +499,10 @@ module PlainText
|
|
499
499
|
is_debug: false
|
500
500
|
)
|
501
501
|
|
502
|
-
prt.
|
502
|
+
prt.paras.each do |e_pa|
|
503
503
|
# Each line treated as a Paragraph, and [[:space:]]+ between them as a Boundary.
|
504
504
|
# Then, to work on anything within a line except for line-head/tail is easy.
|
505
|
-
prt_para = Part.parse(e_pa, rule: ParseRule::RuleEachLineStrip).
|
505
|
+
prt_para = Part.parse(e_pa, rule: ParseRule::RuleEachLineStrip).map_para { |e_li|
|
506
506
|
case sps_style
|
507
507
|
when :truncate, :t
|
508
508
|
e_li.gsub(/[[:blank:]]{2,}/m, " ")
|
@@ -513,7 +513,7 @@ module PlainText
|
|
513
513
|
else
|
514
514
|
raise ArgumentError
|
515
515
|
end
|
516
|
-
} #
|
516
|
+
} # map_para
|
517
517
|
e_pa.replace prt_para.join
|
518
518
|
end
|
519
519
|
end
|
@@ -587,9 +587,9 @@ module PlainText
|
|
587
587
|
# if num is +/ABC/+ (Regexp), String of the lines from the beginning up to the line that contains the character +"ABC"+ is returned.
|
588
588
|
#
|
589
589
|
# @param num_in [Integer, Regexp] Number (positive or negative, but not 0) of :unit to extract (Def: 10), or Regexp, which is valid only if unit is :line.
|
590
|
-
# @param unit
|
591
|
-
# @param inclusive
|
592
|
-
# @param linebreak
|
590
|
+
# @param unit [Symbol, String] One of +:line+ (or +"-n"+), :+char+, +:byte+ (or +"-c"+)
|
591
|
+
# @param inclusive [Boolean] read only when unit is :line. If inclusive (Default), the (entire) line that matches is included in the result.
|
592
|
+
# @param linebreak [String] +\n+ etc (Default: +$/+), used when +unit==:line+ (Default)
|
593
593
|
# @return [String] as self
|
594
594
|
def head(num_in=DEF_HEADTAIL_N_LINES, unit: :line, inclusive: true, padding: 0, linebreak: $/)
|
595
595
|
if num_in.class.method_defined? :to_int
|
@@ -670,10 +670,10 @@ module PlainText
|
|
670
670
|
|
671
671
|
# String#strip! for each line
|
672
672
|
#
|
673
|
-
# @param strip_head
|
674
|
-
# @param strip_tail
|
675
|
-
# @param markdown
|
676
|
-
# @param linebreak
|
673
|
+
# @param strip_head [Boolean] if true (Default), spaces at each line head are removed.
|
674
|
+
# @param strip_tail [Boolean] if true (Default), spaces at each line tail are removed (see +markdown+ option).
|
675
|
+
# @param markdown [Boolean] if true (Def: false), a double space at each tail remains and +strip_head+ is forcibly false.
|
676
|
+
# @param linebreak [String] +\n+ etc (Default: +$/+)
|
677
677
|
# @return [self, NilClass] nil if gsub! does not match at all, i.e., there are no spaces to remove.
|
678
678
|
def strip_at_lines!(strip_head: true, strip_tail: true, markdown: false, linebreak: $/)
|
679
679
|
strip_head = false if markdown
|
@@ -695,7 +695,7 @@ module PlainText
|
|
695
695
|
|
696
696
|
# String#strip! for each line but only for the head part (NOT tail part)
|
697
697
|
#
|
698
|
-
# @param linebreak
|
698
|
+
# @param linebreak [String] "\n" etc (Default: $/)
|
699
699
|
# @return [self, NilClass] nil if gsub! does not match at all, i.e., there are no spaces to remove.
|
700
700
|
def strip_at_lines_head!(linebreak: $/)
|
701
701
|
lb_quo = Regexp.quote linebreak
|
@@ -714,8 +714,8 @@ module PlainText
|
|
714
714
|
|
715
715
|
# String#strip! for each line but only for the tail part (NOT head part)
|
716
716
|
#
|
717
|
-
# @param markdown
|
718
|
-
# @param linebreak
|
717
|
+
# @param markdown [Boolean] if true (Def: false), a double space at each tail remains.
|
718
|
+
# @param linebreak [String] "\n" etc (Default: $/)
|
719
719
|
# @return [self, NilClass] nil if gsub! does not match at all, i.e., there are no spaces to remove.
|
720
720
|
def strip_at_lines_tail!(markdown: false, linebreak: $/)
|
721
721
|
lb_quo = Regexp.quote linebreak
|
@@ -775,9 +775,9 @@ module PlainText
|
|
775
775
|
# *all the lines from Line 1* would be included, which is most likely not what the caller wants.
|
776
776
|
#
|
777
777
|
# @param num_in [Integer, Regexp] Number (positive or negative, but not 0) of :unit to extract (Def: 10), or Regexp, which is valid only if unit is :line. If positive, the last num_in lines are returned. If negative, the lines from the num-in-th line from the head are returned. In short, calling this method as +tail(3)+ and +tail(-3)+ is similar to the UNIX commands "tail -n 3" and "tail -n +3", respectively.
|
778
|
-
# @param unit
|
779
|
-
# @param inclusive
|
780
|
-
# @param linebreak
|
778
|
+
# @param unit [Symbol] One of :line (as in -n option), :char, :byte (-c option)
|
779
|
+
# @param inclusive [Boolean] read only when unit is :line. If inclusive (Default), the (entire) line that matches is included in the result.
|
780
|
+
# @param linebreak [String] +\n+ etc (Default: +$/+), used when unit==:line (Default)
|
781
781
|
# @return [String] as self
|
782
782
|
def tail(num_in=DEF_HEADTAIL_N_LINES, unit: :line, inclusive: true, padding: 0, linebreak: $/)
|
783
783
|
|
@@ -836,9 +836,9 @@ module PlainText
|
|
836
836
|
# @todo Improve the algorithm like {#tail_regexp}
|
837
837
|
#
|
838
838
|
# @param re_in [Regexp] Regexp to determine the boundary.
|
839
|
-
# @param inclusive
|
840
|
-
# @param padding
|
841
|
-
# @param linebreak
|
839
|
+
# @param inclusive [Boolean] If true (Default), the (entire) line that matches re_in is included in the result. Else the entire line is excluded.
|
840
|
+
# @param padding [Integer] Add (postive/negative) the number of lines returned.
|
841
|
+
# @param linebreak [String] +\n+ etc (Default: $/).
|
842
842
|
# @return [String] as self
|
843
843
|
# @see #head
|
844
844
|
def head_regexp(re_in, inclusive: true, padding: 0, linebreak: $/)
|
@@ -899,7 +899,7 @@ module PlainText
|
|
899
899
|
# pre_match_in_line( "__abc") # => #<MatchData "__abc"> pre_match==" "
|
900
900
|
#
|
901
901
|
# @param strpre [String] String of prematch of the last MatchData
|
902
|
-
# @param linebreak
|
902
|
+
# @param linebreak [String] +\n+ etc (Default: $/)
|
903
903
|
# @return [MatchData] m[0] is the string after the last linebreak before the matched data (exclusive) and m.pre_match is all the lines before that.
|
904
904
|
def pre_match_in_line(strpre, linebreak: $/)
|
905
905
|
lb_quo = Regexp.quote linebreak
|
@@ -918,7 +918,7 @@ module PlainText
|
|
918
918
|
#
|
919
919
|
# @param mat [MatchData, String] If String, it is User's (last) matched String.
|
920
920
|
# @param strpre [String, nil] Pre-match from the beginning of self to the mathced string, if mat is String.
|
921
|
-
# @param linebreak
|
921
|
+
# @param linebreak [String] +\n+ etc (Default: $/)
|
922
922
|
# @return [Hash<Integer, nil>] 4 keys: :last_prematch, :first_matched, :last_matched, :first_post_match
|
923
923
|
def _matched_line_indices(mat, strpre=nil, linebreak: $/)
|
924
924
|
if mat.class.method_defined? :post_match
|
@@ -966,7 +966,7 @@ module PlainText
|
|
966
966
|
#
|
967
967
|
# @param mat [MatchData, String] If String, it is User's (last) matched String.
|
968
968
|
# @param strpost [String, nil] Post-match, if mat is String. After User's last match.
|
969
|
-
# @param linebreak
|
969
|
+
# @param linebreak [String] +\n+ etc (Default: $/)
|
970
970
|
# @return [MatchData] m[0] is the string after matched data and up to the next first linebreak (inclusive) (or empty string if the last character(s) of matched data is the linebreak) and m.post_match is all the lines after that. (maybe nil?? not sure...)
|
971
971
|
def post_match_in_line(mat, strpost=nil, linebreak: $/)
|
972
972
|
lb_quo = Regexp.quote linebreak
|
@@ -994,8 +994,8 @@ module PlainText
|
|
994
994
|
# 6. pass it to {#head_inverse} (after Line-1).
|
995
995
|
#
|
996
996
|
# @param re_in [Regexp] Regexp to determine the boundary.
|
997
|
-
# @param inclusive
|
998
|
-
# @param linebreak
|
997
|
+
# @param inclusive [Boolean] If true (Default), the (entire) line that matches re_in is included in the result. Else the entire line is excluded.
|
998
|
+
# @param linebreak [String] +\n+ etc (Default: $/).
|
999
999
|
# @return [String] as self
|
1000
1000
|
# @see #tail
|
1001
1001
|
def tail_regexp(re_in, inclusive: true, padding: 0, linebreak: $/)
|
@@ -1030,7 +1030,7 @@ module PlainText
|
|
1030
1030
|
#
|
1031
1031
|
# @param num_in [Integer] Original argument of the specified number of lines
|
1032
1032
|
# @param num [Integer] Converted integer for num_in
|
1033
|
-
# @param linebreak
|
1033
|
+
# @param linebreak [String] +\n+ etc (Default: $/).
|
1034
1034
|
# @return [String] as self
|
1035
1035
|
# @see #tail
|
1036
1036
|
def tail_linenum(num_in, num, linebreak: $/)
|
data/plain_text.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'date'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{plain_text}.sub(/.*/){|c| (c == File.basename(Dir.pwd)) ? c : raise("ERROR: s.name=(#{c}) in gemspec seems wrong!")}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.7".sub(/.*/){|c| fs = Dir.glob('changelog{,.*}', File::FNM_CASEFOLD); raise('More than one ChangeLog exist!') if fs.size > 1; warn("WARNING: Version(s.version=#{c}) already exists in #{fs[0]} - ok?") if fs.size == 1 && !IO.readlines(fs[0]).grep(/^\(Version: #{Regexp.quote c}\)$/).empty? ; c } # n.b., In macOS, changelog and ChangeLog are identical in default.
|
9
9
|
# s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
10
|
s.bindir = 'bin'
|
11
11
|
%w(countchar textclean head.rb tail.rb yard2md_afterclean).each do |f|
|
@@ -13,12 +13,12 @@ Gem::Specification.new do |s|
|
|
13
13
|
File.executable?(path) ? s.executables << f : raise("ERROR: Executable (#{path}) is not executable!")
|
14
14
|
end
|
15
15
|
s.authors = ["Masa Sakano"]
|
16
|
-
s.date = %q{
|
16
|
+
s.date = %q{2022-08-25}.sub(/.*/){|c| (Date.parse(c) == Date.today) ? c : raise("ERROR: s.date=(#{c}) is not today!")}
|
17
17
|
s.summary = %q{Module to handle Plain-Text}
|
18
18
|
s.description = %q{This module provides utility functions and methods to handle plain text, classes Part/Paragraph/Boundary to represent the logical structure of a document and ParseRule to describe the rules to parse plain text to produce a Part-type Ruby instance. A few handy Ruby executable scripts to make use of them are included.}
|
19
19
|
# s.email = %q{abc@example.com}
|
20
20
|
s.extra_rdoc_files = [
|
21
|
-
# "LICENSE",
|
21
|
+
# "LICENSE.txt",
|
22
22
|
"README.en.rdoc",
|
23
23
|
]
|
24
24
|
s.license = 'MIT'
|
@@ -48,8 +48,8 @@ Gem::Specification.new do |s|
|
|
48
48
|
# s.rubygems_version = %q{1.3.5} # This is always set automatically!!
|
49
49
|
|
50
50
|
s.metadata["yard.run"] = "yri" # use "yard" to build full HTML docs.
|
51
|
-
s.metadata["changelog_uri"] = "https://github.com/masasakano/#{s.name}/blob/master/ChangeLog"
|
52
|
-
s.metadata["source_code_uri"] = "https://github.com/masasakano/#{s.name}"
|
51
|
+
# s.metadata["changelog_uri"] = "https://github.com/masasakano/#{s.name}/blob/master/ChangeLog"
|
52
|
+
# s.metadata["source_code_uri"] = "https://github.com/masasakano/#{s.name}"
|
53
53
|
# s.metadata["documentation_uri"] = "https://www.example.info/gems/bestgemever/0.0.1"
|
54
54
|
end
|
55
55
|
|
@@ -50,7 +50,7 @@ class TestUnitPlainTextPart < MiniTest::Test
|
|
50
50
|
# p pt1.to_a.class
|
51
51
|
assert_equal a1[0], pt1[0]
|
52
52
|
assert_equal a1[1], pt1[1]
|
53
|
-
assert_equal ap1, pt1.
|
53
|
+
assert_equal ap1, pt1.paras
|
54
54
|
assert_equal ab1, pt1.boundaries
|
55
55
|
assert_equal a1, pt1.to_a
|
56
56
|
assert_operator a1, '!=', pt1
|
@@ -59,7 +59,7 @@ class TestUnitPlainTextPart < MiniTest::Test
|
|
59
59
|
pt2 = Pt.new(a2)
|
60
60
|
assert_equal a2[0], pt2[0]
|
61
61
|
assert_equal a2[2], pt2[2]
|
62
|
-
assert_equal ap2, pt2.
|
62
|
+
assert_equal ap2, pt2.paras
|
63
63
|
assert_equal ab2, pt2.boundaries
|
64
64
|
assert_equal a2+[""], pt2.to_a # An empty String is appended.
|
65
65
|
assert_operator a2, '!=', pt2
|
@@ -196,7 +196,7 @@ class TestUnitPlainTextPart < MiniTest::Test
|
|
196
196
|
|
197
197
|
pt2 = pt1[0, 4]
|
198
198
|
assert_equal pt1.class, pt2.class
|
199
|
-
assert_equal pt1.
|
199
|
+
assert_equal pt1.paras[0, 2], pt2.paras
|
200
200
|
assert_equal pt1.boundaries[0, 2], pt2.boundaries
|
201
201
|
|
202
202
|
# negative or too-big out-of-bound begin
|
@@ -337,7 +337,7 @@ class TestUnitPlainTextPart < MiniTest::Test
|
|
337
337
|
# 0 1 2 3 4 5 6 7 8 9
|
338
338
|
pt1 = Pt.parse s1
|
339
339
|
assert_equal 10, pt1.size
|
340
|
-
assert_equal 5, pt1.
|
340
|
+
assert_equal 5, pt1.paras.size
|
341
341
|
assert_equal "b\n\n", pt1[2..3].join
|
342
342
|
|
343
343
|
pt2 = pt1.dup
|
@@ -417,8 +417,8 @@ class TestUnitPlainTextPart < MiniTest::Test
|
|
417
417
|
s1 = "a\n\n\nb\n\n\nc\n\n"
|
418
418
|
pt1 = Pt.parse s1
|
419
419
|
assert_equal 6, pt1.size
|
420
|
-
assert_equal 3, pt1.
|
421
|
-
assert_equal %w(a b c), pt1.
|
420
|
+
assert_equal 3, pt1.paras.size
|
421
|
+
assert_equal %w(a b c), pt1.paras
|
422
422
|
assert_equal Pt::Paragraph, pt1[0].class
|
423
423
|
assert_equal Pt::Boundary, pt1[1].class
|
424
424
|
assert_equal s1, pt1.join
|
@@ -58,14 +58,50 @@ class TestUnitYard2mdRb < MiniTest::Test
|
|
58
58
|
assert_equal exp, o, "期待:#{exp.inspect} ⇔ \n実際:#{o.inspect}"
|
59
59
|
assert_empty e
|
60
60
|
|
61
|
-
stin = "
|
61
|
+
stin = " abc def " + "\n\n\n efg\n"
|
62
62
|
srub = "```ruby\n"
|
63
|
-
exp = srub+"
|
63
|
+
exp = srub+"abc def \n```\n\n\n efg\n"
|
64
64
|
o, e, s = Open3.capture3 EXE, stdin_data: stin
|
65
65
|
assert_equal 0, s.exitstatus
|
66
66
|
assert_equal exp, o, "期待:#{exp.inspect} ⇔ \n実際:#{o.inspect}"
|
67
67
|
assert_empty e
|
68
68
|
|
69
|
+
# automated judge: sh
|
70
|
+
stin = " % abc def " + "\n\n\n efg\n"
|
71
|
+
srub = "```sh\n"
|
72
|
+
exp = srub+"% abc def \n```\n\n\n efg\n"
|
73
|
+
o, e, s = Open3.capture3 EXE, stdin_data: stin
|
74
|
+
assert_equal 0, s.exitstatus
|
75
|
+
assert_equal exp, o, "期待:#{exp.inspect} ⇔ \n実際:#{o.inspect}"
|
76
|
+
assert_empty e
|
77
|
+
|
78
|
+
# automated judge unchanged: tex
|
79
|
+
stin = " % abc def " + "\n\n\n efg\n"
|
80
|
+
srub = "```tex\n"
|
81
|
+
exp = srub+"% abc def \n```\n\n\n efg\n"
|
82
|
+
o, e, s = Open3.capture3 EXE+" --lang=tex", stdin_data: stin
|
83
|
+
assert_equal 0, s.exitstatus
|
84
|
+
assert_equal exp, o, "期待:#{exp.inspect} ⇔ \n実際:#{o.inspect}"
|
85
|
+
assert_empty e
|
86
|
+
|
87
|
+
# automated judge: html
|
88
|
+
stin = " <abc>def " + "\n\n\n efg\n"
|
89
|
+
srub = "```html\n"
|
90
|
+
exp = srub+"<abc>def \n```\n\n\n efg\n"
|
91
|
+
o, e, s = Open3.capture3 EXE, stdin_data: stin
|
92
|
+
assert_equal 0, s.exitstatus
|
93
|
+
assert_equal exp, o, "期待:#{exp.inspect} ⇔ \n実際:#{o.inspect}"
|
94
|
+
assert_empty e
|
95
|
+
|
96
|
+
# automated judge unchanged: javascript
|
97
|
+
stin = " <abc>def " + "\n\n\n efg\n"
|
98
|
+
srub = "```javascript\n"
|
99
|
+
exp = srub+"<abc>def \n```\n\n\n efg\n"
|
100
|
+
o, e, s = Open3.capture3 EXE+" --lang=javascript", stdin_data: stin
|
101
|
+
assert_equal 0, s.exitstatus
|
102
|
+
assert_equal exp, o, "期待:#{exp.inspect} ⇔ \n実際:#{o.inspect}"
|
103
|
+
assert_empty e
|
104
|
+
|
69
105
|
end
|
70
106
|
end
|
71
107
|
|
metadata
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plain_text
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masa Sakano
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This module provides utility functions and methods to handle plain text,
|
14
14
|
classes Part/Paragraph/Boundary to represent the logical structure of a document
|
15
15
|
and ParseRule to describe the rules to parse plain text to produce a Part-type Ruby
|
16
16
|
instance. A few handy Ruby executable scripts to make use of them are included.
|
17
|
-
email:
|
17
|
+
email:
|
18
18
|
executables:
|
19
19
|
- countchar
|
20
20
|
- textclean
|
@@ -59,9 +59,7 @@ licenses:
|
|
59
59
|
- MIT
|
60
60
|
metadata:
|
61
61
|
yard.run: yri
|
62
|
-
|
63
|
-
source_code_uri: https://github.com/masasakano/plain_text
|
64
|
-
post_install_message:
|
62
|
+
post_install_message:
|
65
63
|
rdoc_options:
|
66
64
|
- "--charset=UTF-8"
|
67
65
|
require_paths:
|
@@ -77,18 +75,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
75
|
- !ruby/object:Gem::Version
|
78
76
|
version: '0'
|
79
77
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
81
|
-
signing_key:
|
78
|
+
rubygems_version: 3.3.7
|
79
|
+
signing_key:
|
82
80
|
specification_version: 4
|
83
81
|
summary: Module to handle Plain-Text
|
84
82
|
test_files:
|
83
|
+
- test/test_plain_text.rb
|
85
84
|
- test/test_plain_text_parse_rule.rb
|
86
|
-
- test/testtail_rb.rb
|
87
85
|
- test/test_plain_text_part.rb
|
88
|
-
- test/test_plain_text.rb
|
89
|
-
- test/testyard2md_afterclean.rb
|
90
|
-
- test/testcountchar.rb
|
91
|
-
- test/testtextclean.rb
|
92
86
|
- test/test_plain_text_split.rb
|
93
87
|
- test/test_plain_text_util.rb
|
88
|
+
- test/testcountchar.rb
|
94
89
|
- test/testhead_rb.rb
|
90
|
+
- test/testtail_rb.rb
|
91
|
+
- test/testtextclean.rb
|
92
|
+
- test/testyard2md_afterclean.rb
|