lightgraf 0.1.1.pre.beta.1 → 0.1.1.pre.beta.2
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/.github/workflows/ruby.yml +38 -0
- data/CHANGELOG.md +2 -1
- data/Gemfile.lock +1 -1
- data/README.md +13 -1
- data/lib/lightgraf/fixtures.rb +1 -1
- data/lib/lightgraf/internal.rb +6 -0
- data/lib/lightgraf/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 585033e2ead222922515b406e6ee777684cb4fd44f811001320436f419d3568b
|
4
|
+
data.tar.gz: 75256a6bfb720e9c706dbd5282cd7caf04d693da034f5c25adaf952b79da0b90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e1bd25f17998fbdf42a35ddde5b0725f816a6aa8221051d4220cc1bb06d979232b75b1adc0727ed9a36bd2af1057d372ccdb5c34dbb29e54ef473f357e44788
|
7
|
+
data.tar.gz: dbe73735849376e7a50d2a973a9cd2a926a46eb21328f89ce4bd077d2def2b6a8abe673b7a0939731ac4d4d0c8704dd65c40413f103155c031100ee444f0b094
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ "dev", "master" ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ "master" ]
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: read
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
test:
|
21
|
+
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
strategy:
|
24
|
+
matrix:
|
25
|
+
ruby-version: ['2.6']
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v3
|
29
|
+
- name: Set up Ruby
|
30
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
31
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
32
|
+
# uses: ruby/setup-ruby@v1
|
33
|
+
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby-version }}
|
36
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
37
|
+
- name: Run tests
|
38
|
+
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
##
|
1
|
+
## In this update:
|
2
|
+
- Fixing complex whitespace cases
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Lightgraf
|
2
|
+
[](https://badge.fury.io/rb/lightgraf)
|
2
3
|
|
3
4
|
Lightweight typography tool for Rails. It handles for you:
|
4
5
|
- __Quotes__:
|
@@ -18,6 +19,14 @@ Lightweight typography tool for Rails. It handles for you:
|
|
18
19
|
А что я? А я ничего\
|
19
20
|
`↓` \
|
20
21
|
А(NBSP)что я?(NBSP)А(NBSP)я(NBSP)ничего
|
22
|
+
|
23
|
+
- __No-breakables__:
|
24
|
+
|
25
|
+
Call me: 232-12-34\
|
26
|
+
`↓` \
|
27
|
+
Call me: \<nobr\>232-12-34\</nobr\>
|
28
|
+
|
29
|
+
It is fast and efficient, handling complex text of ~5800 characters at 0.06 sec
|
21
30
|
|
22
31
|
## Installation
|
23
32
|
|
@@ -37,7 +46,10 @@ Or install it yourself as:
|
|
37
46
|
|
38
47
|
## Usage
|
39
48
|
|
40
|
-
|
49
|
+
```ruby
|
50
|
+
require 'lightgraf'
|
51
|
+
fixed_text = Lightgraf.fix "My text"
|
52
|
+
```
|
41
53
|
|
42
54
|
## Development
|
43
55
|
|
data/lib/lightgraf/fixtures.rb
CHANGED
@@ -6,7 +6,7 @@ module Lightgraf
|
|
6
6
|
module Fixtures
|
7
7
|
INCORRECT_QUOTES = %w[' " `].freeze
|
8
8
|
HYPHENS = %w[- – —].freeze
|
9
|
-
SPACES = [' ', ' ', ' ', ' ', ' '].freeze
|
9
|
+
SPACES = [' ', ' ', ' ', ' ', ' ', '', '', '', 'ㅤ', ' ', ' ', ' ', '⠀', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ''].freeze
|
10
10
|
TAG_L = %(<)
|
11
11
|
TAG_R = %(>)
|
12
12
|
QUOT_RU_A_L = %(«)
|
data/lib/lightgraf/internal.rb
CHANGED
@@ -47,6 +47,10 @@ module Lightgraf
|
|
47
47
|
elsif [QUOT_RU_A_R, QUOT_EN_A_R].include?(char)
|
48
48
|
inside.pop if inside.last == :quote_a
|
49
49
|
elsif SPACES.include?(char)
|
50
|
+
if last_space == i - 1
|
51
|
+
last_space = i
|
52
|
+
next
|
53
|
+
end
|
50
54
|
need_next = false
|
51
55
|
if !disable_nbsp and (i < nbsp_max_length or (!last_space.nil? and last_hyphen != i - 1 and (i - last_space) <= nbsp_max_length) or HYPHENS.include?(text[i + 1]))
|
52
56
|
fixed += NBSP
|
@@ -58,6 +62,8 @@ module Lightgraf
|
|
58
62
|
end
|
59
63
|
last_space = i
|
60
64
|
next if need_next
|
65
|
+
fixed += SPACE
|
66
|
+
next
|
61
67
|
elsif HYPHENS.include?(char)
|
62
68
|
need_next = false
|
63
69
|
if !disable_hyphens and (i.zero? or last_space == i - 1)
|
data/lib/lightgraf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightgraf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1.pre.beta.
|
4
|
+
version: 0.1.1.pre.beta.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aydar N.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,6 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".github/workflows/ruby.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rubocop.yml"
|
92
93
|
- CHANGELOG.md
|