Skip to content

Commit

Permalink
Merge pull request #11 from aozorahack/accent_tag
Browse files Browse the repository at this point in the history
--use-jisx0213 also suppot Accent_tag
  • Loading branch information
takahashim committed Nov 7, 2015
2 parents c06c4cf + aa05f84 commit c2d119b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/aozora2html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ end

if options["use-jisx0213"]
Embed_Gaiji_tag.use_jisx0213 = true
Accent_tag.use_jisx0213 = true
end

if ARGV.size < 1 || ARGV.size > 2
Expand Down
23 changes: 23 additions & 0 deletions lib/accent_tag.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Accent_tag
alias_method :to_s_orig, :to_s

def self.use_jisx0213=(val)
@use_jisx0213 = val
end

def self.use_jisx0213
@use_jisx0213
end

def jisx0213_to_unicode(code)
Aozora2Html::JIS2UCS[code]
end

def to_s
if Accent_tag.use_jisx0213
jisx0213_to_unicode(@code.sub(%r|.*/|,"").to_sym)
else
to_s_orig
end
end
end
1 change: 1 addition & 0 deletions lib/aozora2html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "aozora2html/jis2ucs"
require 't2hs'
require 'embed_gaiji_tag'
require 'accent_tag'

## already defined in t2hs.rb
class Aozora2Html
Expand Down

0 comments on commit c2d119b

Please sign in to comment.