markita 3.0.210912 → 3.1.210913

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: b39bace23d9d3e2c779379b38fe440abe26213ad3c0b6933fd9d7f6d2679b4af
4
- data.tar.gz: aeafe146d44a85bcc4aafb16130f964701134c7b7c7bb8dec2bd82fe00e30186
3
+ metadata.gz: d48cd0cacac70dc9974733968e16d5958676172aae7ac7138995855ef82839b7
4
+ data.tar.gz: 1355e68fa3255f16331a4afc36f2d47ecfbd1583fbf2f16a9742c53e50390414
5
5
  SHA512:
6
- metadata.gz: 17775d54b7269655d00792aaed965f332b9c29ff063f9a333794ef32f1d07bc7f05d3c663ec616ddd462059ed6e03e9282669e9db7eabb37d0bfc8cb7f11d17f
7
- data.tar.gz: 58285bfad94c859d7c5ab0780647b725eb78b317c34fbcda306c11d117aa31cc699a297f27c0e34a6b86dd0577b9cafd4f6c5049f5d4dabda80f418a91352e83
6
+ metadata.gz: 54630f6cef7d9632699c16b8e9e447799c85806adc75202cc774272066de82927260ba5fbb4da5f974860dc48d5a26ef9e96d463c4825676a801207c28f850bd
7
+ data.tar.gz: 34a7e703827b69fb3e0c4e406d477c3ab35d605fc9f1d87c9cae1a2724b8e01099de74b7c6b1ee5f6c220f35bc277e717637925464dfab5938303fcfb37f601b
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Markita
2
2
 
3
- * [VERSION 3.0.210912](https://github.com/carlosjhr64/markita/releases)
3
+ * [VERSION 3.1.210913](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
 
@@ -27,6 +27,7 @@ Options:
27
27
  --no_about
28
28
  --no_favicon
29
29
  --no_highlight
30
+ --no_navigation
30
31
  --no_login
31
32
  --no_plugs
32
33
  Types:
@@ -62,11 +63,23 @@ Markdown:
62
63
  ![Left Floating ](/img/image.png)
63
64
  ![ Right Floating](/img/image.png)
64
65
  Image centered above.
65
- Image to the left.
66
+ Image to the left with width and height set.
66
67
  Image to the right.
67
68
  And set a HR bar below.
68
69
  ---
69
70
 
71
+ ### Image size
72
+
73
+ Markdown:
74
+
75
+ ![In alt text say 100x100](/img/image.png)
76
+
77
+ ### Image link
78
+
79
+ Markdown:
80
+
81
+ ![Alt text](/img/image.png /href_to/page)
82
+
70
83
  ### Forms
71
84
 
72
85
  Markdown:
data/bin/markita CHANGED
@@ -13,6 +13,7 @@ Options:
13
13
  --no_about
14
14
  --no_favicon
15
15
  --no_highlight
16
+ --no_navigation
16
17
  --no_login
17
18
  --no_plugs
18
19
  Types:
@@ -2,6 +2,7 @@ module Markita
2
2
  OPTIONS ||= nil
3
3
 
4
4
  HEADER_LINKS = ''
5
+ NAVIGATION = ''
5
6
 
6
7
  ROOT = File.expand_path OPTIONS&.root || '~/vimwiki'
7
8
  raise "Missing site root directory: "+ROOT unless File.directory? ROOT
data/lib/markita/html.rb CHANGED
@@ -11,6 +11,10 @@ module HTML
11
11
  HEADER
12
12
  end
13
13
 
14
+ def HTML.navigation
15
+ NAVIGATION
16
+ end
17
+
14
18
  def HTML.footer
15
19
  <<~FOOTER
16
20
  </body>
@@ -9,11 +9,13 @@ class Markdown
9
9
  end
10
10
 
11
11
  def start
12
- @line,@html,@opt = HTML.header(@title),'',{}
12
+ @html << HTML.header(@title)
13
+ @line = HTML.navigation
13
14
  end
14
15
 
15
16
  def finish
16
17
  @html << HTML.footer
18
+ @line = nil
17
19
  end
18
20
 
19
21
  def default
@@ -21,8 +23,12 @@ class Markdown
21
23
  @line = @file.gets
22
24
  end
23
25
 
26
+ def init(fh)
27
+ @file,@html,@opt = Preprocess.new(fh),'',{}
28
+ end
29
+
24
30
  def parse(fh)
25
- @file = Preprocess.new(fh)
31
+ init(fh)
26
32
  start
27
33
  while @line
28
34
  PARSERS.detect{method(_1).call} or default
@@ -332,7 +338,7 @@ class Markdown
332
338
  PARSERS << :images
333
339
  def images
334
340
  md = IMAGES.match(@line) or return false
335
- alt,src=md[1],md[2]
341
+ alt,src,href=md[1],*md[2].strip.split(/\s+/,2)
336
342
  style = ' '
337
343
  case alt
338
344
  when /^ .* $/
@@ -342,7 +348,12 @@ class Markdown
342
348
  when /^ /
343
349
  style = %Q( style="float:right;" )
344
350
  end
351
+ if /(\d+)x(\d+)/.match alt
352
+ style << %Q(width="#{$1}" height="#{$2}" )
353
+ end
354
+ @html << %Q(<a href="#{href}">\n) if href
345
355
  @html << %Q(<img src="#{src}"#{style}alt="#{alt.strip}"#{@opt[:attributes]}>\n)
356
+ @html << %Q(</a>\n) if href
346
357
  @opt.delete(:attributes)
347
358
  @line = @file.gets
348
359
  true
@@ -1,5 +1,5 @@
1
1
  module Markita
2
- class Base < Sinatra::Base
2
+ class Base
3
3
  HEADER_LINKS << %Q( <link rel="icon" type="image/x-icon" href="/favicon.ico">\n)
4
4
  module Favicon
5
5
  ICO = File.read PATH['favicon.ico']
@@ -1,5 +1,5 @@
1
1
  module Markita
2
- class Base < Sinatra::Base
2
+ class Base
3
3
  HEADER_LINKS << %Q( <link rel="stylesheet" href="/highlight.css" type="text/css">\n)
4
4
  module Highlight
5
5
  CSS = File.read PATH['highlight.css']
@@ -0,0 +1,3 @@
1
+ module Markita
2
+ NAVIGATION << %Q(![ Navigation](/favicon.ico /index)\n)
3
+ end
data/lib/markita.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Markita
2
- VERSION = '3.0.210912'
2
+ VERSION = '3.1.210913'
3
3
 
4
4
  def self.run!
5
5
  # Standard libraries
@@ -18,6 +18,7 @@ module Markita
18
18
  # Plugs
19
19
  require_relative 'markita/plug/favicon.rb' unless OPTIONS&.no_favicon
20
20
  require_relative 'markita/plug/highlight.rb' unless OPTIONS&.no_highlight
21
+ require_relative 'markita/plug/navigation.rb' unless OPTIONS&.no_navigation
21
22
  require_relative 'markita/plug/login.rb' unless OPTIONS&.no_login
22
23
  require_relative 'markita/plug/about.rb' unless OPTIONS&.no_about
23
24
  require_relative 'markita/plug/plugs.rb' unless OPTIONS&.no_plugs
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.0.210912
4
+ version: 3.1.210913
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-12 00:00:00.000000000 Z
11
+ date: 2021-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: help_parser
@@ -117,6 +117,7 @@ files:
117
117
  - lib/markita/plug/favicon.rb
118
118
  - lib/markita/plug/highlight.rb
119
119
  - lib/markita/plug/login.rb
120
+ - lib/markita/plug/navigation.rb
120
121
  - lib/markita/plug/plugs.rb
121
122
  - lib/markita/preprocess.rb
122
123
  homepage: https://github.com/carlosjhr64/markita