mailr18920 - in /branches/frame_order_testing: ./ lib/text/sectioning.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on March 20, 2013 - 15:37:
Author: bugman
Date: Wed Mar 20 15:37:11 2013
New Revision: 18920

URL: http://svn.gna.org/viewcvs/relax?rev=18920&view=rev
Log:
Merged revisions 18919 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r18919 | bugman | 2013-03-20 15:36:38 +0100 (Wed, 20 Mar 2013) | 5 lines
  
  Added prespace and postspace arguments to the *section() and *title() fns 
of lib.text.sectioning.
  
  Through these arguments, the amount of spacing above and below the section 
text can be controlled.
........

Modified:
    branches/frame_order_testing/   (props changed)
    branches/frame_order_testing/lib/text/sectioning.py

Propchange: branches/frame_order_testing/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Mar 20 15:37:11 2013
@@ -1,1 +1,1 @@
-/trunk:1-18914
+/trunk:1-18919

Modified: branches/frame_order_testing/lib/text/sectioning.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/lib/text/sectioning.py?rev=18920&r1=18919&r2=18920&view=diff
==============================================================================
--- branches/frame_order_testing/lib/text/sectioning.py (original)
+++ branches/frame_order_testing/lib/text/sectioning.py Wed Mar 20 15:37:11 
2013
@@ -44,94 +44,118 @@
     file.write("%s\n" % hline)
 
 
-def section(file=None, text=None):
+def section(file=None, text=None, prespace=2, postspace=1):
     """Format and write out a section to the given file.
 
     @keyword file:      The file object to write to.
     @type file:         file object
     @keyword text:      The section text.
     @type text:         str
+    @keyword prespace:  The number of empty lines prior to the text printout.
+    @type prespace:     int
+    @keyword postspace: The number of empty lines after the text printout.
+    @type postspace:    int
     """
 
-    # Underline the text.
-    file.write("\n\n")
+    # Format the text.
+    file.write("\n" * prespace)
     underline(file=file, text=text, char="=")
-    file.write("\n")
+    file.write("\n" * postspace)
 
 
-def subsection(file=None, text=None):
+def subsection(file=None, text=None, prespace=1, postspace=1):
     """Format and write out a subsection to the given file.
 
     @keyword file:      The file object to write to.
     @type file:         file object
     @keyword text:      The subsection text.
     @type text:         str
+    @keyword prespace:  The number of empty lines prior to the text printout.
+    @type prespace:     int
+    @keyword postspace: The number of empty lines after the text printout.
+    @type postspace:    int
     """
 
-    # Underline the text.
-    file.write("\n")
+    # Format the text.
+    file.write("\n" * prespace)
     underline(file=file, text=text, char="-")
-    file.write("\n")
+    file.write("\n" * postspace)
 
 
-def subsubsection(file=None, text=None):
+def subsubsection(file=None, text=None, prespace=1, postspace=1):
     """Format and write out a subsubsection to the given file.
 
     @keyword file:      The file object to write to.
     @type file:         file object
     @keyword text:      The subsubsection text.
     @type text:         str
+    @keyword prespace:  The number of empty lines prior to the text printout.
+    @type prespace:     int
+    @keyword postspace: The number of empty lines after the text printout.
+    @type postspace:    int
     """
 
-    # Underline the text.
-    file.write("\n")
+    # Format the text.
+    file.write("\n" * prespace)
     underline(file=file, text=text, char="~")
-    file.write("\n")
+    file.write("\n" * postspace)
 
 
-def subsubtitle(file=None, text=None):
+def subsubtitle(file=None, text=None, prespace=1, postspace=1):
     """Format and write out a subsubtitle to the given file.
 
     @keyword file:      The file object to write to.
     @type file:         file object
     @keyword text:      The subsubtitle text.
     @type text:         str
+    @keyword prespace:  The number of empty lines prior to the text printout.
+    @type prespace:     int
+    @keyword postspace: The number of empty lines after the text printout.
+    @type postspace:    int
     """
 
-    # Box the text.
-    file.write("\n")
+    # Format the text.
+    file.write("\n" * prespace)
     box(file=file, text=text, char="~")
-    file.write("\n")
+    file.write("\n" * postspace)
 
 
-def subtitle(file=None, text=None):
+def subtitle(file=None, text=None, prespace=1, postspace=1):
     """Format and write out a subtitle to the given file.
 
     @keyword file:      The file object to write to.
     @type file:         file object
     @keyword text:      The subtitle text.
     @type text:         str
+    @keyword prespace:  The number of empty lines prior to the text printout.
+    @type prespace:     int
+    @keyword postspace: The number of empty lines after the text printout.
+    @type postspace:    int
     """
 
-    # Box the text.
-    file.write("\n")
+    # Format the text.
+    file.write("\n" * prespace)
     box(file=file, text=text, char="-")
-    file.write("\n")
+    file.write("\n" * postspace)
 
 
-def title(file=None, text=None):
+def title(file=None, text=None, prespace=2, postspace=1):
     """Format and write out a title to the given file.
 
     @keyword file:      The file object to write to.
     @type file:         file object
     @keyword text:      The title text.
     @type text:         str
+    @keyword prespace:  The number of empty lines prior to the text printout.
+    @type prespace:     int
+    @keyword postspace: The number of empty lines after the text printout.
+    @type postspace:    int
     """
 
-    # Box the text.
-    file.write("\n\n")
+    # Format the text.
+    file.write("\n" * prespace)
     box(file=file, text=text, char="=")
-    file.write("\n")
+    file.write("\n" * postspace)
 
 
 def underline(file=None, text=None, char=None):




Related Messages


Powered by MHonArc, Updated Wed Mar 20 16:00:01 2013