AkelPad Forum Index AkelPad
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Template loses first line

 
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English)
View previous topic :: View next topic  
Author Message
Akuro



Joined: 27 Mar 2015
Posts: 47

PostPosted: Sun May 22, 2016 6:12 pm    Post subject: Template loses first line Reply with quote

What I did:
Placed a small text file (UTF-8, no BOM) - into the template-folder.

What happens:
I generate a new file from this "template" - from within Akelpad
But the first line is missing. Is this on purpose?
Anything I am doing wrong?
Back to top
View user's profile Send private message
FeyFre



Joined: 07 Aug 2007
Posts: 2209
Location: Vinnitsa, Ukraine

PostPosted: Mon May 23, 2016 6:13 am    Post subject: Reply with quote

Akuro
Yes, it is. First string will contain "caret placeholder". When you create new document from template you may want set caret into specific position of template. For this purpose exists "caret placeholder" - the sequence of characters. During creation of new file plugin will remove all entries of "caret placeholder" from template text and place caret into position of first entry of it in template text. All built-in templates are use this feature.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Akuro



Joined: 27 Mar 2015
Posts: 47

PostPosted: Mon May 23, 2016 10:10 am    Post subject: Reply with quote

Thank you FeyFre,

Actually, I was wondering whether I could make Akelpad remember the caret position. Can you tell me how to enter that information into a template? Or point me to resources explaining it?
Back to top
View user's profile Send private message
FeyFre



Joined: 07 Aug 2007
Posts: 2209
Location: Vinnitsa, Ukraine

PostPosted: Mon May 23, 2016 2:25 pm    Post subject: Reply with quote

Akuro
Here is example, which is included in distribution:html4s.html
Code:
<!--CARET-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
   <head>
      <title><!--CARET--></title>
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
   </head>
   <body>

   </body>
</html>
As you can see, first line of file is "<!--CARET-->". It is "caret placeholder". Then, line 5. "<title><!--CARET--></title>". Template plugin will insert text of template file into editor(w/o 1st line), then it will search for all entries of "<!--CARET-->" in inserted text, and remove them. Next it will set care position to 1st entry of "<!--CARET-->" - inside title tags, so you ready to enter title of page.



IF you want remember position of caret in files you edit, you should enable it in settings: Setting -> Registry -> Recent files -> Remember caret position. It is built-in into AkelPad function, independent of any plugins.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Akuro



Joined: 27 Mar 2015
Posts: 47

PostPosted: Mon May 23, 2016 8:10 pm    Post subject: Reply with quote

FeyFre
Thanks a ton for the explanation.
The option is enabled in Settings -> Registry -> Recent files ->
But I cannot get it to work to remember/ store the wanted caret-position. Prbably because it is not an htm-file, but a plain text file (snippet file, but really nothing but plain text). Oh well,,,,
Back to top
View user's profile Send private message
FeyFre



Joined: 07 Aug 2007
Posts: 2209
Location: Vinnitsa, Ukraine

PostPosted: Mon May 23, 2016 10:01 pm    Post subject: Reply with quote

IF we still talking about Templates, then: you must manually specify caret placeholder in template file. And it can be file of any type/content.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Akuro



Joined: 27 Mar 2015
Posts: 47

PostPosted: Tue May 24, 2016 12:09 am    Post subject: Reply with quote

Ha, now it works. Don't know what went wrong on the first go-around.

Well, anyway, thanks again, FeyFre. I really appreciate it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


SourceForge.net Logo Powered by phpBB © 2001, 2005 phpBB Group