markita 3.2.210915 → 3.3.210918

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
  SHA256:
3
- metadata.gz: 2d00ccf97d0939c6b5ebd695e248046eabda96bc285b528f42ccec7e0ecddfaf
4
- data.tar.gz: c3ad41a468998efd4511e72bae1cba352aca5f6ad7309f8ecb969fd3f83fe670
3
+ metadata.gz: 00f2378d6afe1f1ed2251e78d0e413305cc3a2616da3dfeccfe3446faac0712c
4
+ data.tar.gz: 8d099fe74a6bd50829c1a09f9bbc492893113c868dc4731cd41bd4380d19cbe5
5
5
  SHA512:
6
- metadata.gz: d24749f9a8550b67efe84f3ed16c42461f7a9cdfd5ab2608bc16af580af761c0761f86c4b7906feef3114f8c5f62ff67222e865cee85061799f6983ad509948b
7
- data.tar.gz: 051d4e295dcff13a3b6bdf3679196741c18853cc8c9167ef6ac9a6bf20381c2fed38525e44c4def393e409d4d0bfa565e8e3a60388db4c117a3c320f976f5184
6
+ metadata.gz: 0d13c5e56db469e15a3d5b11048cb1f70b3ffae0f02dec77b02edef36b47d8393218f66755fa5619c2755861e163b1c4d3d05edba9f55f06d44f1c61366ee239
7
+ data.tar.gz: 958c7442e49d7efd39bc9c99d843c788c0f5e1e29ca87e5965816f04fff8a61494ccc1acaa2b855e9ce543edc6b9a4b1e505043159d494a8f9820bd0d4461b02
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Markita
2
2
 
3
- * [VERSION 3.2.210915](https://github.com/carlosjhr64/markita/releases)
3
+ * [VERSION 3.3.210918](https://github.com/carlosjhr64/markita/releases)
4
4
  * [github](https://www.github.com/carlosjhr64/markita)
5
5
  * [rubygems](https://rubygems.org/gems/markita)
6
6
 
@@ -23,6 +23,7 @@ Options:
23
23
  --root=DIRECTORY ~/vimwiki
24
24
  --bind=BIND 0.0.0.0
25
25
  --port=PORT 8080
26
+ --theme=THEME base16.light
26
27
  --allowed=IPS
27
28
  --no_about
28
29
  --no_favicon
@@ -34,8 +35,8 @@ Types:
34
35
  DIRECTORY /^~?[\/\w\.]+$/
35
36
  BIND /^[\w\.]+$/
36
37
  PORT /^\d+$/
37
- THEME /^[\w\.]+$/
38
38
  IPS /^[\d\.\,]+$/
39
+ THEME /^[\w\.]+$/
39
40
  # NOTE:
40
41
  # Assuming site is in ~/vimwiki,
41
42
  # when ~/vimwiki/.valid-id is set with a sha256sum of a password,
@@ -300,12 +301,11 @@ Markdown:
300
301
  $ # Assuming ~/vimwiki is your site's root...
301
302
  $ echo -n '<SitePasswordHere>' | sha256sum | grep -o '^\w*' > ~/vimwiki/.valid-id
302
303
  ```
303
- ### Set site custom favicon, css, not found page, and login form and fail page:
304
+ ### Set site custom favicon, not found page, and login form and fail page:
304
305
  ```console
305
306
  $ # Assuming ~/vimwiki is your site's root...
306
307
  $ # Note that you'll have to restart the server on any change to these:
307
308
  $ cp /path-to/custom/favicon.ico ~/vimwiki/favicon.ico
308
- $ cp /path-to/custom/highlight.css ~/vimwiki/highlight.css
309
309
  $ cp /path-to/custom/not_found.html ~/vimwiki/not_found.html
310
310
  $ cp /path-to/custom/login_form.html ~/vimwiki/login_form.html
311
311
  $ cp /path-to/custom/login_fail.html ~/vimwiki/login_fail.html
data/bin/markita CHANGED
@@ -9,6 +9,7 @@ Options:
9
9
  --root=DIRECTORY \t ~/vimwiki
10
10
  --bind=BIND \t 0.0.0.0
11
11
  --port=PORT \t 8080
12
+ --theme=THEME \t base16.light
12
13
  --allowed=IPS
13
14
  --no_about
14
15
  --no_favicon
@@ -21,6 +22,7 @@ Types:
21
22
  BIND /^[\\w\\.]+$/
22
23
  PORT /^\\d+$/
23
24
  IPS /^[\\d\\.\\,]+$/
25
+ THEME /^[\\w\\.]+$/
24
26
  # NOTE:
25
27
  # Assuming site is in ~/vimwiki,
26
28
  # when ~/vimwiki/.valid-id is set with a sha256sum of a password,
@@ -121,15 +121,20 @@ class Markdown
121
121
  end
122
122
 
123
123
  # Ordered list
124
- ORDERED = /^\d+. (.*)$/
124
+ ORDERED = /^( {0,3})\d+\. (\S.*)$/
125
125
  PARSERS << :ordered
126
- def ordered
127
- md = ORDERED.match(@line) or return false
126
+ def ordered(md=ORDERED.match(@line), level=0)
127
+ return false unless md
128
128
  @html << "<ol#{@opt[:attributes]}>\n"
129
129
  @opt.delete(:attributes)
130
- while md
131
- @html << " <li>#{INLINE[md[1]]}</li>\n"
132
- md = (@line=@file.gets)&.match ORDERED
130
+ while md and level==md[1].length
131
+ @html << " <li>#{INLINE[md[2]]}</li>\n"
132
+ if md = (@line=@file.gets)&.match(ORDERED)
133
+ if level < md[1].length
134
+ ordered(md, md[1].length)
135
+ md = @line&.match(ORDERED)
136
+ end
137
+ end
133
138
  end
134
139
  @html << "</ol>\n"
135
140
  true
@@ -151,15 +156,20 @@ class Markdown
151
156
  end
152
157
 
153
158
  # Unordered list
154
- UNORDERED = /^[*] (.*)$/
159
+ UNORDERED = /^( {0,3})[*] (\S.*)$/
155
160
  PARSERS << :unordered
156
- def unordered
157
- md = UNORDERED.match(@line) or return false
161
+ def unordered(md=UNORDERED.match(@line), level=0)
162
+ return false unless md
158
163
  @html << "<ul#{@opt[:attributes]}>\n"
159
164
  @opt.delete(:attributes)
160
- while md
161
- @html << " <li>#{INLINE[md[1]]}</li>\n"
162
- md = (@line=@file.gets)&.match UNORDERED
165
+ while md and level==md[1].length
166
+ @html << " <li>#{INLINE[md[2]]}</li>\n"
167
+ if md = (@line=@file.gets)&.match(UNORDERED)
168
+ if level < md[1].length
169
+ unordered(md, md[1].length)
170
+ md = @line&.match(UNORDERED)
171
+ end
172
+ end
163
173
  end
164
174
  @html << "</ul>\n"
165
175
  true
@@ -2,7 +2,9 @@ module Markita
2
2
  class Base
3
3
  HEADER_LINKS << %Q( <link rel="stylesheet" href="/highlight.css" type="text/css">\n)
4
4
  module Highlight
5
- CSS = File.read PATH['highlight.css']
5
+ theme = OPTIONS&.theme || 'base16.light'
6
+ CSS = Rouge::Theme.find(theme)&.render(scope: '.highlight')
7
+ raise "Can't find Rouge Theme "+theme unless CSS
6
8
  end
7
9
 
8
10
  get '/highlight.css' do
data/lib/markita.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Markita
2
- VERSION = '3.2.210915'
2
+ VERSION = '3.3.210918'
3
3
 
4
4
  def self.run!
5
5
  # Standard libraries
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markita
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.210915
4
+ version: 3.3.210918
5
5
  platform: ruby
6
6
  authors:
7
7
  - CarlosJHR64
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-15 00:00:00.000000000 Z
11
+ date: 2021-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: help_parser
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '7.0'
19
+ version: '8.0'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 7.0.200907
22
+ version: 8.0.210917
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '7.0'
29
+ version: '8.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 7.0.200907
32
+ version: 8.0.210917
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rouge
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '3.26'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 3.26.0
42
+ version: 3.26.1
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '3.26'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 3.26.0
52
+ version: 3.26.1
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: sinatra
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -104,7 +104,6 @@ files:
104
104
  - bin/markita
105
105
  - data/emojis.tsv
106
106
  - data/favicon.ico
107
- - data/highlight.css
108
107
  - data/login_failed.html
109
108
  - data/login_form.html
110
109
  - data/not_found.html
data/data/highlight.css DELETED
@@ -1,81 +0,0 @@
1
- /* Ruby Gem Rouge's base16.light */
2
- .highlight table td { padding: 5px; }
3
- .highlight table pre { margin: 0; }
4
- .highlight, .highlight .w {
5
- color: #303030;
6
- }
7
- .highlight .err {
8
- color: #151515;
9
- background-color: #ac4142;
10
- }
11
- .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf, .highlight .c1, .highlight .cs {
12
- color: #505050;
13
- }
14
- .highlight .cp {
15
- color: #f4bf75;
16
- }
17
- .highlight .nt {
18
- color: #f4bf75;
19
- }
20
- .highlight .o, .highlight .ow {
21
- color: #d0d0d0;
22
- }
23
- .highlight .p, .highlight .pi {
24
- color: #d0d0d0;
25
- }
26
- .highlight .gi {
27
- color: #90a959;
28
- }
29
- .highlight .gd {
30
- color: #ac4142;
31
- }
32
- .highlight .gh {
33
- color: #6a9fb5;
34
- background-color: #151515;
35
- font-weight: bold;
36
- }
37
- .highlight .k, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kv {
38
- color: #aa759f;
39
- }
40
- .highlight .kc {
41
- color: #d28445;
42
- }
43
- .highlight .kt {
44
- color: #d28445;
45
- }
46
- .highlight .kd {
47
- color: #d28445;
48
- }
49
- .highlight .s, .highlight .sb, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .s1 {
50
- color: #90a959;
51
- }
52
- .highlight .sa {
53
- color: #aa759f;
54
- }
55
- .highlight .sr {
56
- color: #75b5aa;
57
- }
58
- .highlight .si {
59
- color: #8f5536;
60
- }
61
- .highlight .se {
62
- color: #8f5536;
63
- }
64
- .highlight .nn {
65
- color: #f4bf75;
66
- }
67
- .highlight .nc {
68
- color: #f4bf75;
69
- }
70
- .highlight .no {
71
- color: #f4bf75;
72
- }
73
- .highlight .na {
74
- color: #6a9fb5;
75
- }
76
- .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx {
77
- color: #90a959;
78
- }
79
- .highlight .ss {
80
- color: #90a959;
81
- }