blackrug 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +2 -0
- data/LICENSE +21 -0
- data/README.md +27 -0
- data/lib/blackrug.rb +21 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3c15a638f66e78fa225f8edee0aa168d1c9ee5df8abbbf93358c4ca912aa123d
|
4
|
+
data.tar.gz: 2f02482cdc71c84ac5535c1ab04bd0064ad0c05e834ae33dc54324b0a9c8597e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ff50e4a31d61fdf19fec3084d939f6577be170d6c09ae44e6d7a7e4c97105d6d47bd5d25382fd4334382e78485642b5a423c88b2f325e023fd1d90cb9a105bb4
|
7
|
+
data.tar.gz: ff17ed8def0a3f6e3c169cad18bc17fa9d85fb573871365bfb0f19fefb59d79bb8561ccbcb1c62aac020386d0989aa37449e58ed67ea6aad8c966cfdb28fd5c0
|
data/CHANGELOG.md
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 Justin Léger
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Blackrug
|
2
|
+
A Markdown preparser to sweep comments under the rug.
|
3
|
+
|
4
|
+
Blackrug is this groundbreaking parser that allows you to sweep markdown under the rug by wrapping it by `<!---Blackrug--->`. Typical markdown parser will render the blackrugged elements.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Install via:
|
9
|
+
|
10
|
+
```console
|
11
|
+
gem install blackrug
|
12
|
+
```
|
13
|
+
|
14
|
+
Then start using it:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
require 'blackrug'
|
18
|
+
```
|
19
|
+
|
20
|
+
## Examples
|
21
|
+
|
22
|
+
You can use `Blackrug.sweep` or `Blackrug.🧹` to sweep elements under the rug
|
23
|
+
|
24
|
+
```
|
25
|
+
Blackrug.sweep('wow this is <!---Blackrug--->so not <!---Blackrug--->cool!')
|
26
|
+
=> "wow this is cool!"
|
27
|
+
```
|
data/lib/blackrug.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'sorbet-runtime'
|
5
|
+
|
6
|
+
# Blackrug is this groundbreaking parser that allows you to sweep markdown under
|
7
|
+
# the rug by wrapping it by <!---Blackrug--->
|
8
|
+
# Typical markdown parser will render the blackrugged elements.
|
9
|
+
# You need to pre-parse it via Blackrug
|
10
|
+
module Blackrug
|
11
|
+
class << self
|
12
|
+
extend T::Sig
|
13
|
+
|
14
|
+
sig { params(text: String).returns(String) }
|
15
|
+
def sweep(text)
|
16
|
+
text.split(/(?<!`)<!---Blackrug--->(?!`)/).select.with_index { |_, i| i.even? }.join
|
17
|
+
end
|
18
|
+
|
19
|
+
alias_method(:🧹, :sweep)
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blackrug
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Leger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sorbet-runtime
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sorbet
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: " Blackrug is this groundbreaking parser that allows you to sweep
|
70
|
+
markdown under the rug by wrapping it by \n `<!---Blackrug--->`.\n"
|
71
|
+
email: hey@justinleger.ca
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- CHANGELOG.md
|
77
|
+
- LICENSE
|
78
|
+
- README.md
|
79
|
+
- lib/blackrug.rb
|
80
|
+
homepage: https://github.com/jusleg/i-bought-from-a-bot/tree/master/gems/blackrug
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata:
|
84
|
+
source_code_uri: https://github.com/jusleg/i-bought-from-a-bot/tree/master/gems/blackrug
|
85
|
+
changelog_uri: https://github.com/jusleg/i-bought-from-a-bot/tree/master/gems/blackrug/CHANGELOG.md
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubygems_version: 3.1.2
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: Markdown preparser that hides commented blocks
|
105
|
+
test_files: []
|