~ubuntu-branches/ubuntu/utopic/gramps/utopic

« back to all changes in this revision

Viewing changes to src/plugins/docgen/AsciiDoc.py

  • Committer: Package Import Robot
  • Author(s): James A. Treacy
  • Date: 2012-05-22 17:18:36 UTC
  • mfrom: (39.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20120522171836-35fi62lp4w7jnrd7
Tags: 3.4.0-1
* New upstream version
* Updated desktop file. Closes: #667472

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
# Copyright (C) 2007-2009  Brian G. Matherly
6
6
# Copyright (C) 2009-2010  Benny Malengier <benny.malengier@gramps-project.org>
7
7
# Copyright (C) 2010       Peter Landgren
 
8
# Copyright (C) 2011       Adam Stein <adam@csh.rit.edu>
8
9
#
9
10
# This program is free software; you can redistribute it and/or modify
10
11
# it under the terms of the GNU General Public License as published by
21
22
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
23
#
23
24
 
24
 
# $Id:AsciiDoc.py 9912 2008-01-22 09:17:46Z acraphae $
 
25
# $Id: AsciiDoc.py 18848 2012-02-10 19:57:57Z nick-h $
25
26
 
26
27
#------------------------------------------------------------------------
27
28
#
256
257
                this_text = reformat_para(self.text,regular_indent,right,fmt,
257
258
                                      right_pad,first_indent)
258
259
            else:
259
 
                this_text = self.text
 
260
                this_text = ' '*(regular_indent+first_indent) + self.text
260
261
 
261
262
        if self.__note_format:
262
263
            # don't add an extra LF before the_pad if preformatted notes.
361
362
        if self.cell_lines[self.cellnum] > self.maxlines:
362
363
            self.maxlines = self.cell_lines[self.cellnum]
363
364
 
364
 
    def add_media_object(self, name, align, w_cm, h_cm, alt=''):
 
365
    def add_media_object(self, name, align, w_cm, h_cm, alt='', style_name=None, crop=None):
365
366
        this_text = '(photo)'
366
367
        if self.in_cell:
367
368
            self.cellpars[self.cellnum] += this_text
369
370
            self.f.write(this_text)
370
371
 
371
372
    def write_styled_note(self, styledtext, format, style_name,
372
 
                          contains_html=False):
 
373
                          contains_html=False, links=False):
373
374
        """
374
375
        Convenience function to write a styledtext to the ASCII doc. 
375
376
        styledtext : assumed a StyledText object to write
379
380
            If contains_html=True, then the textdoc is free to handle that in 
380
381
            some way. Eg, a textdoc could remove all tags, or could make sure
381
382
            a link is clickable. AsciiDoc prints the html without handling it
 
383
        links: bool, make the URL in the text clickable (if supported)
382
384
        """
383
385
        if contains_html:
384
386
            return
402
404
                self.write_text(line)
403
405
                self.end_paragraph()
404
406
 
405
 
    def write_endnotes_ref(self, text, style_name):
406
 
        """
407
 
        Overwrite base method for lines of endnotes references
408
 
        """
409
 
        for line in text.split('\n'):
410
 
            self.start_paragraph(style_name)
411
 
            self.write_text(line)
412
 
            self.end_paragraph()
413
 
 
414
407
    #--------------------------------------------------------------------
415
408
    #
416
409
    # Writes text. 
417
410
    #--------------------------------------------------------------------
418
 
    def write_text(self,text,mark=None):
 
411
    def write_text(self,text,mark=None,links=False):
419
412
        self.text = self.text + text