Is it possible to create personal templates and have them show up on the dropdown list under the "New" selection on the menu?
Lee
On 07/17/2007 09:37:47 PM, Lee Underwood wrote:
Is it possible to create personal templates and have them show up on the dropdown list under the "New" selection on the menu?
If you mean one template per filetype, then yes, see: http://geany.uvena.de/manual/ch04s04.html#id2815287
Although for now you have to restart Geany after adding a new filetype template, or editing an existing one.
Regards, Nick
On Wed, 18 Jul 2007 12:24:09 +0100 Nick Treleaven nick.treleaven@btinternet.com wrote:
| On 07/17/2007 09:37:47 PM, Lee Underwood wrote: | > Is it possible to create personal templates and have them show up on the dropdown list under the "New" selection on the menu? | > | If you mean one template per filetype, then yes, see: | http://geany.uvena.de/manual/ch04s04.html#id2815287 | | Although for now you have to restart Geany after adding a new filetype template, or editing an existing one. | | Regards, | Nick
Actually, I don't mean filetype templates. I mean a template for a page layout, e.g., a certain type of template for an article, one for news..
Lee
On 07/18/2007 01:59:59 PM, Lee Underwood wrote:
On Wed, 18 Jul 2007 12:24:09 +0100 Nick Treleaven nick.treleaven@btinternet.com wrote:
| On 07/17/2007 09:37:47 PM, Lee Underwood wrote: | > Is it possible to create personal templates and have them show up on the dropdown list under the "New" selection on the menu? | > | If you mean one template per filetype, then yes, see: | http://geany.uvena.de/manual/ch04s04.html#id2815287 | | Although for now you have to restart Geany after adding a new filetype template, or editing an existing one. | | Regards, | Nick
Actually, I don't mean filetype templates. I mean a template for a page layout, e.g., a certain type of template for an article, one for news..
Not at the moment, but I like the idea. It will probably be added sometime.
Regards, Nick
On Wed, 18 Jul 2007 08:59:59 -0400, Lee Underwood leeu@cfl.rr.com wrote:
On Wed, 18 Jul 2007 12:24:09 +0100 Nick Treleaven nick.treleaven@btinternet.com wrote:
| On 07/17/2007 09:37:47 PM, Lee Underwood wrote: | > Is it possible to create personal templates and have them show up | > on the dropdown list under the "New" selection on the menu? | > | If you mean one template per filetype, then yes, see: | http://geany.uvena.de/manual/ch04s04.html#id2815287 | | Although for now you have to restart Geany after adding a new | filetype template, or editing an existing one. | | Regards, | Nick
Actually, I don't mean filetype templates. I mean a template for a page layout, e.g., a certain type of template for an article, one for news..
As Nick mentioned it isn't really possible at the moment. But it would be a good reason for another plugin ;-).
As a workaround, admittedly a bit ugly, you could use an auto completion for this. Again, this is ugly and should be only used for temporary usage.
Please read http://geany.uvena.de/manual/ch03s05.html#editing_cc for general usage of custom auto completions. Then open the file ~/.geany/autocompletions.conf and find the default section. Add a line like the following one: news=18.07.2007 - enrico - Test subject\nThis is an example news entry without any content.\nEdit this as needed.
All the above must be in one line. After Geany was restarted you can type "news" and after pressing TAB Geany will replace news with the text defined for the news key.
Regards, Enrico
On Wed, 18 Jul 2007 18:35:00 +0200 Enrico Tröger enrico.troeger@uvena.de wrote:
| Please read http://geany.uvena.de/manual/ch03s05.html#editing_cc for | general usage of custom auto completions. | Then open the file ~/.geany/autocompletions.conf and find the default | section. Add a line like the following one: | news=18.07.2007 - enrico - Test subject\nThis is an example news entry | without any content.\nEdit this as needed. | | All the above must be in one line. After Geany was restarted you can | type "news" and after pressing TAB Geany will replace news with the | text defined for the news key. | | Regards, | Enrico
I agree it would be a bit ugly. But I do want to use the autocomplete feature for other things. However, I don't have a file called "autocompletions.conf" or "autocomplete.conf" in either ~/.geany or /usr/local/share/geany/. Any idea where it might be? I am using Ubuntu 7.04 and checked everything under my user name and under /usr.
Lee
On Wed, 18 Jul 2007 12:59:04 -0400, Lee Underwood leeu@cfl.rr.com wrote:
On Wed, 18 Jul 2007 18:35:00 +0200 Enrico Tröger enrico.troeger@uvena.de wrote:
| Please read http://geany.uvena.de/manual/ch03s05.html#editing_cc for | general usage of custom auto completions. | Then open the file ~/.geany/autocompletions.conf and find the | default section. Add a line like the following one: | news=18.07.2007 - enrico - Test subject\nThis is an example news | entry without any content.\nEdit this as needed. | | All the above must be in one line. After Geany was restarted you can | type "news" and after pressing TAB Geany will replace news with the | text defined for the news key. | | Regards, | Enrico
I agree it would be a bit ugly. But I do want to use the autocomplete feature for other things. However, I don't have a file called "autocompletions.conf" or "autocomplete.conf" in either ~/.geany or /usr/local/share/geany/. Any idea where it might be? I am using Ubuntu 7.04 and checked everything under my user name and under /usr.
Oops, I should have mentioned this is only possible with the SVN version of Geany (revision should be greater than 1628). Geany 0.11 doesn't have this feature ;-(.
Regards, Enrico
On Wed, 18 Jul 2007 19:31:46 +0200 Enrico Tröger enrico.troeger@uvena.de wrote:
| Oops, I should have mentioned this is only possible with the SVN | version of Geany (revision should be greater than 1628). | Geany 0.11 doesn't have this feature ;-(. | | Regards, | Enrico |
Do you know when it will be available? I have 0.10.2 (downloaded using Ubuntu's Synaptic Manager)
Lee
On 7/18/07, Lee Underwood leeu@cfl.rr.com wrote:
I agree it would be a bit ugly.
Here's another bit of ugliness....
Maybe you could use the "Edit->Format->Send Selection" feature.
First, assign a custom command: Edit->Format->Send Selection To->Set Custom Commands...
And use something like "cat ~/my-template.txt" for the command.
You need to have something selected for this to work, but just typing a [space] in an empty document and selecting it should work.
Then just press Ctrl+1 (by default, or whatever hotkey you assign)
That sounds a little confusing - hope you can understand what I mean.
- Jeff
On 7/18/07, Enrico Tröger enrico.troeger@uvena.de wrote:
On Wed, 18 Jul 2007 08:59:59 -0400, Lee Underwood leeu@cfl.rr.com wrote:
On Wed, 18 Jul 2007 12:24:09 +0100 Nick Treleaven nick.treleaven@btinternet.com wrote:
| On 07/17/2007 09:37:47 PM, Lee Underwood wrote: | > Is it possible to create personal templates and have them show up | > on the dropdown list under the "New" selection on the menu? | > | [snip]
Actually, I don't mean filetype templates. I mean a template for a page layout, e.g., a certain type of template for an article, one for news..
As Nick mentioned it isn't really possible at the moment. But it would be a good reason for another plugin ;-).
Here's a trick you might use: save the following script as "article_template.py":
=== snip ================================= #!/usr/bin/env python
# Usage: Select one line in Geany that looks like this: # # title text;subtitle text;author;date # # and pipe it through this script.
import sys text = sys.stdin.read()
title, subtitle, author, date = text.split(';')
title_lines = (len(title) + 2) * '=' subtitle_underline = len(subtitle) * '-'
template = '''%(thick)s %(title)s %(thick)s
%(subt)s %(thin)s
:Author: %(a)s :Date: %(d)s
Article text goes here. ''' % {'thick': title_lines, 'title': title, 'subt': subtitle, 'thin': subtitle_underline, 'a': author, 'd': date}
print template === /snip =================================
Make that script executable (``chmod +x article_template.py``) and drop it into some bin directory on your $PATH.
Now go into Geany and do: "Edit --> Format --> Send selection to --> Set custom commands". Set this script to be activated by, say, Ctrl-1 (just put the name of the script into the field provided).
Now open a file and write out the following line:
Foo Today;Do we really need more Foo?;J.R. Hacker;July 18, 2007
While on that line, hit Shift-Alt-L to select the line, then Ctrl-1 to send it to article_template.py.
---John
P.S. -- to transform the resulting output to html, save the file (say, as article.txt), and convert it to html like so:
rst2html article.txt > article.html
(You'll need to install python-docutils for this to work.)
On 7/18/07, John Gabriele jmg3000@gmail.com wrote:
P.S. -- to transform the resulting output to html, save the file (say, as article.txt), and convert it to html like so:
rst2html article.txt > article.html
(You'll need to install python-docutils for this to work.)
Aside: article output should look like this: http://www.milliwatt-software.com/jmg/temp/article.html
---John
On 07/18/2007 05:35:00 PM, Enrico Tröger wrote:
On Wed, 18 Jul 2007 08:59:59 -0400, Lee Underwood leeu@cfl.rr.com wrote:
On Wed, 18 Jul 2007 12:24:09 +0100 Nick Treleaven nick.treleaven@btinternet.com wrote:
| On 07/17/2007 09:37:47 PM, Lee Underwood wrote: | > Is it possible to create personal templates and have them show
up
| > on the dropdown list under the "New" selection on the menu? | > | If you mean one template per filetype, then yes, see: | http://geany.uvena.de/manual/ch04s04.html#id2815287 | | Although for now you have to restart Geany after adding a new | filetype template, or editing an existing one. | | Regards, | Nick
Actually, I don't mean filetype templates. I mean a template for a page layout, e.g., a certain type of template for an article, one
for
news..
As Nick mentioned it isn't really possible at the moment. But it would be a good reason for another plugin ;-).
Maybe, but I think filetype templates and custom file templates are basically the same thing. As they would probably share code it might be best to keep them both together.
Regards, Nick