Module: DoublebyteCharactify

Defined in:
lib/doublebyte_charactify.rb,
lib/doublebyte_charactify/convert.rb,
lib/doublebyte_charactify/version.rb

Constant Summary collapse

VERSION =
"1.1.16"

Class Method Summary collapse

Class Method Details

.convert(content, tags) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/doublebyte_charactify/convert.rb', line 2

def self.convert(content, tags)
  if !(tags.select { |tag| tag.name === '全角芸' }).blank?
    doc = Nokogiri::XML.parse(content)
    doc.traverse do |e| e.content = e.content.tr('0-9a-zA-Z/\\\.:#\-_"\' ', '0-9a-zA-Z/\.:#ー_”’ ') if e.text? end
    content = doc.to_xhtml(:encoding => 'UTF-8').chomp
  end
  content
end

.patchObject



7
8
9
10
# File 'lib/doublebyte_charactify.rb', line 7

def self.patch
  REST::StatusSerializer.prepend(RESTStatusSerializerPatch)
  ActivityPub::NoteSerializer.prepend(ActivityPubNoteSerializerPatch)
end