bluedoc-sml 0.6.0 → 0.6.1

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: 024c504153f4ea8a34bcee06a5913cd7c4bbd1322e93078efccd742094a8758c
4
- data.tar.gz: 9921efde720897e7ecdd391845c375054b5612b65532a5cb22cfd8eeabf98638
3
+ metadata.gz: b42faf5f6a63c5ba48bc3df7157f106ed348b0b1bb9ec5be85fccdb4ce7c8ed1
4
+ data.tar.gz: b09c64f34316a98d5f4b5df131eadc49dfe055342d877905890d81a221a5097a
5
5
  SHA512:
6
- metadata.gz: ea8c08e6c4dd92d2b4561e5a65158f10993fec7eedabac88ad5029d20f428812f33a06b346820548d9397bd427f0c2605b947dea8fa7a29be599a28c9e2bb1d6
7
- data.tar.gz: b013d14116a952e78018298c11db192b8b11c64063b2ff1925de0566dce5c116e140d3765594f77d497208ae010619b1ca7c31b560a5e37ab1c38e2959393d3a
6
+ metadata.gz: 5820c42b3eb931a26f24aa52d415623ae369f0fcaf59d8c3f333b0c3fd58118c28a95a746582996cf1812ae22c9fc8a5f6f4c86fe9178280d972c5b04fcd6d5b
7
+ data.tar.gz: f3925f4ab3884600dabdfaa1eca12230f2cad388e6b5074e3d368b6a447eb6a37367e1d52c7e5ef0948c7922f3995a48e4443d23e57ffb90fde4a0aed4e9659e
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # BlueDoc::SML
2
2
 
3
- [![CircleCI](https://circleci.com/gh/bluedoc-org/bluedoc-sml/tree/master.svg?style=shield&circle-token=231806e2ce24e58a85190a0cd167b7d2da27c0b9)](https://circleci.com/gh/bluedoc-org/bluedoc-sml/tree/master)
3
+ [![CircleCI](https://circleci.com/gh/thebluedoc/bluedoc-sml/tree/master.svg?style=shield&circle-token=f1967fcb6f13fb9bcdb074769fc30038d36aee53)](https://circleci.com/gh/thebluedoc/bluedoc-sml/tree/master)
4
4
 
5
5
  SML __(Slate markup language)__ is a rich text format for describe of the BlueDoc rich contents.
6
6
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "zlib"
2
4
 
3
5
  module BlueDoc
@@ -7,7 +9,7 @@ module BlueDoc
7
9
  result = ""
8
10
  compressedData = Zlib::Deflate.deflate(text)
9
11
  compressedData.chars.each_slice(3) do |bytes|
10
- #print bytes[0], ' ' , bytes[1] , ' ' , bytes[2]
12
+ # print bytes[0], ' ' , bytes[1] , ' ' , bytes[2]
11
13
  b1 = bytes[0].nil? ? 0 : (bytes[0].ord & 0xFF)
12
14
  b2 = bytes[1].nil? ? 0 : (bytes[1].ord & 0xFF)
13
15
  b3 = bytes[2].nil? ? 0 : (bytes[2].ord & 0xFF)
@@ -21,7 +23,7 @@ module BlueDoc
21
23
  c2 = ((b1 & 0x3) << 4) | (b2 >> 4)
22
24
  c3 = ((b2 & 0xF) << 2) | (b3 >> 6)
23
25
  c4 = b3 & 0x3F
24
- return encode6bit(c1 & 0x3F).chr +
26
+ encode6bit(c1 & 0x3F).chr +
25
27
  encode6bit(c2 & 0x3F).chr +
26
28
  encode6bit(c3 & 0x3F).chr +
27
29
  encode6bit(c4 & 0x3F).chr
@@ -29,25 +31,25 @@ module BlueDoc
29
31
 
30
32
  def encode6bit(b)
31
33
  if b < 10
32
- return ('0'.ord + b).chr
34
+ return ("0".ord + b).chr
33
35
  end
34
36
  b = b - 10
35
37
  if b < 26
36
- return ('A'.ord + b).chr
38
+ return ("A".ord + b).chr
37
39
  end
38
40
  b = b - 26
39
41
  if b < 26
40
- return ('a'.ord + b).chr
42
+ return ("a".ord + b).chr
41
43
  end
42
44
  b = b - 26
43
45
  if b == 0
44
- return '-'
46
+ return "-"
45
47
  end
46
48
  if b == 1
47
- return '_'
49
+ return "_"
48
50
  end
49
- return '?'
51
+ "?"
50
52
  end
51
53
  end
52
54
  end
53
- end
55
+ end
@@ -10,7 +10,7 @@ module BlueDoc::SML::Rules
10
10
 
11
11
  def self.to_html(node, opts = {})
12
12
  renderer = opts[:renderer]
13
- title = renderer.children_to_html(node) || ""
13
+ title = (renderer.children_to_html(node) || "").strip
14
14
  heading_tag = tag_name(node)
15
15
 
16
16
  title_length = title.length
@@ -21,7 +21,11 @@ module BlueDoc::SML::Rules
21
21
  header_id = Digest::MD5.hexdigest(title.strip)[0..8]
22
22
  end
23
23
 
24
- %(<#{heading_tag} id="#{header_id}"><a href="##{header_id}" class="heading-anchor">#</a>#{title}</#{heading_tag}>)
24
+ if title.blank?
25
+ %(<#{heading_tag}>#{title}</#{heading_tag}>)
26
+ else
27
+ %(<#{heading_tag} id="#{header_id}"><a href="##{header_id}" class="heading-anchor">#</a>#{title}</#{heading_tag}>)
28
+ end
25
29
  end
26
30
  end
27
31
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module BlueDoc
4
4
  module SML
5
- VERSION = "0.6.0"
5
+ VERSION = "0.6.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bluedoc-sml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-20 00:00:00.000000000 Z
11
+ date: 2019-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport