schizm 0.0.1 → 0.0.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/lib/schizm/chunk.rb +129 -101
- data/lib/schizm/env.rb +49 -14
- data/lib/schizm/env_colors.rb +28 -0
- data/lib/schizm/markup.rb +152 -120
- data/lib/schizm/match.rb +45 -0
- data/lib/schizm/parse.rb +350 -344
- data/lib/schizm/string.rb +179 -150
- data/res/fonts/{fira-code-bold.otf → Fira-Code-Bold.otf} +0 -0
- data/res/fonts/{fira-code-license → Fira-Code-LICENSE} +0 -0
- data/res/fonts/{fira-code-light.otf → Fira-Code-Light.otf} +0 -0
- data/res/fonts/{fira-code-medium.otf → Fira-Code-Medium.otf} +0 -0
- data/res/fonts/{fira-code-regular.otf → Fira-Code-Regular.otf} +0 -0
- data/res/fonts/{fira-code.css → Fira-Code.css} +4 -4
- data/res/fonts/{genericons-neue-license → Genericons-Neue-LICENSE} +0 -0
- data/res/fonts/{genericons-neue.css → Genericons-Neue.css} +0 -0
- data/res/fonts/{genericons-neue.eot → Genericons-Neue.eot} +0 -0
- data/res/fonts/{genericons-neue.ttf → Genericons-Neue.ttf} +0 -0
- data/res/fonts/{genericons-neue.woff2 → Genericons-Neue.woff2} +0 -0
- data/res/fonts/{social-logos-license → Social-Logos-LICENSE} +0 -0
- data/res/fonts/{social-logos.css → Social-Logos.css} +0 -0
- data/res/fonts/{social-logos.eot → Social-Logos.eot} +0 -0
- data/res/fonts/{social-logos.ttf → Social-Logos.ttf} +0 -0
- data/res/fonts/{social-logos.woff2 → Social-Logos.woff2} +0 -0
- data/res/schizm.liquid +4 -4
- data/res/scss/style.scss +1 -1
- metadata +17 -17
data/lib/schizm/string.rb
CHANGED
@@ -1,161 +1,190 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
def slugify
|
28
|
-
gsub(/^\p{^Word}+/u, "")
|
29
|
-
.gsub(/\p{^Word}+$/u, "")
|
30
|
-
.gsub(/\p{^Word}+/u, '-').downcase
|
31
|
-
end
|
32
|
-
|
33
|
-
# Make suitable string for include guard.
|
34
|
-
def guardify
|
35
|
-
strip.wordify.upcase
|
36
|
-
end
|
37
|
-
|
38
|
-
# Encode non-ASCII characters and '&', '<', and '>' as HTML entities.
|
39
|
-
def html!
|
40
|
-
gsub! /[&<>\p{^ASCII}]/u do |char|
|
41
|
-
'&#' + char.codepoints[0].to_s + ';'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# Encode non-ASCII characters and '&', '<', and '>' as HTML entities.
|
46
|
-
def html
|
47
|
-
gsub /[&<>\p{^ASCII}]/u do |char|
|
48
|
-
'&#' + char.codepoints[0].to_s + ';'
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# Remove blanks preceding newlines.
|
53
|
-
def trim_blank!
|
54
|
-
gsub! /\p{Blank}+\n/u, "\n"
|
55
|
-
end
|
56
|
-
|
57
|
-
# Remove blanks preceding newlines.
|
58
|
-
def trim_blank
|
59
|
-
gsub /\p{Blank}+\n/u, "\n"
|
60
|
-
end
|
1
|
+
# Copyright (c) 2017 M. Grady Saunders
|
2
|
+
#
|
3
|
+
# Redistribution and use in source and binary forms, with or without
|
4
|
+
# modification, are permitted provided that the following conditions
|
5
|
+
# are met:
|
6
|
+
#
|
7
|
+
# 1. Redistributions of source code must retain the above
|
8
|
+
# copyright notice, this list of conditions and the following
|
9
|
+
# disclaimer.
|
10
|
+
#
|
11
|
+
# 2. Redistributions in binary form must reproduce the above
|
12
|
+
# copyright notice, this list of conditions and the following
|
13
|
+
# disclaimer in the documentation and/or other materials
|
14
|
+
# provided with the distribution.
|
15
|
+
#
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
18
|
+
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
19
|
+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
20
|
+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
21
|
+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
23
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
24
|
+
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
61
27
|
|
62
|
-
|
63
|
-
# spaces, remove newlines succeeding empty lines, and
|
64
|
-
# remove leading newlines.
|
65
|
-
def trim!
|
66
|
-
gsub! /\p{Blank}+\n/u, "\n"
|
67
|
-
gsub! /\p{Space}+\z/u, ""
|
68
|
-
gsub! /\n\n+/u, "\n\n"
|
69
|
-
while start_with? "\n"
|
70
|
-
slice! 0
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Remove blanks preceding newlines, remove trailing
|
75
|
-
# spaces, remove newlines succeeding empty lines, and
|
76
|
-
# remove leading newlines.
|
77
|
-
def trim
|
78
|
-
copy = String.new self
|
79
|
-
copy.trim!
|
80
|
-
copy
|
81
|
-
end
|
82
|
-
|
83
|
-
# Replace space sequences by a single ASCII space.
|
84
|
-
def slim!
|
85
|
-
gsub! /\p{Space}+/u, " "
|
86
|
-
end
|
87
|
-
|
88
|
-
# Replace space sequences by a single ASCII space.
|
89
|
-
def slim
|
90
|
-
gsub /\p{Space}+/u, " "
|
91
|
-
end
|
92
|
-
|
93
|
-
# Expand tabs, subject to tabstop +stop+.
|
94
|
-
def expand_tab! stop
|
95
|
-
gsub! /([^\t\n]*)\t/u do
|
96
|
-
$1 + " " * (stop - $1.size % stop)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
# Expand tabs, subject to tabstop +stop+.
|
101
|
-
def expand_tab stop
|
102
|
-
gsub /([^\t\n]*)\t/u do
|
103
|
-
$1 + " " * (stop - $1.size % stop)
|
104
|
-
end
|
105
|
-
end
|
28
|
+
module Schizm
|
106
29
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
30
|
+
# Extend the default +String+ class.
|
31
|
+
class String < ::String
|
32
|
+
|
33
|
+
# Erase occurances of +Regexp.union(*args)+.
|
34
|
+
def erase! *args
|
35
|
+
gsub! Regexp.union(*args), ""
|
36
|
+
end
|
37
|
+
|
38
|
+
# Erase occurances of +Regexp.union(*args)+.
|
39
|
+
def erase *args
|
40
|
+
gsub Regexp.union(*args), ""
|
41
|
+
end
|
42
|
+
|
43
|
+
# Replace sequences of +\p{^Word}+ by an underscore.
|
44
|
+
def wordify!
|
45
|
+
gsub! /\p{^Word}+/u, '_'
|
46
|
+
end
|
47
|
+
|
48
|
+
# Replace sequences of +\p{^Word}+ by an underscore.
|
49
|
+
def wordify
|
50
|
+
gsub /\p{^Word}+/u, '_'
|
51
|
+
end
|
52
|
+
|
53
|
+
# Make suitable string for slug.
|
54
|
+
def slugify
|
55
|
+
gsub(/^\p{^Word}+/u, "")
|
56
|
+
.gsub(/\p{^Word}+$/u, "")
|
57
|
+
.gsub(/\p{^Word}+/u, '-').downcase
|
58
|
+
end
|
59
|
+
|
60
|
+
# Make suitable string for include guard.
|
61
|
+
def guardify
|
62
|
+
strip.wordify.upcase
|
63
|
+
end
|
64
|
+
|
65
|
+
# Encode non-ASCII characters and '&', '<', and '>' as HTML entities.
|
66
|
+
def html!
|
67
|
+
gsub! /[&<>\p{^ASCII}]/u do |char|
|
68
|
+
'&#' + char.codepoints[0].to_s + ';'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Encode non-ASCII characters and '&', '<', and '>' as HTML entities.
|
73
|
+
def html
|
74
|
+
gsub /[&<>\p{^ASCII}]/u do |char|
|
75
|
+
'&#' + char.codepoints[0].to_s + ';'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Remove blanks preceding newlines.
|
80
|
+
def trim_blank!
|
81
|
+
gsub! /\p{Blank}+\n/u, "\n"
|
82
|
+
end
|
83
|
+
|
84
|
+
# Remove blanks preceding newlines.
|
85
|
+
def trim_blank
|
86
|
+
gsub /\p{Blank}+\n/u, "\n"
|
87
|
+
end
|
88
|
+
|
89
|
+
# Remove blanks preceding newlines, remove trailing
|
90
|
+
# spaces, remove newlines succeeding empty lines, and
|
91
|
+
# remove leading newlines.
|
92
|
+
def trim!
|
93
|
+
gsub! /\p{Blank}+\n/u, "\n"
|
94
|
+
gsub! /\p{Space}+\z/u, ""
|
95
|
+
gsub! /\n\n+/u, "\n\n"
|
96
|
+
while start_with? "\n"
|
97
|
+
slice! 0
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Remove blanks preceding newlines, remove trailing
|
102
|
+
# spaces, remove newlines succeeding empty lines, and
|
103
|
+
# remove leading newlines.
|
104
|
+
def trim
|
105
|
+
copy = String.new self
|
106
|
+
copy.trim!
|
107
|
+
copy
|
108
|
+
end
|
109
|
+
|
110
|
+
# Replace space sequences by a single ASCII space.
|
111
|
+
def slim!
|
112
|
+
gsub! /\p{Space}+/u, " "
|
113
|
+
end
|
114
|
+
|
115
|
+
# Replace space sequences by a single ASCII space.
|
116
|
+
def slim
|
117
|
+
gsub /\p{Space}+/u, " "
|
118
|
+
end
|
119
|
+
|
120
|
+
# Expand tabs, subject to tabstop +stop+.
|
121
|
+
def expand_tab! stop
|
122
|
+
gsub! /([^\t\n]*)\t/u do
|
123
|
+
$1 + " " * (stop - $1.size % stop)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
# Expand tabs, subject to tabstop +stop+.
|
128
|
+
def expand_tab stop
|
129
|
+
gsub /([^\t\n]*)\t/u do
|
130
|
+
$1 + " " * (stop - $1.size % stop)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Distance from last newline to +length+.
|
135
|
+
# If there's no last newline, just +length+.
|
136
|
+
def find_indent
|
137
|
+
if (offset = rindex /\n/u)
|
138
|
+
length - offset - 1
|
139
|
+
else
|
140
|
+
length
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Format as a C-style comment.
|
145
|
+
def comment
|
146
|
+
s = "/*"
|
147
|
+
each_line do |line|
|
148
|
+
s.concat " "
|
149
|
+
s.concat line
|
150
|
+
s.concat " *"
|
151
|
+
end
|
152
|
+
s.concat "/"
|
153
|
+
end
|
154
|
+
|
155
|
+
# Remove backslashes which escape characters +chars+.
|
156
|
+
def unescape *chars
|
157
|
+
s = String.new
|
158
|
+
prev_char_bslash = false
|
159
|
+
each_char do |char|
|
160
|
+
if prev_char_bslash
|
161
|
+
prev_char_bslash = false
|
162
|
+
unless chars.include? char
|
163
|
+
s.concat '\\'
|
164
|
+
end
|
112
165
|
else
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
# Format as a C-style comment.
|
118
|
-
def comment
|
119
|
-
s = "/*"
|
120
|
-
each_line do |line|
|
121
|
-
s.concat " "
|
122
|
-
s.concat line
|
123
|
-
s.concat " *"
|
124
|
-
end
|
125
|
-
s.concat "/"
|
126
|
-
end
|
127
|
-
|
128
|
-
# Remove backslashes which escape characters +chars+.
|
129
|
-
def unescape *chars
|
130
|
-
s = String.new
|
131
|
-
prev_char_bslash = false
|
132
|
-
each_char do |char|
|
133
|
-
if prev_char_bslash
|
134
|
-
prev_char_bslash = false
|
135
|
-
unless chars.include? char
|
136
|
-
s.concat '\\'
|
137
|
-
end
|
138
|
-
else
|
139
|
-
if char == '\\'
|
140
|
-
prev_char_bslash = true
|
141
|
-
next
|
142
|
-
end
|
166
|
+
if char == '\\'
|
167
|
+
prev_char_bslash = true
|
168
|
+
next
|
143
169
|
end
|
144
|
-
s.concat char
|
145
170
|
end
|
146
|
-
s
|
171
|
+
s.concat char
|
147
172
|
end
|
173
|
+
s
|
174
|
+
end
|
148
175
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
176
|
+
# For sentence-like strings. Truncate to +n+ characters and replace the
|
177
|
+
# final broken word with an ellipsis.
|
178
|
+
def truncate n
|
179
|
+
if size <= n
|
180
|
+
return String.new self
|
181
|
+
else
|
182
|
+
return String.new(self[0..n])
|
183
|
+
.gsub(/\p{Space}+/u, " ")
|
184
|
+
.gsub(/\p{Space}+\p{Graph}+\z/u, "...")
|
157
185
|
end
|
186
|
+
end
|
158
187
|
|
159
|
-
|
188
|
+
end # class String
|
160
189
|
|
161
190
|
end # module Schizm
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,20 +1,20 @@
|
|
1
1
|
@font-face {
|
2
2
|
font-family: Fira-Code;
|
3
3
|
font-weight: 300;
|
4
|
-
src: url(/assets/fonts/
|
4
|
+
src: url(/assets/fonts/Fira-Code-Light.otf);
|
5
5
|
}
|
6
6
|
@font-face {
|
7
7
|
font-family: Fira-Code;
|
8
8
|
font-weight: 400;
|
9
|
-
src: url(/assets/fonts/
|
9
|
+
src: url(/assets/fonts/Fira-Code-Regular.otf);
|
10
10
|
}
|
11
11
|
@font-face {
|
12
12
|
font-family: Fira-Code;
|
13
13
|
font-weight: 500;
|
14
|
-
src: url(/assets/fonts/
|
14
|
+
src: url(/assets/fonts/Fira-Code-Medium.otf);
|
15
15
|
}
|
16
16
|
@font-face {
|
17
17
|
font-family: Fira-Code;
|
18
18
|
font-weight: 700;
|
19
|
-
src: url(/assets/fonts/
|
19
|
+
src: url(/assets/fonts/Fira-Code-Bold.otf);
|
20
20
|
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/res/schizm.liquid
CHANGED
@@ -49,9 +49,9 @@ MathJax.Hub.Config({
|
|
49
49
|
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-AMS_HTML"></script>
|
50
50
|
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
|
51
51
|
<script type="text/javascript" src="/assets/js/schizm.js"></script>
|
52
|
-
<link rel="stylesheet" href="/assets/fonts/
|
53
|
-
<link rel="stylesheet" href="/assets/fonts/
|
54
|
-
<link rel="stylesheet" href="/assets/fonts/
|
52
|
+
<link rel="stylesheet" href="/assets/fonts/Genericons-Neue.css">
|
53
|
+
<link rel="stylesheet" href="/assets/fonts/Social-Logos.css">
|
54
|
+
<link rel="stylesheet" href="/assets/fonts/Fira-Code.css">
|
55
55
|
<link rel="stylesheet" href="/assets/css/schizm.css">
|
56
56
|
<title>{{ page.title }}</title>
|
57
57
|
</head>
|
@@ -60,7 +60,7 @@ MathJax.Hub.Config({
|
|
60
60
|
<div class="sidenav">
|
61
61
|
<div class="toc-home">
|
62
62
|
<a href="{{ site.url }}">{{ site.title }}</a>
|
63
|
-
<p>{{ site.
|
63
|
+
<p>{{ site.brief }}</p>
|
64
64
|
</div>
|
65
65
|
<div class="toc-list">
|
66
66
|
<ul class="toc-tree">{% for doc in site.docs %}
|
data/res/scss/style.scss
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schizm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- M. Grady Saunders
|
@@ -25,22 +25,22 @@ files:
|
|
25
25
|
- lib/schizm/match.rb
|
26
26
|
- lib/schizm/parse.rb
|
27
27
|
- lib/schizm/string.rb
|
28
|
-
- res/fonts/
|
29
|
-
- res/fonts/
|
30
|
-
- res/fonts/
|
31
|
-
- res/fonts/
|
32
|
-
- res/fonts/
|
33
|
-
- res/fonts/
|
34
|
-
- res/fonts/
|
35
|
-
- res/fonts/
|
36
|
-
- res/fonts/
|
37
|
-
- res/fonts/
|
38
|
-
- res/fonts/
|
39
|
-
- res/fonts/
|
40
|
-
- res/fonts/
|
41
|
-
- res/fonts/
|
42
|
-
- res/fonts/
|
43
|
-
- res/fonts/
|
28
|
+
- res/fonts/Fira-Code-Bold.otf
|
29
|
+
- res/fonts/Fira-Code-LICENSE
|
30
|
+
- res/fonts/Fira-Code-Light.otf
|
31
|
+
- res/fonts/Fira-Code-Medium.otf
|
32
|
+
- res/fonts/Fira-Code-Regular.otf
|
33
|
+
- res/fonts/Fira-Code.css
|
34
|
+
- res/fonts/Genericons-Neue-LICENSE
|
35
|
+
- res/fonts/Genericons-Neue.css
|
36
|
+
- res/fonts/Genericons-Neue.eot
|
37
|
+
- res/fonts/Genericons-Neue.ttf
|
38
|
+
- res/fonts/Genericons-Neue.woff2
|
39
|
+
- res/fonts/Social-Logos-LICENSE
|
40
|
+
- res/fonts/Social-Logos.css
|
41
|
+
- res/fonts/Social-Logos.eot
|
42
|
+
- res/fonts/Social-Logos.ttf
|
43
|
+
- res/fonts/Social-Logos.woff2
|
44
44
|
- res/license/BSD-2-Clause
|
45
45
|
- res/license/BSD-3-Clause
|
46
46
|
- res/license/GPL-2.0
|