Khác biệt giữa bản sửa đổi của “Mô đun:Ruby”

imported>Admin
Đã lùi lại sửa đổi 4253 của Admin (thảo luận)
 
Không có tóm lược sửa đổi
Thẻ: Đã bị lùi lại
Dòng 64: Dòng 64:
---Unicode codepoints for combining Vietnamese tone marks.
---Unicode codepoints for combining Vietnamese tone marks.
p.combiningToneMarks = mw.ustring.char(
p.combiningToneMarks = mw.ustring.char(
0x300, -- à
0x300, -- à
0x301, -- á
0x301, -- á
0x303, -- ã
0x303, -- ã
0x309, -- ả
0x309, -- ả
0x323   -- ạ
0x323 -- ạ
)
)


---Unicode codepoints for combining Vietnamese accent marks.
---Unicode codepoints for combining Vietnamese accent marks.
p.combiningAccentMarks = mw.ustring.char(
p.combiningAccentMarks = mw.ustring.char(
0x302, -- â
0x302, -- â
0x306, -- ă
0x306, -- ă
0x31b   -- ơ
0x31b -- ơ
)
)


---Strips Vietnamese diacritical marks from the given text.
---Strips Vietnamese diacritical marks from the given text.
-- @param tones     Set to “0” to leave tone marks intact.
-- @param tones   Set to “0” to leave tone marks intact.
-- @param accents   Set to “0” to leave accent marks intact.
-- @param accents Set to “0” to leave accent marks intact.
-- @param đ         Set to “0” to leave “Đ” and “đ” intact.
-- @param đ     Set to “0” to leave “Đ” and “đ” intact.
function p.removeDiacritics(text, toneMarks, accentMarks, stroke)
function p.removeDiacritics(text, toneMarks, accentMarks, stroke)
if type(text) == "table" then
if type(text) == "table" then
Dòng 274: Dòng 274:
if pruby == 'link' then
if pruby == 'link' then
character = mw.ustring.format(
character = mw.ustring.format(
"<ruby><rb><span class='Hani'; span style='font-size: 100%%'>[[%s#Vietnamese|%s]]</span></rb><rp>(</rp><rt><span style='padding: 0 0.25em; font-size: 120%%;'>[[%s#Vietnamese|%s]]</span></rt><rp>)</rp></ruby>",
"<ruby class='zh'><rb><span class='Hani'; span style='font-size: 100%%'>[[%s#Vietnamese|%s]]</span></rb><rp>(</rp><rt><span style='padding: 0 0.25em; font-size: 120%%;'>[[%s#Vietnamese|%s]]</span></rt><rp>)</rp></ruby>",
character, character, reading, reading)
character, character, reading, reading)
end
end
if pruby == 'nocolor' then
if pruby == 'nocolor' then
character = mw.ustring.format(
character = mw.ustring.format(
"<ruby><rb><span class='Hani' style='color:#000000;'>%s</span></rb><rp>(</rp><rt><span style='padding: 0 0.25em; font-size: 120%%;'>%s</span></rt><rp>)</rp></ruby>",
"<ruby class='zh'><rb><span class='Hani' style='color:#000000;'>%s</span></rb><rp>(</rp><rt><span style='padding: 0 0.25em; font-size: 120%%;'>%s</span></rt><rp>)</rp></ruby>",
character, reading)
character, reading)
end
end
if pruby ~= 'link' and pruby ~= 'nocolor' then
if pruby ~= 'link' and pruby ~= 'nocolor' then
character = mw.ustring.format(
character = mw.ustring.format(
"<ruby><rb><span class='Hani'>%s</span></rb><rp>(</rp><rt><span style='padding: 0 0.25em;'>%s</span></rt><rp>)</rp></ruby>",
"<ruby class='zh'><rb><span class='Hani'>%s</span></rb><rp>(</rp><rt><span style='padding: 0 0.25em;'>%s</span></rt><rp>)</rp></ruby>",
character, reading)
character, reading)
end
end