AoBane 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,6 +25,28 @@ The points of difference are
25
25
  ......................
26
26
  </code></pre>
27
27
 
28
+ * You can use <div> paling.
29
+ * Write like below:
30
+
31
+ <pre><code>
32
+ |-:b=2 solid gray w=300 rad=10-----------------|
33
+ |### foo |
34
+ |bar |
35
+ |----------------------------------------------|
36
+ </code></pre>
37
+ This syntax expand like below:
38
+ <pre><code>
39
+ &lt;div style="border:2px solid gray ; width:300px;border-radius:10px;"&gt;
40
+ &lt;h3 id="xxx"&gt;foo&lt;/h3&gt;
41
+ bar
42
+ &lt;/div&gt;
43
+ </code></pre>
44
+ * You have to start with
45
+ - first line |-: and b=[widthof borde line(px)] [Type of line] [Color of line] w=[width(px)] rad=[border radius ratio]--...|
46
+ - second and later lines surround with | and spaces
47
+ * And end with
48
+ - last of border is to write |-...-|
49
+ * Header elements in the box can be hashed and joined as one of Table of Contents
28
50
  * You can use HTML special character by simple way.
29
51
 
30
52
  like this
@@ -84,6 +106,15 @@ like this
84
106
 
85
107
  > (TM) &trade;
86
108
 
109
+ > !in &notin;
110
+
111
+
87
112
  ##How to Install
88
113
  Just try
89
114
  `sudo gem install AoBane`
115
+
116
+ ## How to use minimum
117
+ If you want to write forcely, neglect your .md file's timestamp.
118
+ `AoBane --force yourfile.md`
119
+ This way is inheritated from BlueFeather.
120
+
@@ -15,6 +15,46 @@ $MAX_H = 6
15
15
  @@log = Logger.new(STDOUT)
16
16
  @@log.level = Logger::WARN
17
17
 
18
+ ###paling proccessing##########################################################
19
+ $startDivMark = '\|\-:b=(\d+?)\s(\w+?\s\w+?\s)w=(\d+?)\srad=(\d+?)\-+\|'
20
+ $endDivMark = '\|\-+\|'
21
+
22
+ def prePaling(text)
23
+ output = text.split("\n")
24
+ output.each_with_index{|line,index|
25
+ if /#{$startDivMark}/ =~ line then
26
+ loop do
27
+ index += 1
28
+ if /#{$endDivMark}/ =~ output[index] then
29
+ break
30
+ elsif /^\|(\#{1,6})\s*(.*)\|/ =~ output[index] then
31
+ output[index] = '#'*$1.size + $2
32
+ elsif /^\|(.*)\s*\|/ =~ output[index] then
33
+ output[index] = '<p>' + $1 + '</p>'
34
+ end
35
+ end
36
+ end #if
37
+ }
38
+ return output.join("\n")
39
+ end #def prePaling
40
+
41
+ def postPaling(text)
42
+ output = text.split("\n")
43
+ output.each_with_index{|line,index|
44
+ if /#{$startDivMark}/ =~ line then
45
+ output[index] = '<div style="border:' + $1 + 'px ' + $2 +
46
+ '; width:' + $3 + 'px;border-radius:' + $4 + 'px;">'
47
+ loop do
48
+ index += 1
49
+ if /#{$endDivMark}/ =~ output[index] then
50
+ output[index] = '</div>'
51
+ break
52
+ end
53
+ end
54
+ end
55
+ }
56
+ return output.join("\n")
57
+ end #def postPailing
18
58
  ### Return a caluculated section number and string.############################
19
59
  def calcSectionNo(startNo=1, range=0, size=0, dep=1, str='')
20
60
  stack = Stack.instance
@@ -64,6 +104,8 @@ $MAX_H = 6
64
104
  end #def
65
105
 
66
106
  module_function :calcSectionNo
107
+ module_function :prePaling
108
+ module_function :postPaling
67
109
  #############################################################################
68
110
  end
69
111
 
@@ -1,3 +1,3 @@
1
1
  module AoBane
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/AoBane.rb CHANGED
@@ -51,9 +51,9 @@ require 'AoBane/utilities'
51
51
  require 'math_ml/string'
52
52
 
53
53
  module AoBane
54
- VERSION = '0.1.2'
55
- VERSION_NUMBER = 0.0102
56
- RELEASE_DATE = '2013-04-09'
54
+ VERSION = '0.1.3'
55
+ VERSION_NUMBER = 0.0103
56
+ RELEASE_DATE = '2013-04-13'
57
57
  VERSION_LABEL = "#{VERSION} (#{RELEASE_DATE})"
58
58
 
59
59
  UTF8_BOM = "\xef\xbb\xbf"
@@ -532,12 +532,15 @@ module AoBane
532
532
  if $4.nil? then '' else $4.delete('#') end + '">' +
533
533
  $1 + '</font>'
534
534
  }
535
+ #Insert by set.minami 2013-04-13
536
+ text = Utilities::prePaling(text)
535
537
 
536
538
  #Insert by set.minami 2013-04-03
537
539
  nrange = []
538
540
  departure = 1
539
541
  preproc = Marshal.load(Marshal.dump(text))
540
542
  text.clear
543
+ texParser = MathML::LaTeX::Parser.new
541
544
  html_text_number = 0
542
545
  preproc.lines { |line|
543
546
  html_text_number += 1
@@ -558,9 +561,11 @@ module AoBane
558
561
  next
559
562
  }
560
563
  #Insert by set.minami 2013-04-01
561
- line.gsub!(/\\TeX{(.*?)\\TeX}/){ |match|
562
- if $1.nil? then '' else $1.to_mathml end
564
+ texTag = '\\\\TeX'
565
+ line.gsub!(/#{texTag}\{(.+?)#{texTag}\}/){
566
+ texParser.parse($1,false).to_s
563
567
  }
568
+ @log.debug line
564
569
  #calculate numbering
565
570
  range = nrange[1].to_i - nrange[0].to_i
566
571
  if range == 0 then range = 1 end
@@ -581,7 +586,7 @@ module AoBane
581
586
  end
582
587
  }
583
588
 
584
- #Insert by set.minami
589
+ #Insert by set.minami
585
590
 
586
591
  # Filter HTML if we're asked to do so
587
592
  if self.filter_html
@@ -646,57 +651,61 @@ module AoBane
646
651
  end
647
652
  end
648
653
 
649
- #Insert by set.minami 2013-03-30
650
- output = []
651
- text.lines {|line|
652
- if /<pre><code>/ =~ line
653
- output << line
654
- next
655
- until /<\/code><\/pre>/ =~ line
656
- output << line
657
- next
658
- end
659
- else
660
- line.gsub!(/\-\-|<=>|<\->|\->|<\-|=>|<=|\|\^|\|\|\/|\|\/|\^|
654
+ #Insert by Set.Minami 2013-04-13
655
+ text = Utilities::postPaling(text)
656
+
657
+ #Insert by set.minami 2013-03-30
658
+ output = []
659
+ text.lines {|line|
660
+ if /<pre><code>/ =~ line then
661
+ output << line
662
+ next
663
+ until /<\/code><\/pre>/ =~ line
664
+ output << line
665
+ next
666
+ end
667
+ else
668
+ line.gsub!(/\-\-|<=>|<\->|\->|<\-|=>|<=|\|\^|\|\|\/|\|\/|\^|
661
669
  \>\>|\<\<|\+_|!=|~~|~=|>_|<_|\|FA|\|EX|\|=|\(+\)|\(x\)|
662
670
  \\&|\(c\)|\(R\)|\(SS\)|\(TM\)|!in/,
663
- "\-\-" => "&mdash;",
664
- "<=" => "&hArr;",
665
- "<\->" => "&harr;",
666
- "\->" =>"&rarr;",
667
- "<\-" =>"&larr;",
668
- "=>" => "&rArr;",
669
- "<=" => "&lArr;",
670
- "\|\|\^" => "&uArr;",
671
- "\|\|\/" => "&dArr;",
672
- "\|\/" => "&darr;",
673
- "\|\^" => "&uarr;",
674
- ">>" => "&raquo;",
675
- "\<\<" => "&laquo;",
676
- "+_" => "&plusmn;",
677
- "!=" => "&ne;",
678
- "~~" => "&asymp;",
679
- "~=" => "&cong;",
680
- "<_" => "&le;",
681
- ">_" => "&ge",
682
- "\|FA" => "&forall;",
683
- "\|EX" => "&exist;",
684
- "\|=" => "&equiv;",
685
- "\(+\)" => "&oplus",
686
- "\(x\)" => "&otimes;",
687
- "\\&" =>"&amp;",
688
- "\(c\)" => "&copy;",
689
- "\(R\)" =>"&reg;",
690
- "\(SS\)" => "&sect;",
691
- "\(TM\)" => "&trade;",
692
- "!in" => "&notin;")
693
- output << line
694
- end
695
- }
696
- return output
697
- #Insert by set.minami
698
- #return text
699
-
671
+ "\-\-" => "&mdash;",
672
+ "<=" => "&hArr;",
673
+ "<\->" => "&harr;",
674
+ "\->" =>"&rarr;",
675
+ "<\-" =>"&larr;",
676
+ "=>" => "&rArr;",
677
+ "<=" => "&lArr;",
678
+ "\|\|\^" => "&uArr;",
679
+ "\|\|\/" => "&dArr;",
680
+ "\|\/" => "&darr;",
681
+ "\|\^" => "&uarr;",
682
+ ">>" => "&raquo;",
683
+ "\<\<" => "&laquo;",
684
+ "+_" => "&plusmn;",
685
+ "!=" => "&ne;",
686
+ "~~" => "&asymp;",
687
+ "~=" => "&cong;",
688
+ "<_" => "&le;",
689
+ ">_" => "&ge",
690
+ "\|FA" => "&forall;",
691
+ "\|EX" => "&exist;",
692
+ "\|=" => "&equiv;",
693
+ "\(+\)" => "&oplus",
694
+ "\(x\)" => "&otimes;",
695
+ "\\&" =>"&amp;",
696
+ "\(c\)" => "&copy;",
697
+ "\(R\)" =>"&reg;",
698
+ "\(SS\)" => "&sect;",
699
+ "\(TM\)" => "&trade;",
700
+ "!in" => "&notin;")
701
+ output << line
702
+ end
703
+ }
704
+
705
+ return output
706
+ #Insert by set.minami
707
+ #return text
708
+
700
709
  end
701
710
 
702
711
  alias parse parse_text
data/test/Test.html CHANGED
@@ -19,7 +19,10 @@
19
19
  </ul></li>
20
20
  <li><a href="#bfheader-4053345277cc30d02578bed19dbabbde" rel="toc">2.4. &rarr;1.3.</a></li>
21
21
  </ul></li>
22
- <li><a href="#bfheader-e4f1b74034f9691eb3bac704b9b8ea29" rel="toc">3. &rarr;2.</a></li>
22
+ <li><a href="#bfheader-e4f1b74034f9691eb3bac704b9b8ea29" rel="toc">3. &rarr;2.</a>
23
+ <ul>
24
+ <li><a href="#bfheader-acbd18db4cc2f85cedef654fccc4a4d8" rel="toc">foo</a></li>
25
+ </ul></li>
23
26
  </ul></li>
24
27
  </ul>
25
28
 
@@ -47,5 +50,13 @@
47
50
 
48
51
  <p>abccccc</p>
49
52
 
53
+ <div style="border:2px solid gray ; width:300px;border-radius:10px;">
54
+
55
+ <h3 id="bfheader-acbd18db4cc2f85cedef654fccc4a4d8">foo</h3>
56
+
57
+ <p>bar </p>
58
+
59
+ </div>
60
+
50
61
  </body>
51
62
  </html>
data/test/Test.md CHANGED
@@ -22,3 +22,10 @@ abcdefg
22
22
  % ->2.
23
23
 
24
24
  abccccc
25
+
26
+ |-:b=2 solid gray w=300 rad=10-----------------|
27
+ |### foo |
28
+ |bar |
29
+ |----------------------------------------------|
30
+
31
+
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.2
4
+ version: 0.1.3
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-09 00:00:00.000000000 Z
12
+ date: 2013-04-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: math_ml