るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.189秒)
トップページ > クエリ:-[x] > クエリ:r[x] > クエリ:a[x] > クエリ:Markup[x] > クラス:RDoc::Markup[x] > クエリ:add_special[x]

別のキーワード

  1. _builtin to_a
  2. matrix to_a
  3. to_a
  4. argf.class to_a
  5. dbm to_a

ライブラリ

検索結果

RDoc::Markup#add_special(pattern, name) -> () (30468.0)

pattern で指定した正規表現にマッチする文字列をフォーマットの対象にしま す。

...pattern で指定した正規表現にマッチする文字列をフォーマットの対象にしま
す。

例えば WikiWord のような、SM::SimpleMarkup#add_word_pair
SM::SimpleMarkup#add_html でフォーマットできないものに対して使用
します。

@param pattern 正規...
...

@param name SM::ToHtml などのフォーマッタに識別させる時の名前を
Symbol で指定します。

例:

r
equire 'rdoc/markup/simple_markup'
r
equire 'rdoc/markup/simple_markup/to_html'

class WikiHtml < SM::ToHtml
def handle_special_WIKIWORD(special)
"...
...<font color=red>" + special.text + "</font>"
end
end

m = SM::SimpleMarkup.new
m.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)

h = WikiHtml.new
puts m.convert(input_string, h)

変換時に実際にフォーマットを行うには SM::ToHtml#accept_special_<name で指定した...