jekyll-pseudocode-b 0.1.1 → 0.1.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/README.md +32 -28
- data/css/default.css +38 -0
- data/css/sonofobsidian.css +52 -0
- data/css/visuallike.css +53 -0
- data/doc/output-sample-0.png +0 -0
- data/doc/output-sample-1.png +0 -0
- data/jekyll-pseudocode-b.gemspec +1 -1
- data/lib/jekyll-pseudocode-b/brush.rb +6 -1
- data/lib/jekyll-pseudocode-b/grammar.rb +2 -1
- data/lib/jekyll-pseudocode-b/html_brush.rb +11 -2
- data/lib/jekyll-pseudocode-b/version.rb +1 -1
- data/spec/html_spec.rb +10 -0
- metadata +8 -4
- data/doc/samplecode.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eef7a48960228af9d3d2b202a73ed8849c39f14f
|
4
|
+
data.tar.gz: 2976f0fbfe5df47f2b04fee994c468967aae509c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7662791040443df1e6f259c79175dd0d850398474bb963be0dc80c071711d4fab2faf300a9416a263a3e82b70f8dd796c113d808b1cfa9db9c00d2c86fd6fcf
|
7
|
+
data.tar.gz: 9f778f78c84ae3761f5125c868002282d1f2739abba4d6d3c0d958e7c3f1846cd495f104078f57bcf68e0a1426801407a7b8a6191fb5d9f56c334d542570123a
|
data/README.md
CHANGED
@@ -40,35 +40,12 @@ gems:
|
|
40
40
|
## Language
|
41
41
|
|
42
42
|
* Indentation is preserved
|
43
|
-
* A word beginning with a capital letter is a keyword
|
43
|
+
* A word beginning with a **capital letter** is a keyword
|
44
44
|
* A word followed by parentheses is a function name
|
45
45
|
* All other words are variables
|
46
|
-
* Words within double quotes are generally strings
|
46
|
+
* Words within double or single quotes are generally strings
|
47
47
|
* Variables that calls a function can reproduce the following output: `myVar.FUNCTION(a);`
|
48
|
-
|
49
|
-
## Auto-Formatted Syntax
|
50
|
-
|
51
|
-
The following table shows auto-formated symbols:
|
52
|
-
|
53
|
-
| Syntax | Symbol |
|
54
|
-
| :------: | :--------: |
|
55
|
-
| <- | ← |
|
56
|
-
| -> | → |
|
57
|
-
| <-- | ⟵ |
|
58
|
-
| --> | ⟶ |
|
59
|
-
| => | ≥ |
|
60
|
-
| <= | ≤ |
|
61
|
-
| == | = |
|
62
|
-
| := | ≔ |
|
63
|
-
| = | = |
|
64
|
-
| < | < |
|
65
|
-
| > | > |
|
66
|
-
| [ | [ |
|
67
|
-
| ] | ] |
|
68
|
-
| <-> | ↔ |
|
69
|
-
| <--> | ⟷ |
|
70
|
-
| $pi | π |
|
71
|
-
| $tau | 𝛕 |
|
48
|
+
* A word that starts with `@` will be
|
72
49
|
|
73
50
|
## Output
|
74
51
|
|
@@ -97,11 +74,38 @@ With a bit of formatting, the above code becomes:
|
|
97
74
|
|
98
75
|

|
99
76
|
|
77
|
+
## Auto-Formatted Syntax
|
78
|
+
|
79
|
+
The following table shows auto-formated symbols:
|
80
|
+
|
81
|
+
| Syntax | Symbol |
|
82
|
+
| :------: | :--------: |
|
83
|
+
| <- | ← |
|
84
|
+
| -> | → |
|
85
|
+
| <-- | ⟵ |
|
86
|
+
| --> | ⟶ |
|
87
|
+
| => | ≥ |
|
88
|
+
| <= | ≤ |
|
89
|
+
| == | = |
|
90
|
+
| := | ≔ |
|
91
|
+
| = | = |
|
92
|
+
| < | < |
|
93
|
+
| > | > |
|
94
|
+
| [ | [ |
|
95
|
+
| ] | ] |
|
96
|
+
| <-> | ↔ |
|
97
|
+
| <--> | ⟷ |
|
98
|
+
| $pi | π |
|
99
|
+
| $tau | 𝛕 |
|
100
|
+
| $infinity | ∞ |
|
101
|
+
|
100
102
|
## More Styles
|
101
103
|
|
102
|
-
You can also create your own style for pseudo-codes like images below. Check on the `css` folder for CSS files examples.
|
104
|
+
You can also create your own CSS style for pseudo-codes like the images below. Check on the `css` folder for CSS files examples.
|
105
|
+
|
106
|
+

|
103
107
|
|
104
|
-
|
108
|
+

|
105
109
|
|
106
110
|
## Author
|
107
111
|
|
data/css/default.css
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
.pseudocode {
|
2
|
+
text-indent: 17px;
|
3
|
+
font-family: "Consolas", Courier, monospace;
|
4
|
+
font-size: 17px;
|
5
|
+
white-space: pre-wrap;
|
6
|
+
padding: 0.85em;
|
7
|
+
display: block;
|
8
|
+
line-height: 1.3em;
|
9
|
+
border-radius: 4px;
|
10
|
+
margin: 1.5em 0;
|
11
|
+
overflow: scroll;
|
12
|
+
overflow-x: auto;
|
13
|
+
overflow-y: hidden;
|
14
|
+
border: #d7d7d7 1px solid
|
15
|
+
}
|
16
|
+
|
17
|
+
.indent
|
18
|
+
{
|
19
|
+
|
20
|
+
}
|
21
|
+
|
22
|
+
.symbol {
|
23
|
+
font-weight: bold;
|
24
|
+
text-transform: lowercase;
|
25
|
+
}
|
26
|
+
|
27
|
+
.function {
|
28
|
+
text-transform: uppercase;
|
29
|
+
}
|
30
|
+
|
31
|
+
.variable {
|
32
|
+
font-style: italic;
|
33
|
+
}
|
34
|
+
|
35
|
+
.numeric
|
36
|
+
{
|
37
|
+
|
38
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
.pseudocode {
|
2
|
+
text-indent: 17px;
|
3
|
+
font-family: "Consolas", Courier, monospace;
|
4
|
+
font-size: 16px;
|
5
|
+
white-space: pre-wrap;
|
6
|
+
padding: 0.85em;
|
7
|
+
display: block;
|
8
|
+
line-height: 1.3em;
|
9
|
+
border-radius: 4px;
|
10
|
+
background-color: #22282A;
|
11
|
+
color: #F1F2F3;
|
12
|
+
}
|
13
|
+
|
14
|
+
.indent
|
15
|
+
{
|
16
|
+
|
17
|
+
}
|
18
|
+
|
19
|
+
.symbol {
|
20
|
+
font-weight: bold;
|
21
|
+
text-transform: lowercase;
|
22
|
+
color: #93C763;
|
23
|
+
}
|
24
|
+
|
25
|
+
.function {
|
26
|
+
text-transform: capitalize;
|
27
|
+
color: #678CB1;
|
28
|
+
}
|
29
|
+
|
30
|
+
.comment
|
31
|
+
{
|
32
|
+
color: #66747B;
|
33
|
+
}
|
34
|
+
|
35
|
+
.variable {
|
36
|
+
font-style: italic;
|
37
|
+
}
|
38
|
+
|
39
|
+
.string
|
40
|
+
{
|
41
|
+
color:#EC7600;
|
42
|
+
}
|
43
|
+
|
44
|
+
.numeric
|
45
|
+
{
|
46
|
+
color: #FFCD22;
|
47
|
+
}
|
48
|
+
|
49
|
+
.operator
|
50
|
+
{
|
51
|
+
color: #678CB1;
|
52
|
+
}
|
data/css/visuallike.css
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
.pseudocode {
|
2
|
+
font-family: "Inconsolata", Courier, monospace;
|
3
|
+
font-size: 16px;
|
4
|
+
white-space: pre-wrap;
|
5
|
+
padding: 0.85em;
|
6
|
+
display: block;
|
7
|
+
line-height: 1.6;
|
8
|
+
background-color: #FFFFFF;
|
9
|
+
color: #000;
|
10
|
+
border: 1px #F3F3F3 solid;
|
11
|
+
}
|
12
|
+
|
13
|
+
.symbol
|
14
|
+
{
|
15
|
+
text-transform: lowercase;
|
16
|
+
color: #0000FF;
|
17
|
+
}
|
18
|
+
|
19
|
+
.function
|
20
|
+
{
|
21
|
+
text-transform: uppercase;
|
22
|
+
color: #795E26;
|
23
|
+
}
|
24
|
+
|
25
|
+
.comment
|
26
|
+
{
|
27
|
+
color: #008000;
|
28
|
+
}
|
29
|
+
|
30
|
+
.variable
|
31
|
+
{
|
32
|
+
font-style: italic;
|
33
|
+
}
|
34
|
+
|
35
|
+
.string
|
36
|
+
{
|
37
|
+
color:#A31515;
|
38
|
+
}
|
39
|
+
|
40
|
+
.numeric
|
41
|
+
{
|
42
|
+
color: #09885A;
|
43
|
+
}
|
44
|
+
|
45
|
+
.operator
|
46
|
+
{
|
47
|
+
color: #000;
|
48
|
+
}
|
49
|
+
|
50
|
+
.math-symbol
|
51
|
+
{
|
52
|
+
color: #AF00DB;
|
53
|
+
}
|
Binary file
|
Binary file
|
data/jekyll-pseudocode-b.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.version = Jekyll::PseudoCodeB::VERSION
|
8
8
|
spec.authors = ["Tobias Ulrich", "Victor Bazterra", "Wiktor Macura"]
|
9
9
|
spec.email = ["tobiasbulrich@gmail.com","bazterra@gmail.com", "wmacura@gmail.com"]
|
10
|
-
spec.homepage = "http://github.com/
|
10
|
+
spec.homepage = "http://github.com/tobiasbu/jekyll-pseudocode-b"
|
11
11
|
spec.summary = %q{A trivial jekyll plugin for formatting pseudocode}
|
12
12
|
spec.description = %q{jekyll-pseudocode helps typeset pseudocode with minimal formatting}
|
13
13
|
spec.licenses = ["MIT"]
|
@@ -14,8 +14,9 @@ module Jekyll
|
|
14
14
|
[/(\".*?\")/, :string],
|
15
15
|
[/(<-|->|\+\+|<=|>=|--|!=|:=|==|<>|<->|<-->|<--|-->)/, :op], # try these operators first
|
16
16
|
[/([-()\[\]{}=<>+*\/])/, :op], # and these second
|
17
|
-
[
|
17
|
+
[/\$(pi|tau|infinity)/, :math],
|
18
18
|
[/\b([0-9]*\.?[0-9]+)/, :number],
|
19
|
+
[/\@([a-zA-Z0-9]*)(_[a-zA-Z0-9]+)?/, :special],
|
19
20
|
[/\b([a-z][a-zA-Z0-9]*)(_[a-zA-Z0-9]+)?/, :var],
|
20
21
|
[/^(\s+)/, :indent]
|
21
22
|
]
|
@@ -31,6 +31,14 @@ module Jekyll
|
|
31
31
|
"<span class='numeric'>#{txt}</span>"
|
32
32
|
end
|
33
33
|
|
34
|
+
def special(txt, sub)
|
35
|
+
if sub
|
36
|
+
"<span class='special'>#{txt}<sub>#{sub.slice(1,sub.size)}</sub></span>"
|
37
|
+
else
|
38
|
+
"<span class='special'>#{txt}</span>"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
34
42
|
def var(txt, sub)
|
35
43
|
if sub
|
36
44
|
"<span class='variable'>#{txt}<sub>#{sub.slice(1,sub.size)}</sub></span>"
|
@@ -87,8 +95,9 @@ module Jekyll
|
|
87
95
|
|
88
96
|
def math(txt)
|
89
97
|
symbol = case txt
|
90
|
-
when '
|
91
|
-
when '
|
98
|
+
when 'pi' then 'π'
|
99
|
+
when 'tau' then '𝛕'
|
100
|
+
when 'infinity' then '∞'
|
92
101
|
else txt
|
93
102
|
end
|
94
103
|
# FIXME: html conversion for some operators
|
data/spec/html_spec.rb
CHANGED
@@ -39,5 +39,15 @@ describe HtmlBrush do
|
|
39
39
|
format("<").should eql "<span class='operator'><</span>"
|
40
40
|
format("*").should eql "<span class='operator'>×</span>"
|
41
41
|
end
|
42
|
+
|
43
|
+
it "math symbols" do
|
44
|
+
format("$pi").should eql "<span class='math-symbol'>π</span>"
|
45
|
+
format("$infinity").should eql "<span class='math-symbol'>∞</span>"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "special vars" do
|
49
|
+
format("@null").should eql "<span class='special'>null</span>"
|
50
|
+
format("@special").should eql "<span class='special'>special</span>"
|
51
|
+
end
|
42
52
|
end
|
43
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-pseudocode-b
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Ulrich
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-02-
|
13
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jekyll
|
@@ -82,8 +82,12 @@ files:
|
|
82
82
|
- Gemfile
|
83
83
|
- README.md
|
84
84
|
- Rakefile
|
85
|
+
- css/default.css
|
86
|
+
- css/sonofobsidian.css
|
87
|
+
- css/visuallike.css
|
88
|
+
- doc/output-sample-0.png
|
89
|
+
- doc/output-sample-1.png
|
85
90
|
- doc/output-sample.png
|
86
|
-
- doc/samplecode.png
|
87
91
|
- jekyll-pseudocode-b.gemspec
|
88
92
|
- lib/jekyll-pseudocode-b.rb
|
89
93
|
- lib/jekyll-pseudocode-b/brush.rb
|
@@ -94,7 +98,7 @@ files:
|
|
94
98
|
- spec/grammar_spec.rb
|
95
99
|
- spec/html_spec.rb
|
96
100
|
- spec/spec_helper.rb
|
97
|
-
homepage: http://github.com/
|
101
|
+
homepage: http://github.com/tobiasbu/jekyll-pseudocode-b
|
98
102
|
licenses:
|
99
103
|
- MIT
|
100
104
|
metadata: {}
|
data/doc/samplecode.png
DELETED
Binary file
|