ovec 0.0.6 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 072ab08b381a445811c64db29452dd28f5b1c575
4
- data.tar.gz: 7fc5d8aa41477ffcf71499df5d44cc88f35a52dd
3
+ metadata.gz: 4b2459b51d262b95de241e84262bc517012ee99a
4
+ data.tar.gz: 83d33adee0490378adbf4dd6981a729b0c309942
5
5
  SHA512:
6
- metadata.gz: 22dbbd36ec18a956479d356ba949405b3e211631b3ec89f1f30d0e9435a69a7d1d4590b525b1d909dc57d88974cc80d38f6f2a6ffdf2276f5e25c403667e5aa9
7
- data.tar.gz: 2e193c2a77a1daefeff432b8ab8da85f8f70807e76e1194268f0170fa72a69c9a844352466df5b3e760612fdcf1d60985a7328c2e12d5f533fb48f00c3704ffc
6
+ metadata.gz: c384c7ed9ef32b7d9e573cfc27dc5b9601a02a75a18bb6782ee377d17ccb8e14493087cd1c3b3e939b4d4d4fc2193257b02f7cafde02e659b4f683ac4d298ae0
7
+ data.tar.gz: c70482565d874fb48f556da168f95357028f09031967e796c99519421642637ae61951af3b546d702ddf703d8f5a7e73005c08f5d7ce1c576240b8d8c988aa68
data/TODO CHANGED
@@ -10,4 +10,3 @@
10
10
 
11
11
  - ne-UTF8 soubory
12
12
  - mista parsovacich chyb
13
- - vlnkovani na rozhrani radku
data/lib/ovec/tier.rb CHANGED
@@ -4,9 +4,8 @@ module Ovec
4
4
  class Tier < TextManipulator
5
5
  # The last character this regex matches is changed to a tilde.
6
6
  REGEX = /(
7
- ((\p{Z}|[~\n()\[\]\{\}])[KkSsVvZzOoUu](\p{Z}|\n))| # KSVZOU jako samostatne slovo
8
- ([\.\?\!](\p{Z}|\~)+[KSVZOUAI](\p{Z}|\n))| # KSVZOUAI na zacatku vety
9
- (\A[KSVZOUAI](\p{Z}|\n))| # KSVZOUAI na zacatku textu
7
+ ((\p{Z}|[~\n(\[\{]|\A)[KkSsVvZzOoUu](\p{Z}|\n|\Z))| # KSVZOU jako samostatne slovo
8
+ ((([\.\?\!](\p{Z}|\~)+)|(\A\p{Z}*))[KSVZOUAI](\p{Z}|\n))| # KSVZOUAI na zacatku vety
10
9
  (\p{Z}(?=--(\p{Z}|\n)))| # mezera, za kterou je pomlcka
11
10
  (,(\p{Z}|\~|\n)+a(\p{Z}|\n)) # ... modulo 10, a~timto prvkem ...; TODO: plati tohle i pro "i"?
12
11
  )/x
@@ -43,6 +42,8 @@ module Ovec
43
42
  # newline -- move the tied word to the other line.
44
43
  j = change - 1
45
44
  while j >= 0
45
+ break if @joined[j] == '\n' # Don't cross newlines.
46
+
46
47
  if @joined[j] == ' '
47
48
  chunk, offset = _find_chunk_and_offset(j)
48
49
  chunk[offset] = '\n'
data/lib/ovec/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Ovec
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  NAME_WITH_VERSION = "Ovec #{VERSION}"
4
4
  end
@@ -8,7 +8,7 @@ module Ovec
8
8
 
9
9
  private
10
10
  def assert_ties_to(input, output)
11
- parser = Ovec::Parser.new(debug: true)
11
+ parser = Ovec::Parser.new(debug: false)
12
12
  tree = parser.parse(input.dup)
13
13
 
14
14
  tm = Ovec::TexManipulator.new
@@ -25,18 +25,7 @@ module Ovec
25
25
  def test_basic_without_ties
26
26
  text = "Ahoj. Jak se máš?"
27
27
  text_duplicate = text.dup
28
-
29
- parser = Ovec::Parser.new(debug: true)
30
- tree = parser.parse(text)
31
-
32
- tm = Ovec::TexManipulator.new
33
- tm.bind(tree)
34
-
35
- tm.run_text_manipulator(@tier)
36
-
37
- text = tree.to_tex
38
-
39
- assert_equal text, text_duplicate
28
+ assert_ties_to text, text_duplicate
40
29
  end
41
30
 
42
31
  def test_simple_tie
@@ -80,6 +69,8 @@ module Ovec
80
69
  def test_tie_in_newline
81
70
  assert_ties_to "V\nrámci\ntohohle", "V~rámci\ntohohle"
82
71
  assert_ties_to "V\nrámci tohohle", "V~rámci tohohle"
72
+ assert_ties_to "medved\nv\nulu", "medved\nv~ulu"
73
+ assert_ties_to "v\nulu", "v~ulu"
83
74
  end
84
75
 
85
76
  def test_date_regex_ok
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ovec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Pokorný