Japanese title tokenizer

This commit is contained in:
Eduard Urbach 2017-07-11 16:54:17 +02:00
parent 4743103595
commit 61c0f2a6d2
4 changed files with 28 additions and 4 deletions

11
mixins/Japanese.pixy Normal file
View File

@ -0,0 +1,11 @@
component Japanese(text string)
if arn.ContainsUnicodeLetters(text)
for _, token := range arn.TokenizeJapanese(text)
if token.NeedsFurigana()
a.japanese(href="http://jisho.org/search/" + token.Original, target="_blank", rel="noopener")
ruby(title=token.Romaji)= token.Original
rt.furigana= token.Hiragana
else
ruby.japanese(title=token.Romaji)= token.Original
else
span.japanese= text

View File

@ -14,7 +14,7 @@ component Anime(anime *arn.Anime, tracks []*arn.SoundTrack, user *arn.User, epis
//- else //- else
if anime.Title.Japanese != anime.Title.Canonical if anime.Title.Japanese != anime.Title.Canonical
h2.anime-alternative-title h2.anime-alternative-title
a(href="http://jisho.org/search/" + anime.Title.Japanese, target="_blank", title="Look up reading on jisho.org", rel="nofollow")= anime.Title.Japanese Japanese(anime.Title.Japanese)
//- h3.anime-section-name.anime-summary-header Summary //- h3.anime-section-name.anime-summary-header Summary
p.anime-summary= anime.Summary p.anime-summary= anime.Summary
@ -161,7 +161,7 @@ component Anime(anime *arn.Anime, tracks []*arn.SoundTrack, user *arn.User, epis
span= episode.Number span= episode.Number
td.episode-title td.episode-title
if episode.Title.Japanese != "" if episode.Title.Japanese != ""
span= episode.Title.Japanese Japanese(episode.Title.Japanese)
else else
span - span -
td.episode-actions td.episode-actions

View File

@ -43,7 +43,8 @@
text-align left text-align left
font-weight normal font-weight normal
line-height content-line-height line-height content-line-height
a
.japanese
color rgba(60, 60, 60, 0.5) !important color rgba(60, 60, 60, 0.5) !important
.anime-actions .anime-actions

View File

@ -27,4 +27,16 @@ p > img
max-width 100% max-width 100%
border-radius 3px border-radius 3px
display inherit display inherit
margin 0 auto margin 0 auto
.furigana
opacity 0.25
transition opacity transition-speed ease, transform transition-speed ease
transform translateY(0)
.japanese
color text-color
:hover
.furigana
opacity 1
transform translateY(-2px)