Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Ruby-zh
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- Template for generating Ruby for Chinese characters. local p = {} -- Annotate a single character with bopomofo. -- This can be done in a template... but something else can't. function p._zhuyin1(char, bopo, tone) -- inline-table local ru = mw.html.create('span') ru :addClass('zhuyin-ru') :wikitext(char) :tag('span') -- inline-block :addClass('zhuyin-rt') :tag('span') :addClass('zhuyin-rt-phon') :wikitext(bopo) :done() :tag('span') :addClass('zhuyin-rt-tone') :wikitext(tone) return ru end -- Annotate objects in pinyin. -- Pinyin orthography allow multiple characters to be annotated. -- In this case, we might be adding a pinyin to multiple bopo-annotated pairs. -- (And this of course applies to other romanisations of Chinese.) function p._pinyin(tbl, pinyin, n) n = n or #tbl local ruby = mw.html.create('ruby') ruby:addClass('zhuyin-container') for i, v in ipairs(tbl) do ruby:node(v) end ruby:tag('rt') :attr('rbspan', tostring(n)) :wikitext(pinyin) return ruby end -- This is for test. function p.test() return p._pinyin({ p._zhuyin1('θ¬', 'γγ§γ', 'Λ'), p._zhuyin1('θ¬', 'γγ§γ', 'Λ') }, 'xiΓ¨xie', 2) end -- Now the CSS still needs to be written. And the interface is obviously clumsy, -- and not translatable to templates yet. The main problem is that we will need -- to either separate the syllables themselves or come up with a way for the user -- to express the separation in a template-string. -- -- Also there's a point in tagging stuff with lang return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Module:Arguments
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Ruby-zh/doc
(
edit
)
Module:Yesno
(
edit
)