spanned 0.1.0.pre.beta → 0.1.2.pre.beta

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
  SHA256:
3
- metadata.gz: d7e1672f3f4e4fd398377af8b9a26da09d3c4206a4801380e98a4b44bb6ad02d
4
- data.tar.gz: 3ddf4129259707ac420942d915c2a131be15b0fb0140fc1a72358bd1978bcd4d
3
+ metadata.gz: e35776a4275f8b491951d490fec98b0bc6c2ff0968ee0b7dad66a60980b4cf72
4
+ data.tar.gz: 6671327641e26100d5c168d7a12c13403cebd862280c5cff58c7dfeb4de67b4b
5
5
  SHA512:
6
- metadata.gz: aefc9f66c26dc3d53c96650bd61f680f7a3c8a2b997d7705067cfe363970292b8a15fdc04f3fbb719e91587e5bd6fbbfbdf6071a9267424b84a25d07fdf69d80
7
- data.tar.gz: 5f39a812fa344be83ec8621d248a08fcdadfcedbe1ad517e48631f7168cbdba974c01f478735237a113442dd648b2177fa590e78b6202682c98a6d361958fe4b
6
+ metadata.gz: 8fd27082485cda757bd3a1b9f9d6e533143f9c7891adb8d3d24102164cfad8ed595d786db5492900542096406f68cf4d3de9bbcaffdf8990d0dc4e47dc773006
7
+ data.tar.gz: b42396fcee0d474a7383ced59025236fc0c5bee267333f931cf443ab8e8981b6133fcce54ccf587bcdcd4982f0f684aa09c3b40338b00a3fd448c5ed37741cfe
@@ -5,34 +5,34 @@
5
5
  # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
6
  # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
7
 
8
- #name: Ruby
9
- #
10
- #on:
11
- # push:
12
- # branches: [ "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
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "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: ['3.1']
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
- ## Initial release
1
+ ## In this update
2
+ - Now ignoring tags
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spanned (0.1.0.pre.beta)
4
+ spanned (0.1.2.pre.beta)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,2 +1,4 @@
1
1
  # Spanned
2
+ [![Gem Version](https://badge.fury.io/rb/spanned.svg)](https://badge.fury.io/rb/spanned)
3
+
2
4
  Helps wrap text in spans with classes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spanned
4
- VERSION = '0.1.0-beta'
4
+ VERSION = '0.1.2-beta'
5
5
  end
data/lib/spanned.rb CHANGED
@@ -15,13 +15,28 @@ module Spanned
15
15
  # == Parameters:
16
16
  # +text+:: +Str+: Text to include spans in
17
17
  # +span_class+:: Optional +Str+: class to apply to every span
18
+ # +ignore+:: Optional +Arr+: chars to skip
18
19
  # == Returns:
19
20
  # +Str+:: Formatted text
20
- def self.explode(text, span_class: nil)
21
+ def self.explode(text, span_class: nil, ignore: nil)
21
22
  r = ''
23
+ in_tag = false
24
+ leave_tag = false
22
25
  open = span_class.nil? ? %(<span>) : %(<span class="#{span_class}">)
23
26
  text.each_char do |i|
24
- r += "#{open}#{i}</span>"
27
+ if i == '<'
28
+ in_tag = true
29
+ elsif i == '>'
30
+ leave_tag = true
31
+ elsif leave_tag
32
+ in_tag = leave_tag = false
33
+ end
34
+ r +=
35
+ if ignore&.include?(i) or in_tag
36
+ i
37
+ else
38
+ "#{open}#{i}</span>"
39
+ end
25
40
  end
26
41
  r
27
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spanned
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.beta
4
+ version: 0.1.2.pre.beta
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-06-06 00:00:00.000000000 Z
11
+ date: 2023-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,7 +100,7 @@ files:
100
100
  - bin/setup
101
101
  - lib/spanned.rb
102
102
  - lib/spanned/version.rb
103
- - lightgraf.gemspec
103
+ - spanned.gemspec
104
104
  homepage: https://rubygems.org/gems/spanned
105
105
  licenses:
106
106
  - MIT
File without changes