|
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <html><head><title>Python: module ktt.template</title>
- </head><body bgcolor="#f0f0f8">
-
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
- <tr bgcolor="#7799ee">
- <td valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="ktt.html"><font color="#ffffff">ktt</font></a>.template</strong></big></big></font></td
- ><td align=right valign=bottom
- ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/kaisd/Мастерская/projects/KTT/ktt/template.py">/home/kaisd/Мастерская/projects/KTT/ktt/template.py</a></font></td></tr></table>
- <p><tt><a href="#Template">Template</a> module for a KaiSD Text Tools.<br>
- <br>
- (c) 2013 Ivan "Kai SD" Korystin <br>
- <br>
- License: GPLv3</tt></p>
- <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#aa55cc">
- <td colspan=3 valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
-
- <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
- <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="re.html">re</a><br>
- </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>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ee77aa">
- <td colspan=3 valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
-
- <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
- <td width="100%"><dl>
- <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
- </font></dt><dd>
- <dl>
- <dt><font face="helvetica, arial"><a href="ktt.template.html#Template">Template</a>
- </font></dt><dd>
- <dl>
- <dt><font face="helvetica, arial"><a href="ktt.template.html#TemplateV2">TemplateV2</a>
- </font></dt></dl>
- </dd>
- </dl>
- </dd>
- </dl>
- <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ffc8d8">
- <td colspan=3 valign=bottom> <br>
- <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>
-
- <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
- <td colspan=2><tt>Empty template class. Generates empty text.<br> </tt></td></tr>
- <tr><td> </td>
- <td width="100%">Methods defined here:<br>
- <dl><dt><a name="Template-log"><strong>log</strong></a>(self, text)</dt><dd><tt>Print information</tt></dd></dl>
-
- <dl><dt><a name="Template-process"><strong>process</strong></a>(self, data)</dt><dd><tt>Replace this method in subclasses.</tt></dd></dl>
-
- <dl><dt><a name="Template-warning"><strong>warning</strong></a>(self, text)</dt><dd><tt>Prints a warning</tt></dd></dl>
-
- <hr>
- Data descriptors defined here:<br>
- <dl><dt><strong>__dict__</strong></dt>
- <dd><tt>dictionary for instance variables (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>__weakref__</strong></dt>
- <dd><tt>list of weak references to the object (if defined)</tt></dd>
- </dl>
- </td></tr></table> <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#ffc8d8">
- <td colspan=3 valign=bottom> <br>
- <font color="#000000" face="helvetica, arial"><a name="TemplateV2">class <strong>TemplateV2</strong></a>(<a href="ktt.template.html#Template">Template</a>)</font></td></tr>
-
- <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
- <td colspan=2><tt>Class for reading ATGv2 templates.<br>
- <br>
- ATGv2 template file should be a plain text file, starting with the line<br>
- ATGV2<br>
- followed by the info line:<br>
- [$KeyField$Extension$Prefix$Encoding$]<br>
- where<br>
- KeyField - is a name of a data column, that contains an identifier.<br>
- Extension - is the desired extension for the generated files.<br>
- Prefix - is the desired filename prefix for the generated files<br>
- Encoding - is the desired encoding for the generated files.<br>
- The line may also have some optional keywords before the closing bracket:<br>
- oneFile$ - place all generated text into a single file instead of<br>
- generating a file for each table row.<br>
- After the info line, you can put your text.<br>
- You can use following commands to handle the data:<br>
- * [$Name$], where Name is the column header,<br>
- will be replaced with value from the current row.<br>
- * [$ATGLINDEX$] will be replaced with the number of a current row.<br>
- * [$ATGHEADER$Text$] and [$ATGFOOTER$Text$] will place the given text<br>
- at the begining or at the end of the file. You can't use other<br>
- commands in this text.<br>
- * [$ATGLIST$Name$Text$], where Name is a multi-column header<br>
- (i.e. 'Col' will represent 'Col1', 'Col2', 'Col3' etc)<br>
- will repeat the given text for each non-empty value.<br>
- You can use other commands in Text. Also [$Name$] inside the list<br>
- will be replaced with the value for the current row and column.<br>
- * [$ATGLINDEX$] can be used only inside the ATGLIST text,<br>
- will be replaced with the current column index.<br>
- * [$ATGLISTCUT$Name$Text$] - same as ATGLIST, but the last symbol<br>
- will be removed. Useful for removing unnecessary newlines.<br>
- * [$ATGIF$Name$Value$Text$] will be replaced with the given text<br>
- only if the the given column's value is the same as the given one.<br>
- Will be replaced with the empty text otherwise. You can use other<br>
- commands in Text.<br>
- * [$ATGIFNOT$Name$Value$Text$] - same as ATGIF, but the column's value<br>
- should not be equal to the given one.<br>
- * [$ATGGREATER$Name$Value$Text$] - same as ATGIF, but the value should<br>
- be the number and it should be greater then the given one.<br>
- * [$ATGGREATER$Name$Value$Text$] - same as ATGGREATER, but the value<br>
- should be less then the given one.<br>
- * [$ATGREPLACE$Text1$Text2$] - Will replace Text1 with Text2. Replacements<br>
- will be done after all other commands. You can't use regular expressions or<br>
- other commands in the text.<br>
- * [$ATGPREFIX$Text$] - Will add the given text to the filename prefix.<br>
- You can use other commands in text, but do it carefully.<br>
- * [$ATGSKIP$] - Skip the current row. Use only in combination with the<br>
- ATGIF/ATGIFNOT, or you will generate nothing.<br>
- * [$ATGPREV$Name$], where Name is the column header,<br>
- will be replaced with the with the value of the given header from the<br>
- previous row. ATGSKIP will be used for the first row.<br> </tt></td></tr>
- <tr><td> </td>
- <td width="100%"><dl><dt>Method resolution order:</dt>
- <dd><a href="ktt.template.html#TemplateV2">TemplateV2</a></dd>
- <dd><a href="ktt.template.html#Template">Template</a></dd>
- <dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
- </dl>
- <hr>
- Methods defined here:<br>
- <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>
- <br>
- filename - name of the ATGv2 template file.<br>
- encoding - encoding of the template file.<br>
- text - text to use if no filename has been provided.</tt></dd></dl>
-
- <dl><dt><a name="TemplateV2-process"><strong>process</strong></a>(self, data)</dt><dd><tt>Generate text for the given data.</tt></dd></dl>
-
- <hr>
- Static methods defined here:<br>
- <dl><dt><a name="TemplateV2-express"><strong>express</strong></a>(cls, text, **kwargs)</dt></dl>
-
- <hr>
- Methods inherited from <a href="ktt.template.html#Template">Template</a>:<br>
- <dl><dt><a name="TemplateV2-log"><strong>log</strong></a>(self, text)</dt><dd><tt>Print information</tt></dd></dl>
-
- <dl><dt><a name="TemplateV2-warning"><strong>warning</strong></a>(self, text)</dt><dd><tt>Prints a warning</tt></dd></dl>
-
- <hr>
- Data descriptors inherited from <a href="ktt.template.html#Template">Template</a>:<br>
- <dl><dt><strong>__dict__</strong></dt>
- <dd><tt>dictionary for instance variables (if defined)</tt></dd>
- </dl>
- <dl><dt><strong>__weakref__</strong></dt>
- <dd><tt>list of weak references to the object (if defined)</tt></dd>
- </dl>
- </td></tr></table></td></tr></table>
- </body></html>
|