Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
Это архивный репозиторий. Вы можете его клонировать или просматривать файлы, но не вносить изменения или открывать задачи/запросы на слияние.

135 строки
9.4KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html><head><title>Python: module 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>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:/users/kaisd/documents/workbench/programming/ktt/src/template.py">c:\users\kaisd\documents\workbench\programming\ktt\src\template.py</a></font></td></tr></table>
  10. <p><tt><a href="#Template">Template</a>&nbsp;module&nbsp;for&nbsp;a&nbsp;KaiSD&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="template.html#Template">Template</a>
  30. </font></dt><dd>
  31. <dl>
  32. <dt><font face="helvetica, arial"><a href="template.html#TemplateV2">TemplateV2</a>
  33. </font></dt></dl>
  34. </dd>
  35. </dl>
  36. <p>
  37. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  38. <tr bgcolor="#ffc8d8">
  39. <td colspan=3 valign=bottom>&nbsp;<br>
  40. <font color="#000000" face="helvetica, arial"><a name="Template">class <strong>Template</strong></a></font></td></tr>
  41. <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
  42. <td colspan=2><tt>Empty&nbsp;template&nbsp;class.&nbsp;Generates&nbsp;empty&nbsp;text.<br>&nbsp;</tt></td></tr>
  43. <tr><td>&nbsp;</td>
  44. <td width="100%">Methods defined here:<br>
  45. <dl><dt><a name="Template-log"><strong>log</strong></a>(self, text)</dt><dd><tt>Print&nbsp;information</tt></dd></dl>
  46. <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>
  47. <dl><dt><a name="Template-warning"><strong>warning</strong></a>(self, text)</dt><dd><tt>Prints&nbsp;a&nbsp;warning</tt></dd></dl>
  48. </td></tr></table> <p>
  49. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  50. <tr bgcolor="#ffc8d8">
  51. <td colspan=3 valign=bottom>&nbsp;<br>
  52. <font color="#000000" face="helvetica, arial"><a name="TemplateV2">class <strong>TemplateV2</strong></a>(<a href="template.html#Template">Template</a>)</font></td></tr>
  53. <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
  54. <td colspan=2><tt>Class&nbsp;for&nbsp;reading&nbsp;ATGv2&nbsp;templates.<br>
  55. &nbsp;<br>
  56. 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>
  57. ATGV2<br>
  58. followed&nbsp;by&nbsp;the&nbsp;info&nbsp;line:<br>
  59. [$KeyField$Extension$Prefix$Encoding$]<br>
  60. where<br>
  61. 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>
  62. Extension&nbsp;-&nbsp;is&nbsp;the&nbsp;desired&nbsp;extension&nbsp;for&nbsp;the&nbsp;generated&nbsp;files.<br>
  63. Prefix&nbsp;-&nbsp;is&nbsp;the&nbsp;desired&nbsp;filename&nbsp;prefix&nbsp;for&nbsp;the&nbsp;generated&nbsp;files<br>
  64. Encoding&nbsp;-&nbsp;is&nbsp;the&nbsp;desired&nbsp;encoding&nbsp;for&nbsp;the&nbsp;generated&nbsp;files.<br>
  65. The&nbsp;line&nbsp;may&nbsp;also&nbsp;have&nbsp;some&nbsp;optional&nbsp;keywords&nbsp;before&nbsp;the&nbsp;closing&nbsp;bracket:<br>
  66. oneFile$&nbsp;-&nbsp;place&nbsp;all&nbsp;generated&nbsp;text&nbsp;into&nbsp;a&nbsp;single&nbsp;file&nbsp;instead&nbsp;of<br>
  67. generating&nbsp;a&nbsp;file&nbsp;for&nbsp;each&nbsp;table&nbsp;row.<br>
  68. After&nbsp;the&nbsp;info&nbsp;line,&nbsp;you&nbsp;can&nbsp;put&nbsp;your&nbsp;text.<br>
  69. You&nbsp;can&nbsp;use&nbsp;following&nbsp;commands&nbsp;to&nbsp;handle&nbsp;the&nbsp;data:<br>
  70. *&nbsp;[$Name$],&nbsp;where&nbsp;Name&nbsp;is&nbsp;the&nbsp;column&nbsp;header,<br>
  71. will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;value&nbsp;from&nbsp;the&nbsp;current&nbsp;row.<br>
  72. *&nbsp;[$ATGLINDEX$]&nbsp;will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;number&nbsp;of&nbsp;a&nbsp;current&nbsp;row.<br>
  73. *&nbsp;[$ATGHEADER$Text$]&nbsp;and&nbsp;[$ATGFOOTER$Text$]&nbsp;will&nbsp;place&nbsp;the&nbsp;given&nbsp;text<br>
  74. 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>
  75. commands&nbsp;in&nbsp;this&nbsp;text.<br>
  76. *&nbsp;[$ATGLIST$Name$Text$],&nbsp;where&nbsp;Name&nbsp;is&nbsp;a&nbsp;multi-column&nbsp;header<br>
  77. (i.e.&nbsp;'Col'&nbsp;will&nbsp;represent&nbsp;'Col1',&nbsp;'Col2',&nbsp;'Col3'&nbsp;etc)<br>
  78. will&nbsp;repeat&nbsp;the&nbsp;given&nbsp;text&nbsp;for&nbsp;each&nbsp;non-empty&nbsp;value.<br>
  79. You&nbsp;can&nbsp;use&nbsp;other&nbsp;commands&nbsp;in&nbsp;Text.&nbsp;Also&nbsp;[$Name$]&nbsp;inside&nbsp;the&nbsp;list<br>
  80. will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;value&nbsp;for&nbsp;the&nbsp;current&nbsp;row&nbsp;and&nbsp;column.<br>
  81. *&nbsp;[$ATGLINDEX$]&nbsp;can&nbsp;be&nbsp;used&nbsp;only&nbsp;inside&nbsp;the&nbsp;ATGLIST&nbsp;text,<br>
  82. will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;current&nbsp;column&nbsp;index.<br>
  83. *&nbsp;[$ATGLISTCUT$Name$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGLIST,&nbsp;but&nbsp;the&nbsp;last&nbsp;symbol<br>
  84. will&nbsp;be&nbsp;removed.&nbsp;Useful&nbsp;for&nbsp;removing&nbsp;unnecessary&nbsp;newlines.<br>
  85. *&nbsp;[$ATGIF$Name$Value$Text$]&nbsp;will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;given&nbsp;text<br>
  86. 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>
  87. Will&nbsp;be&nbsp;replaced&nbsp;with&nbsp;the&nbsp;empty&nbsp;text&nbsp;otherwise.&nbsp;You&nbsp;can&nbsp;use&nbsp;other<br>
  88. commands&nbsp;in&nbsp;Text.<br>
  89. *&nbsp;[$ATGIFNOT$Name$Value$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGIF,&nbsp;but&nbsp;the&nbsp;column's&nbsp;value<br>
  90. should&nbsp;not&nbsp;be&nbsp;equal&nbsp;to&nbsp;the&nbsp;given&nbsp;one.<br>
  91. *&nbsp;[$ATGGREATER$Name$Value$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGIF,&nbsp;but&nbsp;the&nbsp;value&nbsp;should<br>
  92. be&nbsp;the&nbsp;number&nbsp;and&nbsp;it&nbsp;should&nbsp;be&nbsp;greater&nbsp;then&nbsp;the&nbsp;given&nbsp;one.<br>
  93. *&nbsp;[$ATGGREATER$Name$Value$Text$]&nbsp;-&nbsp;same&nbsp;as&nbsp;ATGGREATER,&nbsp;but&nbsp;the&nbsp;value<br>
  94. should&nbsp;be&nbsp;less&nbsp;then&nbsp;the&nbsp;given&nbsp;one.<br>
  95. *&nbsp;[$ATGREPLACE$Text1$Text2$]&nbsp;-&nbsp;Will&nbsp;replace&nbsp;Text1&nbsp;with&nbsp;Text2.&nbsp;Replacements<br>
  96. 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>
  97. other&nbsp;commands&nbsp;in&nbsp;the&nbsp;text.<br>
  98. *&nbsp;[$ATGPREFIX$Text$]&nbsp;-&nbsp;Will&nbsp;add&nbsp;the&nbsp;given&nbsp;text&nbsp;to&nbsp;the&nbsp;filename&nbsp;prefix.<br>
  99. You&nbsp;can&nbsp;use&nbsp;other&nbsp;commands&nbsp;in&nbsp;text,&nbsp;but&nbsp;do&nbsp;it&nbsp;carefully.<br>
  100. *&nbsp;[$ATGSKIP$]&nbsp;-&nbsp;Skip&nbsp;the&nbsp;current&nbsp;row.&nbsp;Use&nbsp;only&nbsp;in&nbsp;combination&nbsp;with&nbsp;the<br>
  101. ATGIF/ATGIFNOT,&nbsp;or&nbsp;you&nbsp;will&nbsp;generate&nbsp;nothing.<br>
  102. *&nbsp;[$ATGPREV$Name$],&nbsp;where&nbsp;Name&nbsp;is&nbsp;the&nbsp;column&nbsp;header,<br>
  103. 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>
  104. previous&nbsp;row.&nbsp;ATGSKIP&nbsp;will&nbsp;be&nbsp;used&nbsp;for&nbsp;the&nbsp;first&nbsp;row.<br>&nbsp;</tt></td></tr>
  105. <tr><td>&nbsp;</td>
  106. <td width="100%">Methods defined here:<br>
  107. <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>
  108. &nbsp;<br>
  109. filename&nbsp;-&nbsp;name&nbsp;of&nbsp;the&nbsp;ATGv2&nbsp;template&nbsp;file.<br>
  110. encoding&nbsp;-&nbsp;encoding&nbsp;of&nbsp;the&nbsp;template&nbsp;file.<br>
  111. text&nbsp;-&nbsp;text&nbsp;to&nbsp;use&nbsp;if&nbsp;no&nbsp;filename&nbsp;has&nbsp;been&nbsp;provided.</tt></dd></dl>
  112. <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>
  113. <hr>
  114. Static methods defined here:<br>
  115. <dl><dt><a name="TemplateV2-express"><strong>express</strong></a>(cls, text, **kwargs)</dt></dl>
  116. <hr>
  117. Methods inherited from <a href="template.html#Template">Template</a>:<br>
  118. <dl><dt><a name="TemplateV2-log"><strong>log</strong></a>(self, text)</dt><dd><tt>Print&nbsp;information</tt></dd></dl>
  119. <dl><dt><a name="TemplateV2-warning"><strong>warning</strong></a>(self, text)</dt><dd><tt>Prints&nbsp;a&nbsp;warning</tt></dd></dl>
  120. </td></tr></table></td></tr></table>
  121. </body></html>