本文整理汇总了Python中pymei.MeiElement.setTail方法的典型用法代码示例。如果您正苦于以下问题:Python MeiElement.setTail方法的具体用法?Python MeiElement.setTail怎么用?Python MeiElement.setTail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymei.MeiElement
的用法示例。
在下文中一共展示了MeiElement.setTail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _add_revision
# 需要导入模块: from pymei import MeiElement [as 别名]
# 或者: from pymei.MeiElement import setTail [as 别名]
def _add_revision(self):
# add a revision
today = datetime.date.today().isoformat()
change = MeiElement('change')
# get last change number
changes = self._meidoc.getElementsByName('change')
if len(changes):
last_change = int(changes[-1].getAttribute('n').value)
change.addAttribute('n', str(last_change+1))
resp_stmt = MeiElement('respStmt')
corp_name = MeiElement('corpName')
corp_name.setValue('Distributed Digital Music Archives and Libraries Lab (DDMAL)')
change_desc = MeiElement('changeDesc')
ref = MeiElement('ref')
p = MeiElement('p')
application = self._meidoc.getElementsByName('application')
app_name = 'RODAN/barlineFinder'
if len(application):
ref.addAttribute('target', '#'+application[0].getId())
ref.setValue(app_name)
ref.setTail('.')
p.addChild(ref)
p.setValue('Combining individual page MEIs using ')
date = MeiElement('date')
date.setValue(today)
revision_descs = self._meidoc.getElementsByName('revisionDesc')
if len(revision_descs):
revision_descs[0].addChild(change)
change.addChild(resp_stmt)
resp_stmt.addChild(corp_name)
change.addChild(change_desc)
change_desc.addChild(p)
change.addChild(date)
示例2: _create_header
# 需要导入模块: from pymei import MeiElement [as 别名]
# 或者: from pymei.MeiElement import setTail [as 别名]
def _create_header(self, rodan_version='0.1'):
'''
Create a meiHead element
'''
mei_head = MeiElement('meiHead')
today = datetime.date.today().isoformat()
app_name = 'RODAN/barlineFinder'
# file description
file_desc = MeiElement('fileDesc')
title_stmt = MeiElement('titleStmt')
title = MeiElement('title')
resp_stmt = MeiElement('respStmt')
corp_name = MeiElement('corpName')
corp_name.setValue('Distributed Digital Music Archives and Libraries Lab (DDMAL)')
title_stmt.addChild(title)
title_stmt.addChild(resp_stmt)
resp_stmt.addChild(corp_name)
pub_stmt = MeiElement('pubStmt')
resp_stmt = MeiElement('respStmt')
corp_name = MeiElement('corpName')
corp_name.setValue('Distributed Digital Music Archives and Libraries Lab (DDMAL)')
pub_stmt.addChild(resp_stmt)
resp_stmt.addChild(corp_name)
mei_head.addChild(file_desc)
file_desc.addChild(title_stmt)
file_desc.addChild(pub_stmt)
# encoding description
encoding_desc = MeiElement('encodingDesc')
app_info = MeiElement('appInfo')
application = MeiElement('application')
application.addAttribute('version', rodan_version)
name = MeiElement('name')
name.setValue(app_name)
ptr = MeiElement('ptr')
ptr.addAttribute('target', 'https://github.com/DDMAL/barlineFinder')
mei_head.addChild(encoding_desc)
encoding_desc.addChild(app_info)
app_info.addChild(application)
application.addChild(name)
application.addChild(ptr)
# revision description
revision_desc = MeiElement('revisionDesc')
change = MeiElement('change')
change.addAttribute('n', '1')
resp_stmt = MeiElement('respStmt')
corp_name = MeiElement('corpName')
corp_name.setValue('Distributed Digital Music Archives and Libraries Lab (DDMAL)')
change_desc = MeiElement('changeDesc')
ref = MeiElement('ref')
ref.addAttribute('target', '#'+application.getId())
ref.setValue(app_name)
ref.setTail('.')
p = MeiElement('p')
p.addChild(ref)
p.setValue('Encoded using ')
date = MeiElement('date')
date.setValue(today)
mei_head.addChild(revision_desc)
revision_desc.addChild(change)
change.addChild(resp_stmt)
resp_stmt.addChild(corp_name)
change.addChild(change_desc)
change_desc.addChild(p)
change.addChild(date)
return mei_head