~jon-hill/supertree-toolkit/visualisations

« back to all changes in this revision

Viewing changes to stk/yapbib/bibitem.py

  • Committer: Jon Hill
  • Date: 2013-09-24 16:34:30 UTC
  • mfrom: (108.1.16 bug_fixes)
  • Revision ID: jon.hill@imperial.ac.uk-20130924163430-jcgij3mc90g66hnh
Fixing a number of bugs and adding comments to a lot of the schema

Show diffs side-by-side

added added

removed removed

Lines of Context:
353
353
    """
354
354
    Converts the item to xml format. The prefix is added to each entry
355
355
    """
 
356
    from xml.sax.saxutils import escape
 
357
    from string import capwords
 
358
 
356
359
    sp= indent*3
357
360
    spc=indent*' '
358
361
    entry_type = self.get('_type','')
382
385
        other_names, fam_name = x.rsplit(' ',1)
383
386
        v += '%s<surname>\n'%(sp*spc)
384
387
        sp+=1
385
 
        v += '%s<string_value lines="1">%s</string_value>\n'%(sp*spc,fam_name)
 
388
        v += '%s<string_value lines="1">%s</string_value>\n'%(sp*spc,capwords(fam_name))
386
389
        sp-=1
387
390
        v += '%s</surname>\n'%(sp*spc)
388
391
        v += '%s<other_names>\n'%(sp*spc)
389
392
        sp+=1
390
 
        v += '%s<string_value lines="1">%s</string_value>\n'%(sp*spc,other_names)
 
393
        v += '%s<string_value lines="1">%s</string_value>\n'%(sp*spc,capwords(other_names))
391
394
        sp-=1
392
395
        v += '%s</other_names>\n'%(sp*spc)
393
396
        sp-=1
503
506
                pages = firstpage
504
507
            else:
505
508
                pages = firstpage + "-" + lastpage
 
509
            # escape
 
510
            pages = escape(pages)
506
511
            sp+=1
507
512
            v = '\n%s<string_value lines="1">%s</string_value>\n%s'%(sp*spc,pages,(sp-1)*spc)
508
513
            sp-=1