Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
config:templates [2019/10/15 16:16] – changed howto to config wesdeanconfig:templates [2019/10/24 21:03] (current) – typo fix wesdean
Line 1: Line 1:
-====== Templates ====== +====== General Template Information ======
- +
-{{tag>config}}+
  
 Templates are based on files stored in [[https://www.geany.org/manual/current/index.html#configuration-file-paths|Configuration file paths]].  Geany reads when they are saved or by selecting //Tools | Reload Configuration// except for file templates which are read when they are used to create a new file. Templates are based on files stored in [[https://www.geany.org/manual/current/index.html#configuration-file-paths|Configuration file paths]].  Geany reads when they are saved or by selecting //Tools | Reload Configuration// except for file templates which are read when they are used to create a new file.
 +
 +==== Automatic Comment Strings in Templates ====
 +
 +Most templates (fileheader, function, gpl, bsd) will automatically include the comment strings (e.g., '#' to start a shell script comment) when they are inserted; however, file templates and the changelog template do not include the strings to signal comments.  The exact comment strings are determined based on the filetype of the document into which they are being inserted.  By default, multi-line comments are preferred to single-line comments if both single- and multi-line comments are available.
  
 ==== File Templates ==== ==== File Templates ====
Line 24: Line 26:
 ==== File Header Templates ==== ==== File Header Templates ====
  
-File header templates are used at the top of files and may be included in an existing file (i.e., //Edit | Insert Comments | Insert File Header//).  File header templates do not include the strings used to start single-line comments (e.g., '#' in shell scripts) -- these are added when the file header is added using the strings to start single-line comments based on the filetype of the file being edited.+File header templates are used at the top of files and may be included in an existing file (i.e., //Edit | Insert Comments | Insert File Header//).  File header templates automatically include the strings used to start single-line comments (e.g., '#' in shell scripts) 
  
 Whereas there may be multiple file templates (e.g., templates for PHP files, HTML files, etc.), there is but one file header template. Whereas there may be multiple file templates (e.g., templates for PHP files, HTML files, etc.), there is but one file header template.
Line 39: Line 41:
 Function templates are used to document functions within a file and may be included in an existing file (i.e., //Edit | Insert Comments | Insert Function Description//).  Unlike file header templates, one must place the cursor inside of the function being described so that Geany knows which function to describe. Function templates are used to document functions within a file and may be included in an existing file (i.e., //Edit | Insert Comments | Insert Function Description//).  Unlike file header templates, one must place the cursor inside of the function being described so that Geany knows which function to describe.
  
-However, like file header templates, function templates do not include the strings to start single-line comments and there is only a single function template.+Like file header templates, there is only a single function template.
  
   * **system**: ''/usr/share/geany/templates/function''   * **system**: ''/usr/share/geany/templates/function''
Line 47: Line 49:
  
 There are two license templates included with Geany the short forms of the: GPL and BSD (3-Clause) licenses.  The content of these templates may be added to the current file at the location of the cursor (i.e., //Edit | Insert Comments | Insert GPL Notice// or //Edit | Insert Comments | Insert BSD License//). There are two license templates included with Geany the short forms of the: GPL and BSD (3-Clause) licenses.  The content of these templates may be added to the current file at the location of the cursor (i.e., //Edit | Insert Comments | Insert GPL Notice// or //Edit | Insert Comments | Insert BSD License//).
- 
-As with file header and function templates, the strings to start comments are added to the start of lines included in the license templates, as per the current document's filetype. 
  
 As with file header, and function, there is only a single changelog template. As with file header, and function, there is only a single changelog template.
Line 78: Line 78:
  
 Documentation from the Geany manual regarding templates is available at [[https://www.geany.org/manual/current/index.html#templates|Templates Documentation]] Documentation from the Geany manual regarding templates is available at [[https://www.geany.org/manual/current/index.html#templates|Templates Documentation]]
 +
 +{{tag>config}}
Print/export