Cleanup of HTML generation code
Former-commit-id: b7080d6c0970944494c07ccd5c3c35719b34b660
This commit is contained in:
parent
1c5129f82b
commit
3aa5c8ee7e
@ -172,27 +172,27 @@ def buildEmpty():
|
|||||||
def buildVocabDef(definition, index, query):
|
def buildVocabDef(definition, index, query):
|
||||||
reading = unicode()
|
reading = unicode()
|
||||||
if definition['reading']:
|
if definition['reading']:
|
||||||
reading = u'<span class = "reading">[{0}]<br/></span>'.format(definition['reading'])
|
reading = u'<span class="reading">[{0}]<br></span>'.format(definition['reading'])
|
||||||
|
|
||||||
rules = unicode()
|
rules = unicode()
|
||||||
if definition.get('rules'):
|
if definition.get('rules'):
|
||||||
rules = ' < '.join(definition['rules'])
|
rules = ' < '.join(definition['rules'])
|
||||||
rules = '<span class = "rules">({0})<br/></span>'.format(rules)
|
rules = '<span class="rules">({0})<br></span>'.format(rules)
|
||||||
|
|
||||||
links = '<a href = "copyVocabDef:{0}"><img src = "://img/img/icon_copy_definition.png" align = "right"/></a>'.format(index)
|
links = '<a href="copyVocabDef:{0}"><img src="://img/img/icon_copy_definition.png" align="right"></a>'.format(index)
|
||||||
if query is not None:
|
if query is not None:
|
||||||
if query('vocab', markupVocabExp(definition)):
|
if query('vocab', markupVocabExp(definition)):
|
||||||
links += '<a href = "addVocabExp:{0}"><img src = "://img/img/icon_add_expression.png" align = "right"/></a>'.format(index)
|
links += '<a href="addVocabExp:{0}"><img src="://img/img/icon_add_expression.png" align="right"></a>'.format(index)
|
||||||
if query('vocab', markupVocabReading(definition)):
|
if query('vocab', markupVocabReading(definition)):
|
||||||
links += '<a href = "addVocabReading:{0}"><img src = "://img/img/icon_add_reading.png" align = "right"/></a>'.format(index)
|
links += '<a href="addVocabReading:{0}"><img src="://img/img/icon_add_reading.png" align="right"></a>'.format(index)
|
||||||
|
|
||||||
html = u"""
|
html = u"""
|
||||||
<span class = "links">{0}</span>
|
<span class="links">{0}</span>
|
||||||
<span class = "expression">{1}<br/></span>
|
<span class="expression">{1}<br></span>
|
||||||
{2}
|
{2}
|
||||||
<span class = "glossary">{3}<br/></span>
|
<span class="glossary">{3}<br></span>
|
||||||
{4}
|
{4}
|
||||||
<br clear = "all"/>""".format(links, definition['expression'], reading, definition['glossary'], rules)
|
<br clear="all">""".format(links, definition['expression'], reading, definition['glossary'], rules)
|
||||||
|
|
||||||
return html
|
return html
|
||||||
|
|
||||||
@ -209,17 +209,17 @@ def buildVocabDefs(definitions, query):
|
|||||||
|
|
||||||
|
|
||||||
def buildKanjiDef(definition, index, query):
|
def buildKanjiDef(definition, index, query):
|
||||||
links = '<a href = "copyKanjiDef:{0}"><img src = "://img/img/icon_copy_definition.png" align = "right"/></a>'.format(index)
|
links = '<a href="copyKanjiDef:{0}"><img src="://img/img/icon_copy_definition.png" align="right"></a>'.format(index)
|
||||||
if query is not None and query('kanji', markupKanji(definition)):
|
if query is not None and query('kanji', markupKanji(definition)):
|
||||||
links += '<a href = "addKanji:{0}"><img src = "://img/img/icon_add_expression.png" align = "right"/></a>'.format(index)
|
links += '<a href="addKanji:{0}"><img src="://img/img/icon_add_expression.png" align="right"></a>'.format(index)
|
||||||
|
|
||||||
readings = ', '.join([definition['kunyomi'], definition['onyomi']])
|
readings = ', '.join([definition['kunyomi'], definition['onyomi']])
|
||||||
html = u"""
|
html = u"""
|
||||||
<span class = "links">{0}</span>
|
<span class="links">{0}</span>
|
||||||
<span class = "expression">{1}<br/></span>
|
<span class="expression">{1}<br></span>
|
||||||
<span class = "reading">[{2}]<br/></span>
|
<span class="reading">[{2}]<br></span>
|
||||||
<span class = "glossary">{3}<br/></span>
|
<span class="glossary">{3}<br></span>
|
||||||
<br clear = "all"/>""".format(links, definition['character'], readings, definition['glossary'])
|
<br clear="all">""".format(links, definition['character'], readings, definition['glossary'])
|
||||||
|
|
||||||
return html
|
return html
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user