jekyll-pseudocode-b 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a206281381f3106b1d82cc74b939b8ab10ec3ee
4
- data.tar.gz: 7d81b69ca7f21bfbd8fcea8147f99244ab429a21
3
+ metadata.gz: eef7a48960228af9d3d2b202a73ed8849c39f14f
4
+ data.tar.gz: 2976f0fbfe5df47f2b04fee994c468967aae509c
5
5
  SHA512:
6
- metadata.gz: dadf8baefeda70808d11d0a76d5a2ffab0d462611dd53ded0957bdc3af1ac18d168b1b376ad565eaf198c98f0c93c1e8f9e909e39dbe2d60fbc398b73f3f9697
7
- data.tar.gz: 891fbd1fc6c702d5746fb5b79211873f8e53e59d1e250310a8741639b5ad52ca180796b1c11cde3b2f52d8cca3b50764466bf71872e39d5960106c63c05ea932
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
- | <- | &#x2190; |
56
- | -> | &#x2192; |
57
- | <-- | &#x27f5; |
58
- | --> | &#x27f6; |
59
- | => | &#x2265; |
60
- | <= | &#x2264; |
61
- | == | &#xff1d; |
62
- | := | &#x2254; |
63
- | = | &#x3d; |
64
- | < | &#65308; |
65
- | > | &#65310; |
66
- | [ | &#65339; |
67
- | ] | &#65341; |
68
- | <-> | &#x2194; |
69
- | <--> | &#x27f7; |
70
- | $pi | &#x3C0; |
71
- | $tau | &#x1d6d5; |
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
  ![Image](https://raw.githubusercontent.com/tobiasbu/jekyll-pseudo/master/doc/output-sample.png)
99
76
 
77
+ ## Auto-Formatted Syntax
78
+
79
+ The following table shows auto-formated symbols:
80
+
81
+ | Syntax | Symbol |
82
+ | :------: | :--------: |
83
+ | <- | &#x2190; |
84
+ | -> | &#x2192; |
85
+ | <-- | &#x27f5; |
86
+ | --> | &#x27f6; |
87
+ | => | &#x2265; |
88
+ | <= | &#x2264; |
89
+ | == | &#xff1d; |
90
+ | := | &#x2254; |
91
+ | = | &#x3d; |
92
+ | < | &#65308; |
93
+ | > | &#65310; |
94
+ | [ | &#65339; |
95
+ | ] | &#65341; |
96
+ | <-> | &#x2194; |
97
+ | <--> | &#x27f7; |
98
+ | $pi | &#x3C0; |
99
+ | $tau | &#x1d6d5; |
100
+ | $infinity | &#x221e; |
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
+ ![Sample 0](https://raw.githubusercontent.com/tobiasbu/jekyll-pseudo/master/doc/output-sample-0.png)
103
107
 
104
- _Comming soon_
108
+ ![Sample 1](https://raw.githubusercontent.com/tobiasbu/jekyll-pseudo/master/doc/output-sample-1.png)
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
+ }
@@ -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
@@ -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/wkm/jekyll-pseudo"
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"]
@@ -17,7 +17,12 @@ module Jekyll
17
17
  end
18
18
 
19
19
  # format a variable
20
- def variable(txt, sub)
20
+ def var(txt, sub)
21
+ raise 'not implemented'
22
+ end
23
+
24
+ # format a special variable
25
+ def special(txt, sub)
21
26
  raise 'not implemented'
22
27
  end
23
28
 
@@ -14,8 +14,9 @@ module Jekyll
14
14
  [/(\".*?\")/, :string],
15
15
  [/(<-|->|\+\+|<=|>=|--|!=|:=|==|<>|<->|<-->|<--|-->)/, :op], # try these operators first
16
16
  [/([-()\[\]{}=<>+*\/])/, :op], # and these second
17
- [/(\$pi|\$tau)/, :math],
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 '$pi' then '&#x3C0;'
91
- when '$tau' then '&#x1d6d5;'
98
+ when 'pi' then '&#x3C0;'
99
+ when 'tau' then '&#x1d6d5;'
100
+ when 'infinity' then '&#x221e;'
92
101
  else txt
93
102
  end
94
103
  # FIXME: html conversion for some operators
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module PseudoCodeB
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
data/spec/html_spec.rb CHANGED
@@ -39,5 +39,15 @@ describe HtmlBrush do
39
39
  format("<").should eql "<span class='operator'>&#65308;</span>"
40
40
  format("*").should eql "<span class='operator'>&times;</span>"
41
41
  end
42
+
43
+ it "math symbols" do
44
+ format("$pi").should eql "<span class='math-symbol'>&#x3C0;</span>"
45
+ format("$infinity").should eql "<span class='math-symbol'>&#x221e;</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.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-24 00:00:00.000000000 Z
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/wkm/jekyll-pseudo
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