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 +31 -0
- data/lib/AoBane/utilities.rb +42 -0
- data/lib/AoBane/version.rb +1 -1
- data/lib/AoBane.rb +64 -55
- data/test/Test.html +12 -1
- data/test/Test.md +7 -0
- metadata +2 -2
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
|
+
<div style="border:2px solid gray ; width:300px;border-radius:10px;">
|
40
|
+
<h3 id="xxx">foo</h3>
|
41
|
+
bar
|
42
|
+
</div>
|
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) ™
|
86
108
|
|
109
|
+
> !in ∉
|
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
|
+
|
data/lib/AoBane/utilities.rb
CHANGED
@@ -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
|
|
data/lib/AoBane/version.rb
CHANGED
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.
|
55
|
-
VERSION_NUMBER = 0.
|
56
|
-
RELEASE_DATE = '2013-04-
|
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
|
-
|
562
|
-
|
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
|
-
|
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
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
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
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
671
|
+
"\-\-" => "—",
|
672
|
+
"<=" => "⇔",
|
673
|
+
"<\->" => "↔",
|
674
|
+
"\->" =>"→",
|
675
|
+
"<\-" =>"←",
|
676
|
+
"=>" => "⇒",
|
677
|
+
"<=" => "⇐",
|
678
|
+
"\|\|\^" => "⇑",
|
679
|
+
"\|\|\/" => "⇓",
|
680
|
+
"\|\/" => "↓",
|
681
|
+
"\|\^" => "↑",
|
682
|
+
">>" => "»",
|
683
|
+
"\<\<" => "«",
|
684
|
+
"+_" => "±",
|
685
|
+
"!=" => "≠",
|
686
|
+
"~~" => "≈",
|
687
|
+
"~=" => "≅",
|
688
|
+
"<_" => "≤",
|
689
|
+
">_" => "&ge",
|
690
|
+
"\|FA" => "∀",
|
691
|
+
"\|EX" => "∃",
|
692
|
+
"\|=" => "≡",
|
693
|
+
"\(+\)" => "&oplus",
|
694
|
+
"\(x\)" => "⊗",
|
695
|
+
"\\&" =>"&",
|
696
|
+
"\(c\)" => "©",
|
697
|
+
"\(R\)" =>"®",
|
698
|
+
"\(SS\)" => "§",
|
699
|
+
"\(TM\)" => "™",
|
700
|
+
"!in" => "∉")
|
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. →1.3.</a></li>
|
21
21
|
</ul></li>
|
22
|
-
<li><a href="#bfheader-e4f1b74034f9691eb3bac704b9b8ea29" rel="toc">3. →2.</a
|
22
|
+
<li><a href="#bfheader-e4f1b74034f9691eb3bac704b9b8ea29" rel="toc">3. →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
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.
|
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-
|
12
|
+
date: 2013-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: math_ml
|