You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

att.template.html 11KB

10 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html><head><title>Python: module att.template</title>
  3. </head><body bgcolor="#f0f0f8">
  4. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
  5. <tr bgcolor="#7799ee">
  6. <td valign=bottom>&nbsp;<br>
  7. <font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="att.html"><font color="#ffffff">att</font></a>.template</strong></big></big></font></td
  8. ><td align=right valign=bottom
  9. ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C:/workbench/projects/att/att/template.py">c:\workbench\projects\att\att\template.py</a></font></td></tr></table>
  10. <p><tt><a href="#Template">Template</a>&nbsp;module&nbsp;for&nbsp;a&nbsp;Automatic&nbsp;Text&nbsp;Tools.<br>
  11. &nbsp;<br>
  12. (c)&nbsp;2013&nbsp;Ivan&nbsp;"Kai&nbsp;SD"&nbsp;Korystin&nbsp;<br>
  13. &nbsp;<br>
  14. License:&nbsp;GPLv3</tt></p>
  15. <p>
  16. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  17. <tr bgcolor="#aa55cc">
  18. <td colspan=3 valign=bottom>&nbsp;<br>
  19. <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
  20. <tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
  21. <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="re.html">re</a><br>
  22. </td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
  23. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  24. <tr bgcolor="#ee77aa">
  25. <td colspan=3 valign=bottom>&nbsp;<br>
  26. <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
  27. <tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
  28. <td width="100%"><dl>
  29. <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
  30. </font></dt><dd>
  31. <dl>
  32. <dt><font face="helvetica, arial"><a href="att.template.html#Template">Template</a>
  33. </font></dt><dd>
  34. <dl>
  35. <dt><font face="helvetica, arial"><a href="att.template.html#TemplateV2">TemplateV2</a>
  36. </font></dt></dl>
  37. </dd>
  38. </dl>
  39. </dd>
  40. </dl>
  41. <p>
  42. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  43. <tr bgcolor="#ffc8d8">
  44. <td colspan=3 valign=bottom>&nbsp;<br>
  45. <font color="#000000" face="helvetica, arial"><a name="Template">class <strong>Template</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
  46. <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
  47. <td colspan=2><tt>Empty&nbsp;template&nbsp;class.&nbsp;Generates&nbsp;empty&nbsp;text.<br>&nbsp;</tt></td></tr>
  48. <tr><td>&nbsp;</td>
  49. <td width="100%">Methods defined here:<br>
  50. <dl><dt><a name="Template-log"><strong>log</strong></a>(self, text)</dt><dd><tt>Print&nbsp;information</tt></dd></dl>
  51. <dl><dt><a name="Template-process"><strong>process</strong></a>(self, data)</dt><dd><tt>Replace&nbsp;this&nbsp;method&nbsp;in&nbsp;subclasses.</tt></dd></dl>
  52. <dl><dt><a name="Template-warning"><strong>warning</strong></a>(self, text)</dt><dd><tt>Prints&nbsp;a&nbsp;warning</tt></dd></dl>
  53. <hr>
  54. Data descriptors defined here:<br>
  55. <dl><dt><strong>__dict__</strong></dt>
  56. <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
  57. </dl>
  58. <dl><dt><strong>__weakref__</strong></dt>
  59. <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
  60. </dl>
  61. </td></tr></table> <p>
  62. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  63. <tr bgcolor="#ffc8d8">
  64. <td colspan=3 valign=bottom>&nbsp;<br>
  65. <font color="#000000" face="helvetica, arial"><a name="TemplateV2">class <strong>TemplateV2</strong></a>(<a href="att.template.html#Template">Template</a>)</font></td></tr>
  66. <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
  67. <td colspan=2><tt>Class&nbsp;for&nbsp;reading&nbsp;ATGv2&nbsp;templates.<br>
  68. &nbsp;<br>
  69. ATGv2&nbsp;template&nbsp;file&nbsp;should&nbsp;be&nbsp;a&nbsp;plain&nbsp;text&nbsp;file,&nbsp;starting&nbsp;with&nbsp;the&nbsp;line<br>
  70. ATGV2<br>
  71. followed&nbsp;by&nbsp;the&nbsp;info&nbsp;line:<br>
  72. [$KeyField$Extension$Prefix$Encoding$]<br>
  73. where<br>
  74. KeyField&nbsp;-&nbsp;is&nbsp;a&nbsp;name&nbsp;of&nbsp;a&nbsp;data&nbsp;column,&nbsp;that&nbsp;contains&nbsp;an&nbsp;identifier.<br>
  75. Extension&nbsp;-&nbsp;is&nbsp;the&nbsp;desired&nbsp;extension&nbsp;for&nbsp;the&nbsp;generated&nbsp;files.<br>
  76. Prefix&nbsp;-&nbsp;is&nbsp;the&nbsp;desired&nbsp;filename&nbsp;prefix&nbsp;for&nbsp;the&nbsp;generated&nbsp;files<br>
  77. Encoding&nbsp;-&nbsp;is&nbsp;the&nbsp;desired&nbsp;encoding&nbsp;for&nbsp;the&nbsp;generated&nbsp;files.<br>
  78. The&nbsp;line&nbsp;may&nbsp;also&nbsp;have&nbsp;some&nbsp;optional&nbsp;keywords&nbsp;before&nbsp;the&nbsp;closing&nbsp;bracket:<br>
  79. oneFile$&nbsp;-&nbsp;place&nbsp;all&nbsp;generated&nbsp;text&nbsp;into&nbsp;a&nbsp;single&nbsp;file&nbsp;instead&nbsp;of<br>
  80. generating&nbsp;a&nbsp;file&nbsp;for&nbsp;each&nbsp;table&nbsp;row.<br>
  81. After&nbsp;the&nbsp;info&nbsp;line,&nbsp;you&nbsp;can&nbsp;put&nbsp;your&nbsp;text.<br>
  82. You&nbsp;can&nbsp;use&nbsp;following&nbsp;commands&nbsp;to&nbsp;handle&nbsp;the&nbsp;data:<br>
  83. *&nbsp;[$Name$],&nbsp;where&nbsp;Name&nbsp;is&nbsp;the&nbsp;column&nbsp;header,<br>
  84. will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;value&nbsp;from&nbsp;the&nbsp;current&nbsp;row.<br>
  85. *&nbsp;[$ATGLINDEX$]&nbsp;will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;number&nbsp;of&nbsp;a&nbsp;current&nbsp;row.<br>
  86. *&nbsp;[$ATGHEADER$Text$]&nbsp;and&nbsp;[$ATGFOOTER$Text$]&nbsp;will&nbsp;place&nbsp;the&nbsp;given&nbsp;text<br>
  87. at&nbsp;the&nbsp;begining&nbsp;or&nbsp;at&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;file.&nbsp;You&nbsp;can't&nbsp;use&nbsp;other<br>
  88. commands&nbsp;in&nbsp;this&nbsp;text.<br>
  89. *&nbsp;[$ATGLIST$Name$Text$],&nbsp;where&nbsp;Name&nbsp;is&nbsp;a&nbsp;multi-column&nbsp;header<br>
  90. (i.e.&nbsp;'Col'&nbsp;will&nbsp;represent&nbsp;'Col1',&nbsp;'Col2',&nbsp;'Col3'&nbsp;etc)<br>
  91. will&nbsp;repeat&nbsp;the&nbsp;given&nbsp;text&nbsp;for&nbsp;each&nbsp;non-empty&nbsp;value.<br>
  92. You&nbsp;can&nbsp;use&nbsp;other&nbsp;commands&nbsp;in&nbsp;Text.&nbsp;Also&nbsp;[$Name$]&nbsp;inside&nbsp;the&nbsp;list<br>
  93. will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;value&nbsp;for&nbsp;the&nbsp;current&nbsp;row&nbsp;and&nbsp;column.<br>
  94. *&nbsp;[$ATGLINDEX$]&nbsp;can&nbsp;be&nbsp;used&nbsp;only&nbsp;inside&nbsp;the&nbsp;ATGLIST&nbsp;text,<br>
  95. will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;current&nbsp;column&nbsp;index.<br>
  96. *&nbsp;[$ATGLISTCUT$Name$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGLIST,&nbsp;but&nbsp;the&nbsp;last&nbsp;symbol<br>
  97. will&nbsp;be&nbsp;removed.&nbsp;Useful&nbsp;for&nbsp;removing&nbsp;unnecessary&nbsp;newlines.<br>
  98. *&nbsp;[$ATGIF$Name$Value$Text$]&nbsp;will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;given&nbsp;text<br>
  99. only&nbsp;if&nbsp;the&nbsp;the&nbsp;given&nbsp;column's&nbsp;value&nbsp;is&nbsp;the&nbsp;same&nbsp;as&nbsp;the&nbsp;given&nbsp;one.<br>
  100. Will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;empty&nbsp;text&nbsp;otherwise.&nbsp;You&nbsp;can&nbsp;use&nbsp;other<br>
  101. commands&nbsp;in&nbsp;Text.<br>
  102. *&nbsp;[$ATGIFNOT$Name$Value$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGIF,&nbsp;but&nbsp;the&nbsp;column's&nbsp;value<br>
  103. should&nbsp;not&nbsp;be&nbsp;equal&nbsp;to&nbsp;the&nbsp;given&nbsp;one.<br>
  104. *&nbsp;[$ATGGREATER$Name$Value$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGIF,&nbsp;but&nbsp;the&nbsp;value&nbsp;should<br>
  105. be&nbsp;the&nbsp;number&nbsp;and&nbsp;it&nbsp;should&nbsp;be&nbsp;greater&nbsp;then&nbsp;the&nbsp;given&nbsp;one.<br>
  106. *&nbsp;[$ATGGREATER$Name$Value$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGGREATER,&nbsp;but&nbsp;the&nbsp;value<br>
  107. should&nbsp;be&nbsp;less&nbsp;then&nbsp;the&nbsp;given&nbsp;one.<br>
  108. *&nbsp;[$ATGREPLACE$Text1$Text2$]&nbsp;-&nbsp;Will&nbsp;replace&nbsp;Text1&nbsp;with&nbsp;Text2.&nbsp;Replacements<br>
  109. will&nbsp;be&nbsp;done&nbsp;after&nbsp;all&nbsp;other&nbsp;commands.&nbsp;You&nbsp;can't&nbsp;use&nbsp;regular&nbsp;expressions&nbsp;or<br>
  110. other&nbsp;commands&nbsp;in&nbsp;the&nbsp;text.<br>
  111. *&nbsp;[$ATGPREFIX$Text$]&nbsp;-&nbsp;Will&nbsp;add&nbsp;the&nbsp;given&nbsp;text&nbsp;to&nbsp;the&nbsp;filename&nbsp;prefix.<br>
  112. You&nbsp;can&nbsp;use&nbsp;other&nbsp;commands&nbsp;in&nbsp;text,&nbsp;but&nbsp;do&nbsp;it&nbsp;carefully.<br>
  113. *&nbsp;[$ATGSKIP$]&nbsp;-&nbsp;Skip&nbsp;the&nbsp;current&nbsp;row.&nbsp;Use&nbsp;only&nbsp;in&nbsp;combination&nbsp;with&nbsp;the<br>
  114. ATGIF/ATGIFNOT,&nbsp;or&nbsp;you&nbsp;will&nbsp;generate&nbsp;nothing.<br>
  115. *&nbsp;[$ATGPREV$Name$],&nbsp;where&nbsp;Name&nbsp;is&nbsp;the&nbsp;column&nbsp;header,<br>
  116. will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;with&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;given&nbsp;header&nbsp;from&nbsp;the<br>
  117. previous&nbsp;row.&nbsp;ATGSKIP&nbsp;will&nbsp;be&nbsp;used&nbsp;for&nbsp;the&nbsp;first&nbsp;row.<br>&nbsp;</tt></td></tr>
  118. <tr><td>&nbsp;</td>
  119. <td width="100%"><dl><dt>Method resolution order:</dt>
  120. <dd><a href="att.template.html#TemplateV2">TemplateV2</a></dd>
  121. <dd><a href="att.template.html#Template">Template</a></dd>
  122. <dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
  123. </dl>
  124. <hr>
  125. Methods defined here:<br>
  126. <dl><dt><a name="TemplateV2-__init__"><strong>__init__</strong></a>(self, filename<font color="#909090">=None</font>, encoding<font color="#909090">='utf-8'</font>, text<font color="#909090">=''</font>)</dt><dd><tt>Constructor.<br>
  127. &nbsp;<br>
  128. filename&nbsp;-&nbsp;name&nbsp;of&nbsp;the&nbsp;ATGv2&nbsp;template&nbsp;file.<br>
  129. encoding&nbsp;-&nbsp;encoding&nbsp;of&nbsp;the&nbsp;template&nbsp;file.<br>
  130. text&nbsp;-&nbsp;text&nbsp;to&nbsp;use&nbsp;if&nbsp;no&nbsp;filename&nbsp;has&nbsp;been&nbsp;provided.</tt></dd></dl>
  131. <dl><dt><a name="TemplateV2-process"><strong>process</strong></a>(self, data)</dt><dd><tt>Generate&nbsp;text&nbsp;for&nbsp;the&nbsp;given&nbsp;data.</tt></dd></dl>
  132. <hr>
  133. Static methods defined here:<br>
  134. <dl><dt><a name="TemplateV2-express"><strong>express</strong></a>(cls, text, **kwargs)</dt></dl>
  135. <hr>
  136. Methods inherited from <a href="att.template.html#Template">Template</a>:<br>
  137. <dl><dt><a name="TemplateV2-log"><strong>log</strong></a>(self, text)</dt><dd><tt>Print&nbsp;information</tt></dd></dl>
  138. <dl><dt><a name="TemplateV2-warning"><strong>warning</strong></a>(self, text)</dt><dd><tt>Prints&nbsp;a&nbsp;warning</tt></dd></dl>
  139. <hr>
  140. Data descriptors inherited from <a href="att.template.html#Template">Template</a>:<br>
  141. <dl><dt><strong>__dict__</strong></dt>
  142. <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
  143. </dl>
  144. <dl><dt><strong>__weakref__</strong></dt>
  145. <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
  146. </dl>
  147. </td></tr></table></td></tr></table>
  148. </body></html>