AoBane 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,7 +2,7 @@ AoBane The MarkDown Core Engine
2
2
  ======
3
3
 
4
4
  Powered By BlueFeather<br>
5
- See also [AoBane development memo](https://github.com/setminami/AoBane/wiki/development-memo).
5
+ See also [AoBane Syntax](https://github.com/setminami/AoBane/wiki/Details-of-AoBane-Syntax).
6
6
 
7
7
  ##What's This and What You Can...
8
8
  This codes are extended from BlueFeather.<br>
@@ -106,6 +106,38 @@ like this
106
106
 
107
107
  > !in &notin;
108
108
 
109
+ <h2> 2.6 Table Caption</h2>
110
+ Do you want to insert a caption to &lt;table&gt;? You can insert in AoBane. <br>
111
+ Like this:<br>
112
+ <pre><code>
113
+ [foo]{#bar}
114
+ |fruits|price
115
+ |------|-----
116
+ |Apple|$0.5
117
+ |Orange|$0.3
118
+ </code></pre>
119
+ the first line [foo]{#bar} and this table, expands HTML as below:<br>
120
+ <pre><code>
121
+ &lt;table id="#bar"&gt;
122
+ &lt;caption&gt;foo&lt;/caption&gt;
123
+ &lt;thead&gt;&lt;tr&gt;
124
+ &lt;th&gt;fruits&lt;/th&gt;
125
+ &lt;th&gt;price&lt;/th&gt;
126
+ &lt;/tr&gt;&lt;/thead&gt;
127
+ &lt;tbody&gt;
128
+ &lt;tr&gt;
129
+ &lt;td&gt;Apple&lt;/td&gt;
130
+ &lt;td&gt;$0.5&lt;/td&gt;
131
+ &lt;/tr&gt;
132
+ &lt;tr&gt;
133
+ &lt;td&gt;Orange&lt;/td&gt;
134
+ &lt;td&gt;$0.3&lt;/td&gt;
135
+ &lt;/tr&gt;
136
+ &lt;/tbody&gt;
137
+ &lt;/table&gt;
138
+ </code></pre>
139
+ The "#bar" is adapted to table id, and "foo" is surrounded by &lt;captin&gt; and &lt;/caption&gt; as elements in following table. When you put caption to a table, you should write `[Table 1](#Table1)` somewhere in your Markdown. So, you can jump to a table from the link. <br>
140
+ Of course, you can omit this.
109
141
 
110
142
  ##How to Install
111
143
  Just try
@@ -16,27 +16,30 @@ $MAX_H = 6
16
16
  @@log.level = Logger::WARN
17
17
 
18
18
  ###paling proccessing##########################################################
19
- $startDivMark =
20
- '\|\-:b=(\d+?)\s(\w+?\s\w+?\s)(w=(\w+?)\s){0,1}(h=(\w+?)\s){0,1}(bg=((#){0,1}\w+?)\s){0,1}' +
21
- '(lh=(\w+?)\s){0,1}' +
19
+ StartDivMark =
20
+ '\|\-:b=(\d+?)\s(\w+?\s\w+?\s)' +
21
+ '(w=(\w+?)\s){0,1}' +
22
+ '(h=(\w+?)\s){0,1}' +
23
+ '(bg=((#){0,1}\w+?)\s){0,1}' +
24
+ '(lh=([\w%]+?)\s){0,1}' +
22
25
  'rad=(\d+?)\-+\|'
23
- $endDivMark = '\|\-+\|'
26
+ EndDivMark = '\|\-+\|'
24
27
 
25
28
  def prePaling(text)
26
29
  output = text.split("\n")
27
30
  output.each_with_index{|line,index|
28
- if /#{$startDivMark}/ =~ line then
31
+ if /#{StartDivMark}/ =~ line then
29
32
  loop do
30
33
  index += 1
31
- if /#{$endDivMark}/ =~ output[index] then
34
+ if /#{EndDivMark}/ =~ output[index] then
32
35
  break
33
36
  elsif /^\|(\#{1,6})\s*(.*)\|/ =~ output[index] then
34
37
  output[index] = '#'*$1.size + $2 #pass through to BlueFeather
35
- elsif /^(\s*)\*(\s.+?)/ =~ output[index] then
38
+ elsif /^\|(\s*)\*(\s.+?)\s*\|/ =~ output[index] then
36
39
  output[index] = $1 + '*' + $2 #pass through to BlueFeather
37
- elsif /^(\s*)\-(\s.+?)/ =~ output[index] then
38
- output[index] = $1 + '*' + $2 #pass through to BlueFeather
39
- elsif /^\|(.*)\s*\|/ =~ output[index] then
40
+ elsif /^\|(\s*)\-(\s.+?)\s*\|/ =~ output[index] then
41
+ output[index] = $1 + '-' + $2 #pass through to BlueFeather
42
+ elsif /^\|(.*\s*)\|/ =~ output[index] then
40
43
  output[index] = $1
41
44
  end
42
45
  end
@@ -56,17 +59,17 @@ end
56
59
  def postPaling(text)
57
60
  output = text.split("\n")
58
61
  output.each_with_index{|line,index|
59
- if /#{$startDivMark}/ =~ line then
62
+ if /#{StartDivMark}/ =~ line then
60
63
  output[index] = '<div style="border:' + $1 + 'px ' + $2 + ';' +
61
64
  if $4.nil? then '' else 'width:' + if Utilities::isDigit($4) then $4 + 'px;' else $4 + ';' end end +
62
65
  if $6.nil? then '' else 'height:' + if Utilities::isDigit($6) then $6 + 'px;' else $6 + ';' end end +
63
66
  if $8.nil? then '' else 'background-color:' + $8 + ';' end +
64
- if $11.nil? then 'line-height:50%;' else 'line-height:' + $11 + ';' end +
67
+ if $11.nil? then 'line-height:100%;' else 'line-height:' + $11 + ';' end +
65
68
  'border-radius:' +
66
69
  if $12.nil? then '' else $12 end + 'px;">'
67
70
  loop do
68
71
  index += 1
69
- if /#{$endDivMark}/ =~ output[index] then
72
+ if /#{EndDivMark}/ =~ output[index] then
70
73
  output[index] = '</div>'
71
74
  break
72
75
  end
@@ -1,3 +1,3 @@
1
1
  module AoBane
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
data/lib/AoBane.rb CHANGED
@@ -51,8 +51,8 @@ require 'AoBane/utilities'
51
51
  require 'math_ml/string'
52
52
 
53
53
  module AoBane
54
- VERSION = '0.1.10'
55
- VERSION_NUMBER = 0.0110
54
+ VERSION = '0.1.11'
55
+ VERSION_NUMBER = 0.0111
56
56
  RELEASE_DATE = '2013-04-20'
57
57
  VERSION_LABEL = "#{VERSION} (#{RELEASE_DATE})"
58
58
 
@@ -2026,28 +2026,28 @@ module AoBane
2026
2026
 
2027
2027
  # Set up the string scanner and just return the string unless there's at
2028
2028
  # least one backtick.
2029
+
2029
2030
  @scanner.string = str.dup
2030
2031
  unless @scanner.exist?( /`/ )
2031
2032
  @scanner.terminate
2032
- @log.debug "No backticks found for code span in %p" % str
2033
+ @log.warn "No backticks found for code span in %p" % str
2033
2034
  return str
2034
2035
  end
2035
2036
 
2036
2037
  @log.debug "Transforming code spans in %p" % str
2037
-
2038
2038
  # Build the transformed text anew
2039
2039
  text = ''
2040
-
2040
+
2041
2041
  # Scan to the end of the string
2042
2042
  until @scanner.empty?
2043
2043
 
2044
2044
  # Scan up to an opening backtick
2045
2045
  if pre = @scanner.scan_until( /.??(?=`)/m )
2046
2046
  text += pre
2047
- @log.debug "Found backtick at %d after '...%s'" % [ @scanner.pos, text[-10, 10] ]
2047
+ @log.debug "Found backtick at %d after '...%s'" % [ @scanner.pos, text[-20, 20] ]
2048
2048
 
2049
2049
  # Make a pattern to find the end of the span
2050
- opener = @scanner.scan( /`+/ )
2050
+ opener = @scanner.scan( /`+/ )
2051
2051
  len = opener.length
2052
2052
  closer = Regexp::new( opener )
2053
2053
  @log.debug "Scanning for end of code span with %p" % closer
@@ -2060,10 +2060,11 @@ module AoBane
2060
2060
  "No %p found before end" % opener )
2061
2061
 
2062
2062
  @log.debug "Found close of code span at %d: %p" % [ @scanner.pos - len, codespan ]
2063
+ #p codespan.strip
2063
2064
  codespan.slice!( -len, len )
2064
2065
  text += "<code>%s</code>" %
2065
2066
  encode_code( codespan.strip, rs )
2066
-
2067
+
2067
2068
  # If there's no more backticks, just append the rest of the string
2068
2069
  # and move the scan pointer to the end
2069
2070
  else
@@ -2170,6 +2171,7 @@ module AoBane
2170
2171
  #gsub( %r{<}, '&lt;' ).
2171
2172
  #gsub( %r{>}, '&gt;' ).
2172
2173
  #gsub( CodeEscapeRegexp ) {|match| EscapeTable[match][:md5]}
2174
+ return str
2173
2175
  end
2174
2176
 
2175
2177
  def escape_to_header_id(str)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: AoBane
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-19 00:00:00.000000000 Z
12
+ date: 2013-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: math_ml