def test_zhuyin_both_pinyin_both(self): self.assertEqual( html.to_html(self.s, bottom=self.pi, top=self.pi, left=self.zh, right=self.zh), self.zhuyin_both_pinyin_both)
def generate_new_html_for_words(words): """ Go through list of words, and generates the HTML + Ruby characters. *words* a list of chinese words """ words_with_pinyin_html = "" for word in words: debug("{0} : {1}".format(word, "".join(words))) debug('CHARACTER: {0}'.format(word)) if not is_entirely_chinese(word): pi = (' ' * len(word)).split(' ') else: zh = hanzi.to_zhuyin(word) debug('ZHUYIN: {0}'.format(zh)) pi = trans.zhuyin_to_pinyin( zh, accented=not numbered_pinyin).split(' ') debug('PINYIN: {0}'.format(pi)) debug("{0}={1}".format(word, "".join(pi))) words_with_pinyin_html += html.to_html(word, top=pi, minified=True) return words_with_pinyin_html
def generate_new_html_for_words(words): """ Go through list of words, and generates the HTML + Ruby characters. *words* a list of chinese words """ words_with_pinyin_html = "" for word in words: debug("{0} : {1}".format(word, "".join(words))) debug('CHARACTER: {0}'.format(word)) if not is_entirely_chinese(word): pi = (' '*len(word)).split(' ') else: zh = hanzi.to_zhuyin(word) debug('ZHUYIN: {0}'.format(zh)) pi = trans.zhuyin_to_pinyin( zh, accented=not numbered_pinyin).split(' ') debug('PINYIN: {0}'.format(pi)) debug("{0}={1}".format(word, "".join(pi))) words_with_pinyin_html += html.to_html(word, top=pi, minified=True) return words_with_pinyin_html
def test_pinyin_bottom(self): self.assertEqual(html.to_html(self.s, bottom=self.pi), self.pinyin_bottom)
def test_zhuyin_top(self): self.assertEqual(html.to_html(self.s, top=self.zh), self.zhuyin_top)
def test_pinyin_top(self): self.assertEqual(html.to_html(self.s, top=self.pi), self.pinyin_top)
def test_indented_3(self): self.assertEqual( html.to_html(self.s, bottom=self.pi, top=self.zh, indentation=3), self.indented_3)
def test_indented_0(self): self.assertEqual( html.to_html(self.s, bottom=self.pi, right=self.zh, indentation=0), self.indented_0)
def test_indented_5(self): self.assertEqual( html.to_html(self.s, bottom=self.pi, left=self.zh, indentation=5), self.indented_5)
def test_jyutping_in_html(self): self.assertEqual(html.to_html(self.s2, top=self.jp2), self.jyutping_html)
def test_manual_phonetics_input(self): self.assertEqual(html.to_html(self.s2, bottom=self.zh2_man), self.manual_pinyin)