ntxt 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/ntxt +1 -1
  2. data/lib/ntxt/parser.rb +5 -7
  3. metadata +2 -2
data/bin/ntxt CHANGED
@@ -33,7 +33,7 @@ else
33
33
  end
34
34
 
35
35
  OptionParser.new do |opt|
36
- opt.version="1.0.6"
36
+ opt.version="1.0.7"
37
37
  opt.banner = "Ussage: #{$0} [options] [ntxt file]\n\n" +
38
38
  "Options:\n"
39
39
 
@@ -91,7 +91,6 @@ module Ntxt
91
91
  @lines = ntxtObj.text.split("\n")
92
92
  @currentLine = 0
93
93
  @currentOffset = 0
94
- @currentIndent = 0
95
94
  @currentBlock = rootBlock
96
95
 
97
96
  parseLines()
@@ -111,7 +110,7 @@ module Ntxt
111
110
  hlvl = hlevel
112
111
 
113
112
  if hlvl
114
- while @currentBlock.header >= hlvl[0] do
113
+ while (not @currentBlock.root? && @currentBlock.header == 0) || @currentBlock.header >= hlvl[0] do
115
114
  closeBlock
116
115
  end
117
116
 
@@ -122,22 +121,21 @@ module Ntxt
122
121
  @currentBlock.header = hlvl[0]
123
122
 
124
123
  hlvl[2].times { nextLine }
125
- @currentIndent = 0
126
124
 
127
125
  next
128
126
  end
129
127
 
130
128
  indent = computeIndent
131
- if indent < @currentIndent
129
+ while @currentBlock.header == 0 && @currentBlock.indent > indent do
132
130
  closeBlock
133
- @currentIndent = indent
134
- elsif indent > @currentIndent
131
+ end
132
+
133
+ if indent > @currentBlock.indent
135
134
  @currentBlock = Block.new(
136
135
  @currentBlock.ntxt,
137
136
  @currentBlock,
138
137
  @currentOffset)
139
138
  @currentBlock.indent = indent
140
- @currentIndent = indent
141
139
  end
142
140
 
143
141
  nextLine
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ntxt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-28 00:00:00.000000000 Z
12
+ date: 2013-03-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'A library and command line tool for parsing plain text into blocks
15
15
  by