AoBane 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  AoBane The MarkDown Core Engine
2
2
  ======
3
3
 
4
- Powered By BlueFeather
4
+ Powered By BlueFeather<br>
5
5
  See also [AoBane development memo](https://github.com/setminami/AoBane/wiki/development-memo).
6
6
 
7
7
  ##What's This and What You Can...
@@ -10,9 +10,21 @@ The points of difference are
10
10
  * You can use font TAG like this-> `*[blablabla](color|font faces#font size)`
11
11
  * *e.g.,* `*[blablabla](red|Times,Arial#5) -expand-> <font color="red" face="Times,Arial" size="5">blablabla</font>`
12
12
  - And I know that font TAG was duplicated in HTML5...
13
- * You can use MathML by to code LaTeX string surrounding `\{` and `\}`. Use firefox renderer because of MathML specification.
14
- * like this. `\{x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}\} -expand-> <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>x</mi><mo>=</mo><mfrac><mrow><mo>-</mo><mi>b</mi><mo>&pm;</mo><msqrt><mrow><msup><mi>b</mi><mn>2</mn></msup><mo>-</mo><mn>4</mn><mi>a</mi><mi>c</mi></mrow></msqrt></mrow><mrow><mn>2</mn><mi>a</mi></mrow></mfrac></math>`
15
-
13
+ * You can use MathML by to code LaTeX string surrounding `\TeX{` and `\TeX}`. Use firefox renderer because of MathML specification.
14
+ * like this. `\TeX{x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}\TeX} -expand-> <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>x</mi><mo>=</mo><mfrac><mrow><mo>-</mo><mi>b</mi><mo>&pm;</mo><msqrt><mrow><msup><mi>b</mi><mn>2</mn></msup><mo>-</mo><mn>4</mn><mi>a</mi><mi>c</mi></mrow></msqrt></mrow><mrow><mn>2</mn><mi>a</mi></mrow></mfrac></math>`
15
+
16
+ * You can use Auto Numbering Title by seaquential '%' anotation.
17
+ * *e.g.*,like below
18
+ <pre><code>
19
+ {nrange:h2-h5} <- this means header number range is h2-h5.
20
+ % foo1 -> <h2 id=xxx>1. foo1</h2>
21
+ %% foo1.1 -> <h3 id=xxx>1.1. foo1.1</h3>
22
+ %% foo1.2 -> <h3 id=xxx>1.2. foo1.2</h3>
23
+ %%% foo1.2.1 -> <h4 id=xxx>1.2.1 foo1.2.1</h4>
24
+ % foo2 -> <h2 id=xxx>2. foo2</h2>
25
+ ......................
26
+ </code></pre>
27
+
16
28
  * You can use HTML special character by simple way.
17
29
 
18
30
  like this
data/debug.txt ADDED
File without changes
@@ -0,0 +1,143 @@
1
+ # AoBane Original classes and functions, and data structures.
2
+ # Copyright set.minami (c) 2013
3
+ # MIT License
4
+
5
+ require 'logger'
6
+ require 'singleton'
7
+
8
+ $S_SLOT = 0
9
+ $N_SLOT = 1
10
+ $C_SLOT = 2
11
+ $MAX_STACK = 1024 * 2
12
+
13
+ module Utilities
14
+ $MAX_H = 6
15
+ @@log = Logger.new(STDOUT)
16
+ @@log.level = Logger::WARN
17
+
18
+ ### Return a caluculated section number and string.############################
19
+ def calcSectionNo(startNo, range, size, dep, str)
20
+ stack = Stack.instance
21
+ i = dep.to_i
22
+ counter = 0
23
+ numberStr = [["%",i,counter],["%%",i,counter],["%%%",i,counter],
24
+ ["%%%%",i,counter],["%%%%%",i,counter],["%%%%%%",i,counter]]
25
+ number = ""
26
+ headNo = size.to_i
27
+
28
+ if (headNo > $MAX_H) || (headNo <= 0) then
29
+ @@log.error("AoBane Syntax Error: Header shortage!")
30
+ raise SyntaxError,"Headder shortage!"
31
+ else
32
+ (1..size).each_with_index{|k| #h1 to h6
33
+ @@log.debug "k #{k},hn #{headNo},s #{size},sN #{startNo},sos #{stack.sizeofStack}"
34
+ if (k < headNo) then
35
+ @@log.debug "+++ #{k},#{stack.sizeofStack}"
36
+ if k >= stack.sizeofStack then
37
+ stack.push(numberStr[k])
38
+ end
39
+ elsif (k == headNo) then
40
+ if stack.sizeofStack == 0 then
41
+ stack.push(numberStr[k-1])
42
+ end
43
+ if (stack.evalStackTop[$S_SLOT].size > numberStr[k-1][$S_SLOT].size) then
44
+ stack.pop
45
+ end
46
+ else
47
+ @@log.debug "~~~~"
48
+ stack.push(numberStr[k])
49
+ end #if...elsif
50
+ stack.dump
51
+ }
52
+ =begin
53
+ else
54
+ @@log.error("AoBane Syntax Error: Header Number Overflow!")
55
+ raise SyntaxError,"Header Number Overflow!"
56
+ end #case
57
+ =end
58
+ end #if...else
59
+ @@log.debug "$$$$"
60
+ number = stack.insertNumber
61
+ h = "#"
62
+ times = startNo.to_i + size.to_i - 1
63
+ return h*times + number + str
64
+ end #def
65
+
66
+ module_function :calcSectionNo
67
+ #############################################################################
68
+ end
69
+
70
+
71
+ #####################CLAZ declare############################################
72
+ class Stack
73
+ include Singleton
74
+
75
+ @@log = Logger.new(STDOUT)
76
+ @@log.level = Logger::WARN
77
+
78
+ def initialize
79
+ @stack = []
80
+ @sp = 0
81
+ end
82
+
83
+ def push(pair)
84
+ @@log.debug("#{__LINE__} push #{pair}")
85
+ if (@stack.size + 1) < $MAX_STACK then
86
+ @stack.push(pair)
87
+ @sp += 1
88
+ @@log.debug @stack
89
+ else
90
+ raise SyntaxError,"Stack Over Flow!"
91
+ end
92
+ end
93
+
94
+ def pop
95
+ @@log.debug("#{__LINE__} pop")
96
+ if (@stack.size - 1) >= 0 then @sp -= 1;return @stack.pop
97
+ else
98
+ raise SyntaxError,"Stack Under Flow!"
99
+ end
100
+ @@log.debug "#{@stack}"
101
+ end
102
+
103
+ def insertNumber
104
+ str = ""
105
+ @stack.each { |item|
106
+ if isTopofStack(item) then
107
+ item[$N_SLOT] += item[$C_SLOT]
108
+ item[$C_SLOT] = 1
109
+ end
110
+ str << (item[$N_SLOT]).to_s + '.'
111
+ @@log.debug str
112
+ }
113
+ return str
114
+ end
115
+
116
+ def evalStackTop
117
+ return @stack.last
118
+ end
119
+
120
+ def getSp
121
+ if @sp >= 0 then return @sp
122
+ else raise FatalError,"SP is negative!"
123
+ end
124
+ end
125
+
126
+ def sizeofStack
127
+ return @stack.size
128
+ end
129
+
130
+ def isTopofStack(item)
131
+ if item == @stack.last then
132
+ return true
133
+ else
134
+ return false
135
+ end
136
+ end
137
+
138
+ def dump
139
+ @@log.debug("Stack DUMP:#{@stack}")
140
+ end
141
+
142
+ end
143
+
@@ -1,3 +1,3 @@
1
1
  module AoBane
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end