011fcde8ea
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1551 ea778897-0a13-0410-b9d1-a72fbfd435f5
79 lines
9.1 KiB
HTML
79 lines
9.1 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Templates</title><link rel="stylesheet" href="geany.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="index.html" title="Geany 0.11"><link rel="up" href="ch04.html" title="Chapter 4. Configuration files"><link rel="prev" href="ch04s02.html" title="Filetype extensions"><link rel="next" href="apa.html" title="Appendix A. Contributing to this document"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Templates</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Configuration files</th><td width="20%" align="right"> <a accesskey="n" href="apa.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="templates"></a>Templates</h2></div></div></div><p>
|
||
<span class="application">Geany</span> supports the following templates:
|
||
</p><div class="itemizedlist"><ul type="disc"><li><p>ChangeLog entry</p></li><li><p>File header</p></li><li><p>Function description</p></li><li><p>Short GPL notice</p></li><li><p>Short BSD notice</p></li><li><p>Filetype template</p></li></ul></div><p>
|
||
To use these templates, just open the Edit menu or open the
|
||
popup menu by right-clicking in the editor widget, and choose "Insert Comments" and
|
||
insert templates as you want.
|
||
</p><p>
|
||
Some templates (like File header or ChangeLog entry) will always be inserted at the
|
||
top of the file.
|
||
</p><p>
|
||
To insert a function description, the cursor must be inside of the function, so that
|
||
the function name can be determined automatically. The description will be positioned
|
||
correctly one line above the function, just check it out. If the cursor is not inside
|
||
of a function or the function name cannot be determined, you cannot insert a function
|
||
description.
|
||
</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2814807"></a>Template metadata</h3></div></div></div><p>
|
||
Metadata can be used with all templates, but by default user set metadata is only
|
||
used for the ChangeLog and File header templates.
|
||
</p><p>
|
||
In the configuration dialog you can find a tab "Templates"
|
||
(see <a href="ch03s08.html#prefs_templ" title="Figure 3.10. Template tab in preferences dialog">Figure 3.10, “Template tab in preferences dialog”</a>). You can define the default values which
|
||
will be inserted in the templates. You should restart <span class="application">Geany</span>
|
||
after making changes, because they are only read at startup.
|
||
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2814839"></a>Filetype templates</h3></div></div></div><p>
|
||
Filetype templates are templates used as the basis of a new file. To use them, choose
|
||
the <span class="emphasis"><em>New (with Template)</em></span> menu item from the
|
||
<span class="emphasis"><em>File</em></span> menu.
|
||
</p><p>
|
||
By default, templates are created for some filetypes. Other filetype templates can be
|
||
added by creating the appropriate template file and restarting
|
||
<span class="application">Geany</span>. You can also edit the default filetype templates.
|
||
</p><p>
|
||
Filetype template files are read from the <code class="filename">~/.geany/templates</code>
|
||
directory, and are named '<code class="filename">filetype.</code>'
|
||
followed by the filetype name, e.g. <code class="filename">filetype.python</code>,
|
||
<code class="filename">filetype.sh</code>. If you are unsure about the filetype name extensions,
|
||
they are the same as the filetype configuration file extensions, commonly installed
|
||
in <code class="filename">/usr/share/geany</code>, with the prefix
|
||
'<code class="filename">filetypes.</code>'.
|
||
</p><p>
|
||
The file's contents are just the text to place in the document, except for the
|
||
optional <code class="literal">{fileheader}</code> template wildcard. This can be placed anywhere,
|
||
but is usually on the first line of the file, followed by a blank line.
|
||
</p><p>
|
||
There is also a template file <code class="filename">template.none</code> which is used when
|
||
the <span class="emphasis"><em>New</em></span> command is used without a filetype. This is empty by
|
||
default.
|
||
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2814943"></a>Customizing templates</h3></div></div></div><p>
|
||
Each template can be customized to your needs. The templates are stored in the
|
||
<code class="filename">~/.geany/templates/</code> directory (see <a href="ch03s02.html" title="Command line options">the section called “Command line options”</a>
|
||
for further information about the configuration directory). Just open the desired
|
||
template with an editor (ideally <span class="application">Geany</span> ;-) ) and edit
|
||
the template to your needs. There are some wildcards which will be automatically
|
||
replaced by <span class="application">Geany</span> at startup.
|
||
</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2814982"></a>Template wildcards</h4></div></div></div><p>
|
||
All wildcards must be enclosed by "{" and "}", e.g. {date}.
|
||
</p><p>
|
||
</p><div class="table"><a name="id2814994"></a><p class="title"><b>Table 4.4. Template wildcards</b></p><div class="table-contents"><table summary="Template wildcards" cellspacing="0" cellpadding="4" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Wildcard</th><th>Description</th><th>Available in following templates</th></tr></thead><tbody><tr><td>developer</td><td>The name of the developer.</td><td>filetypes, file header, function description, ChangeLog entry,
|
||
bsd, gpl</td></tr><tr><td>initial</td><td>The developer's initials, e.g. "ET" for
|
||
Enrico Tröger or "JFD" for John Foobar Doe.</td><td>filetypes, file header, function description, ChangeLog entry,
|
||
bsd, gpl</td></tr><tr><td>mail</td><td>The email address of the developer.</td><td>file header, function description, ChangeLog entry,
|
||
bsd, gpl</td></tr><tr><td>company</td><td>The company the developer is working for.</td><td>filetypes, file header, function description, ChangeLog entry,
|
||
bsd, gpl</td></tr><tr><td>year</td><td>The current year in the format: YYYY</td><td>filetypes, file header, function description, ChangeLog entry,
|
||
bsd, gpl</td></tr><tr><td>version</td><td>The initial version of a new file.</td><td>filetypes, file header, function description, ChangeLog entry,
|
||
bsd, gpl</td></tr><tr><td>date</td><td>The current date in the format: YYYY-MM-DD</td><td>filetypes, file header, function description, ChangeLog entry,
|
||
bsd, gpl</td></tr><tr><td>untitled</td><td>The string "untitled" (this will be translated to your locale),
|
||
used in filetype templates</td><td>filetypes, file header, function description, ChangeLog entry,
|
||
bsd, gpl</td></tr><tr><td>geanyversion</td><td>The actual <span class="application">Geany</span> version,
|
||
e.g. "Geany 0.11"
|
||
</td><td>filetypes, file header, function description, ChangeLog entry,
|
||
bsd, gpl</td></tr><tr><td>datetime</td><td>The current date and time in the format: DD.MM.YYYY HH:mm:ss ZZZZ</td><td>file header, function description</td></tr><tr><td>filename</td><td>The filename of the current file. Only available for the file header template.</td><td>file header</td></tr><tr><td>gpl</td><td>This wildcard inserts a short GPL notice.</td><td>file header</td></tr><tr><td>bsd</td><td>This wildcard inserts a short BSD licence notice.</td><td>file header</td></tr><tr><td>functionname</td><td>The function name of the function at the cursor position.
|
||
This wildcard will only be replaced in the function
|
||
description template.</td><td>function description</td></tr><tr><td>fileheader</td><td>The file header template.
|
||
This wildcard will only be replaced in filetype
|
||
templates.</td><td>filetypes</td></tr></tbody></table></div></div><p><br class="table-break">
|
||
If you need any other wildcards or a special date/time format, please email the
|
||
author <code class="email"><<a href="mailto:enrico.troeger@uvena.de">enrico.troeger@uvena.de</a>></code>.
|
||
</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch04.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="apa.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Filetype extensions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix A. Contributing to this document</td></tr></table></div></body></html>
|