module Gdk::MarkupGenerator

本文の、描画するためのテキストを生成するモジュール。

Constants

ESCAPE_KEYS
ESCAPE_KV

Public Instance Methods

escaped_main_text() click to toggle source

本文のタグをエスケープしたものを返す

# File core/mui/cairo_markup_generator.rb, line 37
def escaped_main_text
  Pango.escape(main_text) end
main_text() click to toggle source

本文を返す

# File core/mui/cairo_markup_generator.rb, line 32
def main_text
  message.to_show
end
styled_main_text() click to toggle source

リンクに装飾をつけた文字列の配列を返す。だいたい一文字づつに分かれてる。

# File core/mui/cairo_markup_generator.rb, line 41
def styled_main_text
  splited = message.to_show.dup
  terminate = splited.size
  message.links.to_a.reverse_each{ |l|
    escape_range = l[:range].last ... terminate
    splited[escape_range] = splited[escape_range].gsub(ESCAPE_KEYS, &ESCAPE_KV)
    splited[l[:range]] = '<span underline="single">'+"#{Pango.escape(l[:face])}</span>"
    terminate = l[:range].first
  }
  splited[0...terminate] = splited[0...terminate].gsub(ESCAPE_KEYS, &ESCAPE_KV) if terminate != 0
  splited end