Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2010 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax. # 6 # # 7 # relax is free software; you can redistribute it and/or modify # 8 # it under the terms of the GNU General Public License as published by # 9 # the Free Software Foundation; either version 2 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # relax is distributed in the hope that it will be useful, # 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 # GNU General Public License for more details. # 16 # # 17 # You should have received a copy of the GNU General Public License # 18 # along with relax; if not, write to the Free Software # 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 20 # # 21 ############################################################################### 22 23 # Module docstring. 24 """Module for building documentation.""" 25 26 27 # Some constants. 28 TITLE = 3 29 SECTION = 2 30 SUBSECTION = 1 31 PARAGRAPH = 0 32 LIST = 10 33 3436 """Convert the text to that of a docstring, dependent on the text level. 37 38 @param data: The lists of constants and text to convert into a properly formatted docstring. 39 @type data: list of lists of int and str 40 """ 41 42 # Init. 43 doc = '' 44 for i in range(len(data)): 45 # The level and text. 46 level, text = data[i] 47 48 # Title level. 49 if level == TITLE: 50 doc += text + '\n\n' 51 52 # Section level. 53 if level == SECTION: 54 doc += '\n\n' + text + '\n' + '='*len(text) + '\n\n' 55 56 # Subsection level. 57 if level == SUBSECTION: 58 doc += '\n\n' + text + '\n' + '-'*len(text) + '\n\n' 59 60 # Paragraph level. 61 elif level == PARAGRAPH: 62 # Starting newline. 63 if i and data[i-1][0] == PARAGRAPH: 64 doc += '\n' 65 66 # The text. 67 doc += text + '\n' 68 69 # List level. 70 elif level == LIST: 71 # Start of list. 72 if i and data[i-1][0] != LIST: 73 doc += '\n' 74 75 # The text. 76 doc += " - %s\n" % text 77 78 # End of list. 79 if i < len(data) and data[i+1][0] == PARAGRAPH: 80 doc += '\n' 81 82 # Return the docstring. 83 return doc84
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 13:32:37 2013 | http://epydoc.sourceforge.net |