Skip to content

Commit 69a2bda

Browse files
committed
add ignore mode for multiple [[[]]] lines
1 parent dfe2d10 commit 69a2bda

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

data2.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
[[[@HELLOOOO]]]
1212

13-
[[[Category:UI Control, Instruction:アプリのチュートリアルに入るので、柔らかめにお願いします. 次の URL でスクリーンショットを参照してください。 , Context:http://dropbox.com/public/screenshot1.png]]]
13+
[[[Category:UI Control, Instruction:アプリのチュートリアルに入るので、
14+
柔らかめにお願いします. 次の URL でスクリーンショットを参照してください。 , Context:http://dropbox.com/public/screenshot1.png]]]
1415

1516
こんにちwa!
1617

parser.rb

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
open(ARGV[0]) { |f|
22
parsing = false
3+
ignore_mode = false
34
key = ""
45
body = Array.new
56
f.each { |line|
@@ -9,11 +10,15 @@
910
if md = line.match(/(\/@\w+)/)
1011
puts '"' + key + '" = "' + body.join('\n') + '";'
1112
parsing = false
12-
else
13-
unless line.match(/\[\[\[.*\]\]\]/)
14-
body << line
15-
end
1613
end
14+
if line.match(/\[\[\[.*/)
15+
ignore_mode = true
16+
end
17+
if line.match(/.*\]\]\]/)
18+
ignore_mode = false
19+
next
20+
end
21+
body << line unless ignore_mode
1722
else
1823
if md = line.match(/(@\w+)/)
1924
body = Array.new

0 commit comments

Comments
 (0)