33件ヒット
[1-33件を表示]
(0.065秒)
別のキーワード
ライブラリ
- ビルトイン (11)
-
rdoc
/ markup (11) -
ripper
/ filter (11)
検索結果
-
ARGF
. class (12017.0) -
ARGF を表すクラスです。
...ARGF を表すクラスです。... -
Ripper
:: Filter (31.0) -
イベントドリブンスタイルで Ruby プログラムを加工するためのクラスです。
...e 'ripper'
require 'cgi'
class Ruby2HTML < Ripper::Filter
def on_default(event, tok, f)
f << CGI.escapeHTML(tok)
end
def on_comment(tok, f)
f << %Q[<span class="comment">#{CGI.escapeHTML(tok)}</span>]
end
def on_tstring_beg(tok, f)
f << %Q[<span class="string">#{CGI.escapeHT......ML(tok)}]
end
def on_tstring_end(tok, f)
f << %Q[#{CGI.escapeHTML(tok)}</span>]
end
end
Ruby2HTML.new(ARGF).parse('')
//}
Ruby プログラムを解析して、Ripper::SCANNER_EVENTS にあるスキャナ
イベントを実行します。イベントはプログラムに書いた順番......で実行されます。
上記の例では、parse メソッドに渡した空文字列を初期値として、イベントハ
ンドラが ARGF で渡された Ruby プログラムを HTML にして返します。... -
RDoc
:: Markup (13.0) -
RDoc 形式のドキュメントを目的の形式に変換するためのクラスです。
...require 'rdoc/markup/to_html'
h = RDoc::Markup::ToHtml.new
puts h.convert(input_string)
独自のフォーマットを行うようにパーサを拡張する事もできます。
例:
require 'rdoc/markup'
require 'rdoc/markup/to_html'
class WikiHtml < RDoc::Markup::ToHtml
# W......ントを赤く表示。
def handle_special_WIKIWORD(special)
"<font color=red>" + special.text + "</font>"
end
end
m = RDoc::Markup.new
# { 〜 } までを :STRIKE でフォーマットする。
m.add_word_pair("{", "}", :STRIKE)
# <no> 〜 </no> までを :STRIKE でフォ......STRIKE のフォーマットを <strike> 〜 </strike> に指定。
wh.add_tag(:STRIKE, "<strike>", "</strike>")
puts "<body>#{wh.convert ARGF.read}</body>"
変換する形式を変更する場合、フォーマッタ(例. RDoc::Markup::ToHtml)
を変更、拡張する必要があります。...