예제 #1
0
파일: node.py 프로젝트: quixotique/six
 def __init__(self, aka=None):
     r'''
     @param aka: other names
     '''
     super(NamedNode, self).__init__()
     aka = list(uniq(aka)) if aka else []
     for a in aka:
         assert isinstance(a, (str, multilang))
     self.aka = aka
예제 #2
0
파일: book.py 프로젝트: quixotique/six
 def add_names(
     self,
     names,
     refname=None,
     bullet="",
     bold=True,
     prefix="",
     suffix="",
     comments=(),
     style=name_style,
     akastyle=aka_style,
     refstyle=ref_style,
     comstyle=name_comment_style,
 ):
     names = uniq(names)
     first = next(names)
     if bold:
         startbold, endbold = "<b>", "</b>"
     else:
         startbold, endbold = "", ""
     if bullet:
         bullet = bullet + " "
     bulletWidth = stringWidth(bullet, style.fontName, style.fontSize)
     if hasattr(first, "sortsplit"):
         pre, sort, post = first.sortsplit()
         name = "".join([escape_xml(pre), startbold, escape_xml(sort), endbold, escape_xml(post)])
     else:
         name = startbold + escape_xml(str(first)) + endbold
     first = str(first)
     para = [prefix, name, suffix]
     self._para("".join(para), style, bullet=bullet)
     # Join AKA names onto the end of the name.
     para = []
     for aka in map(str, names):
         if aka != first:
             para += [" =", NBSP, escape_xml(aka)]
     if para:
         self._para("".join(para), akastyle, returnIndent=bulletWidth, join_to_prev=True)
     # Join reference arrow and text onto end of name.
     if refname:
         para = [" ", RIGHT_ARROW, NBSP, escape_xml(refname)]
         self._para("".join(para), refstyle, returnIndent=bulletWidth, join_to_prev=True)
     # Join comments onto end of name.
     para = []
     for c in comments:
         para += [" ", EN_DASH, NBSP, escape_xml(str(c))]
     if para:
         self._para("".join(para), comstyle, returnIndent=bulletWidth, join_to_prev=True)
예제 #3
0
파일: node.py 프로젝트: quixotique/six
 def all_places(self):
     r'''Iterate over all the places (areas and/or countries) to which this
     node pertains, based on its links to other nodes.
     '''
     return uniq(self._all_places())