State and arguments for reflowing. Used with DocTransformer to reflow a file.
| 66 | nestedVuPat = re.compile(r'^ \*\*') |
| 67 | |
| 68 | class ReflowCallbacks: |
| 69 | """State and arguments for reflowing. |
| 70 | |
| 71 | Used with DocTransformer to reflow a file.""" |
| 72 | def __init__(self, |
| 73 | filename, |
| 74 | vuidDict, |
| 75 | margin = 76, |
| 76 | breakPeriod = True, |
| 77 | reflow = True, |
| 78 | nextvu = None, |
| 79 | maxvu = None, |
| 80 | check = True): |
| 81 | |
| 82 | self.filename = filename |
| 83 | """base name of file being read from.""" |
| 84 | |
| 85 | self.check = check |
| 86 | """Whether consistency checks must be performed.""" |
| 87 | |
| 88 | self.margin = margin |
| 89 | """margin to reflow text to.""" |
| 90 | |
| 91 | self.breakPeriod = breakPeriod |
| 92 | """True if justification should break to a new line after the end of a |
| 93 | sentence.""" |
| 94 | |
| 95 | self.breakInitial = True |
| 96 | """True if justification should break to a new line after something |
| 97 | that appears to be an initial in someone's name. **TBD**""" |
| 98 | |
| 99 | self.reflow = reflow |
| 100 | """True if text should be reflowed, False to pass through unchanged.""" |
| 101 | |
| 102 | self.vuPrefix = 'VUID' |
| 103 | """Prefix of generated Valid Usage tags""" |
| 104 | |
| 105 | self.vuFormat = '{0}-{1}-{2}-{3:0>5d}' |
| 106 | """Format string for generating Valid Usage tags. |
| 107 | First argument is vuPrefix, second is command/struct name, third is |
| 108 | parameter name, fourth is the tag number.""" |
| 109 | |
| 110 | self.nextvu = nextvu |
| 111 | """Integer to start tagging un-numbered Valid Usage statements with, |
| 112 | or None if no tagging should be done.""" |
| 113 | |
| 114 | self.maxvu = maxvu |
| 115 | """Maximum tag to use for Valid Usage statements, or None if no |
| 116 | tagging should be done.""" |
| 117 | |
| 118 | self.vuidDict = vuidDict |
| 119 | """Dictionary of VUID numbers found, containing a list of (file, VUID) |
| 120 | on which that number was found. This is used to warn on duplicate |
| 121 | VUIDs.""" |
| 122 | |
| 123 | self.warnCount = 0 |
| 124 | """Count of markup check warnings encountered.""" |
| 125 |