Just a quick report, following your email

> moved the first two lines below the hash line, but I'm out of time

That does seem to be part of the  problem.
Did that and I've now got a template
which works almost but not quite.
Template and output below the line at (a), (b)

The following wildcards work nicely
  {fileheader}, {datetime} and {geanyversion}
See lines 3, 4, 5

The following wild cards do not work
  {untitled} and (trying to get the full path)
  {command:readlink -f {ob}{untitled}{cb}}
See lines 2, 6

What is curious is that
{fileheader} → «foobar.pl» ; good (line 3 )
{untitled}   → «untitled»  ; bad (line 2)

RichardH

Using Geany ver 0.21 running under Ubuntu 12.04

---------------------------------------------
(a) Top six lines of template file (line numbers added)

#!/usr/bin/perl                      1
# This is file {untitled}            2
{fileheader}                         3
# Made {datetime}                    4
# By Geany version {geanyversion}    5
# file://{command:readlink -f {ob}{untitled}{cb}} 6

(b) Top part of Perl script made by that template
and saved as «foobar.pl»
Lines numbered as in the template

# #!/usr/bin/perl                     1
# This is file untitled               2
#  foobar.pl                          3
#
#  Copyright 2015 RCH <rch@Ubuntu>
#
#  This program is free software; ...
#  it under the terms of the GNU  ...
...etc..
# Made 10.11.2015 20:47:12 CET        4
# By Geany version Geany 0.21         5
# file:///home/rch/{obuntitled}}      6
... snip ...

--


On 11/10/2015 04:33 PM, Little Girl wrote:
> Hey there,
>
> I changed the title of this thread since we changed the topic. (:
>
> rch wrote:
>
>> 60840A_Geanyusers.txt
>> 10.11.2015 08:00:43 CET
>>
>>     Thats magic (see above two lines)
>
> Yeah, I've been having quite a bit of fun with them, too. (:
>
>>     Question:- Does this only work with template files
>>     that are empty except for the two lines
>>     {untitled}
>>     {date}
>>     ?
>
> Not at all. Check out all the wildcards here:
>
> http://www.geany.org/manual/current/index.html#templates
>
> At least one of them has a requirement (the filename wildcard must be
> in the first four lines of the template or it won't work), and you
> can read the descriptions of each one to find out more.
>
> I see you're using GNU/Linux (if this were Windows, a different
> command would need to be used below to get your username), so try
> this template:
>
> Title: {untitled}
> Date: {date}
>
> Hello world!
>
> This template was written by {command:whoami} and has been brought to
> you from within {geanyversion} for your viewing pleasure.
>
>>     I tried adding those two lines
>>     at top of my existing Perl template text.pl
>>     which is 240 lines long.
>>
>>     The new Perl file opens with the date
>>     already nicely filled in; it looks like this
>>
>>     untitled
>>     10.11.2015 08:11:12 CET
>>     #!/usr/bin/perl
>>     ...snip...
>>
>>     But when I save it using same procedure
>>     as for the txt file, the top line "untitled"
>>     does not change at all.
>
> That might be because you bumped the hash line (the one starting with
> #) down two lines. That needs to stay at the top of a perl script
> because that's where the system looks to try to find out what kind of
> file it's opening.
>
> I'm not sure if your modification of that file would work if you
> moved the first two lines below the hash line, but I'm out of time
> this morning. I'll check back later today to see how it went, though.
>
>>     Perhaps I'll need to learn some scripting [1]
>>     R
>> [1]
>>> Note that the mini script interface offers the option to save
>>> scripts and load them, and that's really powerful since the sky's
>>> the limit on what you can do to a file if you know how to script
>>> it. (:
>
> Yes, definitely. It's a blast, and you can start as small as you like
> and work your way up. If you can script, you can pretty well do
> anything on a computer. Now you just need to pick which language(s)
> you'd like to learn. Also, the command wildcard above will allow you
> to insert shell commands right into a template, so even if you start
> small and learn one new thing at a time, you can add those things
> into templates immediately. (:
>



_______________________________________________
Users mailing list
Users@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/users

Reply via email to