tdiary 4.0.1.20130903 → 4.0.1.20130929
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.
- checksums.yaml +4 -4
- data/Gemfile +0 -7
- data/Gemfile.lock +13 -27
- data/spec/core/style/tdiary_style_spec.rb +1 -1
- data/spec/core/style/wiki_style_spec.rb +1 -1
- data/tdiary/io/base.rb +11 -7
- data/tdiary/style/{tdiary_style.rb → tdiary.rb} +0 -3
- data/tdiary/style/{wiki_style.rb → wiki.rb} +0 -5
- data/tdiary/version.rb +1 -1
- metadata +5 -25
- data/misc/style/emptdiary/README.rd +0 -83
- data/misc/style/emptdiary/README.rd.en +0 -78
- data/misc/style/emptdiary/emptdiary_style.rb +0 -201
- data/misc/style/etdiary/README.rd +0 -83
- data/misc/style/etdiary/etdiary_style.rb +0 -448
- data/misc/style/gfm/gfm_style.rb +0 -195
- data/misc/style/rd/README.rd +0 -71
- data/misc/style/rd/rd_style.rb +0 -367
- data/misc/style/wiki/README +0 -116
- data/misc/style/wiki/README.en +0 -101
- data/misc/style/wiki/wiki_parser.rb +0 -273
- data/misc/style/wiki/wiki_style.rb +0 -478
- data/spec/core/style/emptdiary_style_spec.rb +0 -165
- data/spec/core/style/etdiary_style_spec.rb +0 -512
- data/spec/core/style/gfm_style_spec.rb +0 -382
- data/spec/core/style/rd_style_spec.rb +0 -224
data/misc/style/wiki/README
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
! Wikiスタイル - Wiki風の記述形式
|
2
|
-
|
3
|
-
!!【注意】
|
4
|
-
このスタイルはすでにサポートされていません。Wikiスタイルは標準サポー
|
5
|
-
トとなり、tdiaryディレクトリの下に互換性のある別の実装が含まれていま
|
6
|
-
す。
|
7
|
-
|
8
|
-
このディレクトリに含まれるファイルは、何らかの都合で旧実装を使わなく
|
9
|
-
てはならない場合にのみ使用してください。
|
10
|
-
|
11
|
-
!! Wikiスタイルとは
|
12
|
-
|
13
|
-
WikiWikiのオリジナル文法に近い形式で日記が書けるスタイル。HTMLよりで
|
14
|
-
きることは少ないが、ルールが簡単で覚えやすいので、あまり凝ったことを
|
15
|
-
しない人に向いている。
|
16
|
-
|
17
|
-
!! 使い方
|
18
|
-
|
19
|
-
wiki_parser.rbとwiki_style.rbを、インストールディレクトリにあるtdiary
|
20
|
-
ディレクトリにコピーし、tdiary.confに以下の設定をする。
|
21
|
-
|
22
|
-
@style = 'Wiki'
|
23
|
-
|
24
|
-
また、リンク機能を使う場合には、プラグイン集に含まれているkw.rbをtDiary
|
25
|
-
のpluginディレクトリにコピーしておく必要がある。
|
26
|
-
|
27
|
-
!! Wikiスタイルの文法
|
28
|
-
|
29
|
-
!!! 段落
|
30
|
-
|
31
|
-
普通に行頭から書き始めればそれが段落。単一の改行は無視され、空改行で
|
32
|
-
別段落になる。tDiary上では<p>タグで囲まれる。一日の初めが通常の段落
|
33
|
-
で始まっている場合には、その段落のみセクション扱いになる。
|
34
|
-
|
35
|
-
!!! 見出し
|
36
|
-
|
37
|
-
見出しは「!」で始める。tDiary上では「!」ひとつで<h3>になり、セクショ
|
38
|
-
ンの開始になる。以下、「!!」で<h4>、「!!!」で<h5>……となる。
|
39
|
-
|
40
|
-
!!! 整形済みテキスト
|
41
|
-
|
42
|
-
いわゆる<pre>は、行頭を空白かタブで始める。マークアップはいっさい効
|
43
|
-
かなくなる。
|
44
|
-
|
45
|
-
!!! 箇条書き
|
46
|
-
|
47
|
-
「*」で始めると箇条書き。「#」で始めると数字付きになる。マークの個数
|
48
|
-
で入れ子を表現する。オリジナルWikiでは数字で始めると数字付き箇条書き
|
49
|
-
というルールがあるようだが、それだと数字で始まる段落が書けなくなる気
|
50
|
-
がするので、サポートしていない。
|
51
|
-
|
52
|
-
!!! 引用
|
53
|
-
|
54
|
-
「""」(2つの二重引用符)で始まる行は、引用(<blockquote>扱い)となる。
|
55
|
-
文中の改行は、通常段落の行頭に「""」を付けたものとして扱う。
|
56
|
-
|
57
|
-
!!! 定義リスト
|
58
|
-
|
59
|
-
いわゆる<dl>は、「:キーワード:説明」という構文。
|
60
|
-
|
61
|
-
:キーワード:説明文をここに1行で書く。
|
62
|
-
|
63
|
-
!!! 表
|
64
|
-
|
65
|
-
表(テーブル)は「||」で始め、以下のように書ける。
|
66
|
-
|
67
|
-
||項目1-1||項目1-2||項目1-3
|
68
|
-
||項目2-1||項目2-2||項目2-3
|
69
|
-
|
70
|
-
!!! リンク
|
71
|
-
|
72
|
-
2つのカギカッコで囲んだ単語は、日本語、英数字問わずキーワードとして扱われ、kwプラグインに展開される。いわゆるWikiName(WikiWord)はサポートしない。
|
73
|
-
|
74
|
-
[[キーワード]]
|
75
|
-
|
76
|
-
キーワードを「:」で区切ると、InterWikiName相当になる(kwプラグインの機能)。
|
77
|
-
|
78
|
-
[[hoge:キーワード]]
|
79
|
-
|
80
|
-
「|」で区切ると、任意のURLへのリンクを生成できる。
|
81
|
-
|
82
|
-
[[Asumi日記|http://sho.tdiary.net/]]
|
83
|
-
[[このファイル|../files/hoge.txt]]
|
84
|
-
[[ほげ|hoge:キーワード]]
|
85
|
-
|
86
|
-
なお、上記構文で、右側のURL部分がtDiaryのアンカー風(20030125#p03とか)
|
87
|
-
の場合は、myプラグインに展開される。
|
88
|
-
|
89
|
-
さらに、文中にある生のURLは、そのままリンクになる。ただし、最後が.jpg
|
90
|
-
とか.pngの場合はインラインイメージに展開される。相対URLもサポートさ
|
91
|
-
れているので、
|
92
|
-
|
93
|
-
http:.images/hoge.jpg
|
94
|
-
|
95
|
-
などとして使うこともできる。
|
96
|
-
|
97
|
-
!!! 強調
|
98
|
-
|
99
|
-
単一引用符の連続で囲むことで、強調を指定できる。
|
100
|
-
|
101
|
-
ふたつだと''普通の強調''で、<em>に展開
|
102
|
-
みっつだと'''すごく強調'''で、<strong>に展開
|
103
|
-
|
104
|
-
!!! 取消線
|
105
|
-
|
106
|
-
イコールふたつで囲んだ部分は、取消線(<del>)になる。これはtDiary拡張。
|
107
|
-
|
108
|
-
==この部分が取り消し==
|
109
|
-
|
110
|
-
!!! プラグイン
|
111
|
-
|
112
|
-
これもtDiary拡張。にょろカッコふたつで囲むと、tDiaryのプラグイン呼び
|
113
|
-
出しになる。
|
114
|
-
|
115
|
-
{{amazon '4906470068'}}
|
116
|
-
|
data/misc/style/wiki/README.en
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
! Wiki Style
|
2
|
-
|
3
|
-
!! '''NOTICE'''
|
4
|
-
This implements was obsluted.
|
5
|
-
|
6
|
-
Wiki style is supported in default now in another implements. See
|
7
|
-
tdiary directory.
|
8
|
-
|
9
|
-
If you want to need old implements, use files in this directory.
|
10
|
-
|
11
|
-
|
12
|
-
!! about Wiki Style
|
13
|
-
|
14
|
-
Like original style of WikiWikiWeb.
|
15
|
-
|
16
|
-
!! How to use
|
17
|
-
|
18
|
-
Copy wiki_parser.rb and wiki_style.rb into tdiary directory in you
|
19
|
-
tdiary installed. And specify into tdiary.conf below:
|
20
|
-
|
21
|
-
@style = 'Wiki'
|
22
|
-
|
23
|
-
If you want to use link feature, find kw.rb from tDiary plugins and
|
24
|
-
copy it into plugin directory of tDiary.
|
25
|
-
|
26
|
-
!! How to write Wiki Style
|
27
|
-
|
28
|
-
!!! Paragraph
|
29
|
-
|
30
|
-
Starting words from top of the line.
|
31
|
-
If you want to change paragraph, insert a null line.
|
32
|
-
When a day starts with a paragraph, the paragraph become to
|
33
|
-
a section.
|
34
|
-
|
35
|
-
!!! Heading
|
36
|
-
|
37
|
-
You can start headings with '!'. In tDiary, one '!' become to '<h3>'
|
38
|
-
and it starts a section. Then '!!' is '<h4>', '!!!' is '<h5>' ...
|
39
|
-
|
40
|
-
!!! Formatted text
|
41
|
-
|
42
|
-
Formatted text you know '<pre>' is start with space or TAB.
|
43
|
-
All other markups are ignore.
|
44
|
-
|
45
|
-
!!! Lists
|
46
|
-
|
47
|
-
Starts with '*' means lists. And starts with '#' is numbered lists.
|
48
|
-
You can increase nests by '**', '***' and '****'.
|
49
|
-
|
50
|
-
!!! Blockquote
|
51
|
-
|
52
|
-
Two double quote means blockquote.
|
53
|
-
|
54
|
-
!!!Definition Lists
|
55
|
-
|
56
|
-
You can describe '<dl>' by ":keywors:description".
|
57
|
-
|
58
|
-
!!!Table
|
59
|
-
|
60
|
-
Table starts with '||', and separate cells with '||'
|
61
|
-
|
62
|
-
!!! Links
|
63
|
-
|
64
|
-
Double '[' and ']' makes a link. It expand kw plugin.
|
65
|
-
No WikiWord supported.
|
66
|
-
|
67
|
-
[[keyword]]
|
68
|
-
|
69
|
-
By separating keyword with ':', you can make a link equivalent of InterWikiName.
|
70
|
-
This is a feature of kw plugin.
|
71
|
-
|
72
|
-
[[foo:keyword]]
|
73
|
-
|
74
|
-
You can make alias name of link word by separate '|'.
|
75
|
-
|
76
|
-
[[tDiary|http://www.tdiary.org/]]
|
77
|
-
[[this file|../files/foo.txt]]
|
78
|
-
[[bar|foo:KeyWord]]
|
79
|
-
|
80
|
-
In this case, if the URL part is like a tDiary's anchor
|
81
|
-
(ex. 20030125#p03), it expand to my plugin but not kw plugin.
|
82
|
-
|
83
|
-
And alone URL will become to a link.
|
84
|
-
|
85
|
-
!!! Emphasis
|
86
|
-
|
87
|
-
Two or three single-quote makes Emphasis.
|
88
|
-
|
89
|
-
Two single-quote makes ''EMPHASUS'', it means <em>.
|
90
|
-
Three single-quote makes '''STRONG''', it means <strong>.
|
91
|
-
|
92
|
-
!!! Deleted line
|
93
|
-
|
94
|
-
Two equal sign ('=') means <del>. It is tDiary original.
|
95
|
-
|
96
|
-
!!! Plugin
|
97
|
-
|
98
|
-
Two '{' and '}' expand to plugin.
|
99
|
-
|
100
|
-
{{amazon '4906470068'}}
|
101
|
-
|
@@ -1,273 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8; -*-
|
2
|
-
# wiki_parser.rb: Wiki parser for tDiary style $Revision: 1.10 $
|
3
|
-
#
|
4
|
-
# Copyright (C) 2003, TADA Tadashi <sho@spc.gr.jp>
|
5
|
-
# You can distribute this under GPL.
|
6
|
-
#
|
7
|
-
|
8
|
-
class WikiParser
|
9
|
-
class ParserQueue < Array
|
10
|
-
def <<( s )
|
11
|
-
$stderr.puts s if $DEBUG
|
12
|
-
super( s )
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# opt is a Hash.
|
17
|
-
#
|
18
|
-
# key | value | mean |default
|
19
|
-
# ---------+-------------+-----------------+---------
|
20
|
-
# :wikiname|true or false|parse WikiName | true
|
21
|
-
# :url |true or false|make URL to link | true
|
22
|
-
# :plugin |true or false|parse plugin | true
|
23
|
-
# :absolute|true or false|only absolute URL| false
|
24
|
-
#
|
25
|
-
def initialize( opt = {} )
|
26
|
-
@opt = { # set default
|
27
|
-
:wikiname => true,
|
28
|
-
:url => true,
|
29
|
-
:plugin => true,
|
30
|
-
:absolute => false,
|
31
|
-
}
|
32
|
-
@opt.update( opt )
|
33
|
-
end
|
34
|
-
|
35
|
-
def parse( f )
|
36
|
-
@q = ParserQueue::new
|
37
|
-
nest = 0
|
38
|
-
f.each do |l|
|
39
|
-
l.sub!( /[\r\n]+\Z/, '' )
|
40
|
-
case l
|
41
|
-
when /^$/ # null string
|
42
|
-
@q << nil unless @q.last == nil
|
43
|
-
|
44
|
-
when /^----+$/ # horizontal bar
|
45
|
-
@q << :RS << :RE
|
46
|
-
|
47
|
-
when /^(!{1,5})\s*(.*)/ # headings
|
48
|
-
eval( "@q << :HS#{$1.size}" )
|
49
|
-
inline( $2 )
|
50
|
-
eval( "@q << :HE#{$1.size}" )
|
51
|
-
|
52
|
-
when /^([\*#]{1,3})\s*(.*)/ # list
|
53
|
-
r, depth = $2, $1.size
|
54
|
-
style = $1[0] == ?* ? 'U' : 'O'
|
55
|
-
nest = 0 unless /^[UO]E$/ =~ @q.last.to_s
|
56
|
-
tmp = []
|
57
|
-
if nest < depth then
|
58
|
-
(nest * 2).times do tmp << @q.pop end
|
59
|
-
eval( "@q << :#{style}S << :LS" )
|
60
|
-
inline( r )
|
61
|
-
eval( "@q << :LE << :#{style}E" )
|
62
|
-
elsif nest > depth
|
63
|
-
(depth * 2 - 1).times do tmp << @q.pop end
|
64
|
-
@q << :LS
|
65
|
-
inline( r )
|
66
|
-
@q << :LE
|
67
|
-
else
|
68
|
-
(nest * 2 - 1).times do tmp << @q.pop end
|
69
|
-
@q << :LS
|
70
|
-
inline( r )
|
71
|
-
@q << :LE
|
72
|
-
end
|
73
|
-
@q << tmp.pop while tmp.size != 0
|
74
|
-
nest = depth
|
75
|
-
|
76
|
-
when /^:([^:]+):(.*)/ # definition list
|
77
|
-
if @q.last == :DE then
|
78
|
-
@q.pop
|
79
|
-
else
|
80
|
-
@q << :DS
|
81
|
-
end
|
82
|
-
@q << :DTS
|
83
|
-
inline( $1 )
|
84
|
-
@q << :DTE << :DDS
|
85
|
-
inline( $2 )
|
86
|
-
@q << :DDE << :DE
|
87
|
-
|
88
|
-
when /^""$/ # block quote (null line)
|
89
|
-
if @q.last == :QE then
|
90
|
-
@q.pop
|
91
|
-
else
|
92
|
-
@q << :QS
|
93
|
-
end
|
94
|
-
@q << :PS << :PE << :QE
|
95
|
-
|
96
|
-
when /^""\s*(.*)/ # block quote
|
97
|
-
if @q.last == :QE then
|
98
|
-
@q.pop
|
99
|
-
@q.pop
|
100
|
-
else
|
101
|
-
@q << :QS << :PS
|
102
|
-
end
|
103
|
-
inline( $1 + "\n" )
|
104
|
-
@q << :PE << :QE
|
105
|
-
|
106
|
-
when /^\s(.*)/ # formatted text
|
107
|
-
if @q.last == :FE then
|
108
|
-
@q.pop
|
109
|
-
else
|
110
|
-
@q << :FS
|
111
|
-
end
|
112
|
-
@q << ( $1 + "\n" ) << :FE
|
113
|
-
|
114
|
-
when /^\|\|(.*)/ # table
|
115
|
-
if @q.last == :TE then
|
116
|
-
@q.pop
|
117
|
-
@q << :TRS
|
118
|
-
else
|
119
|
-
@q << :TS << :TRS
|
120
|
-
end
|
121
|
-
$1.split( /\|\|/ ).each do |s|
|
122
|
-
@q << :TDS
|
123
|
-
inline( s )
|
124
|
-
@q << :TDE
|
125
|
-
end
|
126
|
-
@q << :TRE << :TE
|
127
|
-
|
128
|
-
else # paragraph
|
129
|
-
if @q.last == :PE then
|
130
|
-
@q.pop
|
131
|
-
else
|
132
|
-
@q << :PS
|
133
|
-
end
|
134
|
-
inline( l )
|
135
|
-
@q << :PE
|
136
|
-
end
|
137
|
-
end
|
138
|
-
@q.compact!
|
139
|
-
@q
|
140
|
-
end
|
141
|
-
|
142
|
-
private
|
143
|
-
def inline( l )
|
144
|
-
if @opt[:plugin] then
|
145
|
-
r = /(.*?)(\[\[|\]\]|\{\{.*?\}\}|'''|''|==)/
|
146
|
-
else
|
147
|
-
r = /(.*?)(\[\[|\]\]|'''|''|==)/
|
148
|
-
end
|
149
|
-
a = l.scan( r ).flatten
|
150
|
-
tail = a.size == 0 ? l : $'
|
151
|
-
stat = []
|
152
|
-
a.each do |i|
|
153
|
-
case i
|
154
|
-
when '[['
|
155
|
-
@q << :KS
|
156
|
-
stat.push :KE
|
157
|
-
when ']]'
|
158
|
-
@q << stat.pop
|
159
|
-
when "'''"
|
160
|
-
if stat.last == :SE then
|
161
|
-
@q << stat.pop
|
162
|
-
else
|
163
|
-
@q << :SS
|
164
|
-
stat.push :SE
|
165
|
-
end
|
166
|
-
when "''"
|
167
|
-
if stat.last == :EE then
|
168
|
-
@q << stat.pop
|
169
|
-
else
|
170
|
-
@q << :ES
|
171
|
-
stat.push :EE
|
172
|
-
end
|
173
|
-
when "=="
|
174
|
-
if stat.last == :ZE then
|
175
|
-
@q << stat.pop
|
176
|
-
else
|
177
|
-
@q << :ZS
|
178
|
-
stat.push :ZE
|
179
|
-
end
|
180
|
-
else
|
181
|
-
if @opt[:plugin] and /^\{\{(.*)\}\}$/ =~ i then
|
182
|
-
@q << :GS << $1 << :GE
|
183
|
-
elsif stat.last == :KE
|
184
|
-
@q << i
|
185
|
-
else
|
186
|
-
url( i ) if i.size > 0
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
190
|
-
url( tail ) if tail
|
191
|
-
end
|
192
|
-
|
193
|
-
def url( l )
|
194
|
-
unless @opt[:url]
|
195
|
-
@q << l
|
196
|
-
return
|
197
|
-
end
|
198
|
-
|
199
|
-
r = %r<(((https?|ftp):[\(\)%#!/0-9a-zA-Z_$@.&+-,'"*=;?:~-]+)|([0-9a-zA-Z_.-]+@[\(\)%!0-9a-zA-Z_$.&+-,'"*-]+\.[\(\)%!0-9a-zA-Z_$.&+-,'"*-]+))>
|
200
|
-
a = l.gsub( r ) {
|
201
|
-
if $1 == $2 then
|
202
|
-
url = $2
|
203
|
-
if %r<^(https?|ftp)(://)?$> =~ url then
|
204
|
-
url
|
205
|
-
elsif %r<^(https?|ftp)://> =~ url
|
206
|
-
"[[#{url}]]"
|
207
|
-
else
|
208
|
-
if @opt[:absolute] then
|
209
|
-
url
|
210
|
-
else
|
211
|
-
"[[#{url.sub( /^(https?|ftp):/, '' )}]]"
|
212
|
-
end
|
213
|
-
end
|
214
|
-
else
|
215
|
-
"[[mailto:#$4]]"
|
216
|
-
end
|
217
|
-
}.scan( /(.*?)(\[\[|\]\])/ ).flatten
|
218
|
-
tail = a.size == 0 ? l : $'
|
219
|
-
a.each do |i|
|
220
|
-
case i
|
221
|
-
when '[['
|
222
|
-
@q << :XS
|
223
|
-
when ']]'
|
224
|
-
@q << :XE
|
225
|
-
else
|
226
|
-
if @q.last == :XS then
|
227
|
-
@q << i
|
228
|
-
else
|
229
|
-
wikiname( i )
|
230
|
-
end
|
231
|
-
end
|
232
|
-
end
|
233
|
-
wikiname( tail ) if tail
|
234
|
-
end
|
235
|
-
|
236
|
-
def wikiname( l )
|
237
|
-
unless @opt[:wikiname]
|
238
|
-
@q << l
|
239
|
-
return
|
240
|
-
end
|
241
|
-
|
242
|
-
l.gsub!( /[A-Z][a-z0-9]+([A-Z][a-z0-9]+)+/, '[[\0]]' )
|
243
|
-
a = l.scan( /(.*?)(\[\[|\]\])/ ).flatten
|
244
|
-
tail = a.size == 0 ? l : $'
|
245
|
-
a.each do |i|
|
246
|
-
case i
|
247
|
-
when '[['
|
248
|
-
@q << :KS
|
249
|
-
when ']]'
|
250
|
-
@q << :KE
|
251
|
-
else
|
252
|
-
@q << i
|
253
|
-
end
|
254
|
-
end
|
255
|
-
@q << tail if tail
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
if $0 == __FILE__
|
260
|
-
$DEBUG = true
|
261
|
-
p WikiParser::new( :wikiname => true, :plugin => true ).parse( DATA )
|
262
|
-
end
|
263
|
-
|
264
|
-
__END__
|
265
|
-
:a:aaaa
|
266
|
-
:b:bbbb
|
267
|
-
|
268
|
-
# Local Variables:
|
269
|
-
# mode: ruby
|
270
|
-
# indent-tabs-mode: t
|
271
|
-
# tab-width: 3
|
272
|
-
# ruby-indent-level: 3
|
273
|
-
# End:
|