doublebyte_charactify 1.1.0 → 1.1.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7398c0751ee20184ae076bb5c92f675c7def08f
4
- data.tar.gz: f80ff8398bc0d480b662cd9daf25ab9ca30ea9de
3
+ metadata.gz: 5fd87748dcc93b496c31b654b5085b3f7c44f927
4
+ data.tar.gz: cb15586f2399cffa52d08897ce05d9d82f941c07
5
5
  SHA512:
6
- metadata.gz: 2224e8b256efdb817702ed8a6fd3f3fdfaa5cc62da9ee271c8317938f941965d70439d021c185a4e0194dbbbae83cdc26ba0546e9083b756c19b87147739e623
7
- data.tar.gz: 8b696d6dc008f67e56ecc12bee38816e87e719f490c9b63dd6df95dcee43bd5c61176b11e19a489e7d12d8744b00ef5e01266a9eadf43e24cd6409c28beb4614
6
+ metadata.gz: 3cecb5274bcec8faed3139d6f06a300243705b10c78c62e91b2c40a979bde2ad4e2f616b8ce6b7f27cd087637675e0083fa76ac077f68ac2bd0eac8ed9dbda3c
7
+ data.tar.gz: ac922bae3b3a86d2b62989588b061c708bb8e20c516b1f03bd924b45a9507acdd0d07b4750cf5be20836407183b4f6d7d9ad99be9e4f30e4ae484ff8cdcbdf9d
data/README.md CHANGED
@@ -18,10 +18,9 @@ And then execute:
18
18
  config\initializers\doublebyte_charactify.rb
19
19
 
20
20
  ```ruby
21
- DoublebyteCharactify.setup do |content, tags|
22
- zenkaku = DoublebyteCharactify::Converter.new()
23
- zenkaku.convert(content, tags)
24
- end
21
+ require_relative "inflections"
22
+ require Rails.root.join("app/serializers/activitypub/note_serializer")
23
+ DoublebyteCharactify.patch()
25
24
  ```
26
25
 
27
26
  - toot by mastodon
@@ -1,12 +1,10 @@
1
1
  module DoublebyteCharactify
2
- class Converter
3
- def convert(content, tags)
4
- if !(tags.select { |tag| tag.name === '全角芸' }).blank?
5
- doc = Nokogiri::XML.parse(content)
6
- doc.traverse do |e| e.content = e.content.tr('0-9a-zA-Z/\\\.:#\-_"\' ', '0-9a-zA-Z/\.:#ー_”’ ') if e.text? end
7
- content = doc.to_xhtml(:encoding => 'UTF-8')
8
- end
9
- content
2
+ def self.convert(content, tags)
3
+ if !(tags.select { |tag| tag.name === '全角芸' }).blank?
4
+ doc = Nokogiri::XML.parse(content)
5
+ doc.traverse do |e| e.content = e.content.tr('0-9a-zA-Z/\\\.:#\-_"\' ', '0-9a-zA-Z/\.:#ー_”’ ') if e.text? end
6
+ content = doc.to_xhtml(:encoding => 'UTF-8')
10
7
  end
8
+ content
11
9
  end
12
10
  end
@@ -1,5 +1,5 @@
1
1
  module ActivityPubNoteSerializerPatch
2
2
  def content
3
- DoublebyteCharactify.convert_content(Formatter.instance.format(object), object.tags)
3
+ DoublebyteCharactify.convert(Formatter.instance.format(object), object.tags)
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module RESTStatusSerializerPatch
2
2
  def content
3
- DoublebyteCharactify.convert_content(Formatter.instance.format(object), object.tags)
3
+ DoublebyteCharactify.convert(Formatter.instance.format(object), object.tags)
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module DoublebyteCharactify
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.15"
3
3
  end
@@ -4,22 +4,8 @@ require "doublebyte_charactify/status_serializer"
4
4
  require "doublebyte_charactify/note_serializer"
5
5
 
6
6
  module DoublebyteCharactify
7
- def self.setup(&proc)
8
- # create function for Monkey patch
9
- extend self
10
- (
11
- class << self;
12
- self
13
- end).module_eval do
14
- define_method 'convert_content', &proc
15
- # define_method 'b' do
16
- # p 'b'
17
- # end
18
- end
19
-
20
- # Monkey patch
7
+ def self.patch
21
8
  REST::StatusSerializer.prepend(RESTStatusSerializerPatch)
22
9
  ActivityPub::NoteSerializer.prepend(ActivityPubNoteSerializerPatch)
23
10
  end
24
11
  end
25
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doublebyte_charactify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - wakin-