Tech Tip!

   Using Kate to help speed up repetitive tasks.

Kate version 2.5 and above has a template feature that can save you lots of time if you have to create similar html pages, newsletters or emails on a weekly basis. The template feature has to be turned on by clicking on Settings >> Configure Kate >> Plugins and checking the box on the right next to Kate File Templates. Once activated you will have a new listing under Files >> New From Template where you can load the templates and under Settings you will have a new listing, Manage Templates, where you create and
   modify templates.

Manage Templates allows you to create new, edit or delete templates. It also allows you to upload or download templates from a Kate supported template repository. Managing existing templates is fairly straight forward but creating new ones can be frustrating. This is the method I use and have found to be the fastest but only because you rarely have to start over:

First create the contents of the template in Kate just like you would a normal file. After this is finished it is time to create an empty template. When the empty template is finished you will paste in the content you just created and save the template. Here is how you create the blank template:

In the Manage Template dialog box click on New. In the first window, "Choose Template Origin" You want to check "Start with an empty document" and click the "Next" button to go to the "Edit Template Properties" window.
   In that window you will find the following choices:

   Template:
This is the name that appears in the "Group" when you go to select a template to load. The button on the right lets you select an icon
          but I have not been able to find where it is displayed.

   Group:
          A Group is just like a folder.  It is a heading for similar
templates. If you want a new group just highlight the text in the box and type in the new name. The one you highlighted remains, it is
          not deleted.

   Document Name:
This is the name that appears as the file name inside Kate -- until
          you save the file.  Handy for making sure you have the right
          template.

   Highlight:
This sets the files highlighting type, HTML, CSS, Ruby, Python, etc... Click on "None" and search for the highlighting style you
          want.

   Description:
Since this only appears when you are editing the template file I assume it is for information you might want to know when editing the
          template.

   Author:
This is your name and email address and is automatically inserted.

After you finish filling out the above window, click on the "Next" button and in the "Choose Location" window select Template directory and enter a Template file name. Do not spaces or special characters, it is the file name that it will be stored under. When you are finished click on the "Next" button and go to the "Create Template" window and check "Open the template for editing" and click on the "Finish" button. This opens the template file for editing but you will need to close the final window of the
   "Manage Template" dialog since you are through with it.

The katetemplate: header is at the top of this file. This is where the information used to define the template is stored. It does not appear when you open a regular template only when you edit a template. Here is an
   example:

      katetemplate: Template=Template Group=Email_Responses
      Documentname=Documentname Highlight=HT&ML
      katetemplate: Author=Keith Daniels <[EMAIL PROTECTED]>
      katetemplate: Description=Description

Notice the & in HT&ML. That & is a bug in certain versions of Kate and you need to remove it from the "Highlight=" specification, it appears in all highlighting types. It should be just HTML or whatever highlighting type you selected. You can not get to the "Edit Template Properties" window when you edit an existing file. You have to edit the template itself and change the entries above. In creating the template I used the name of the text box
   and that is why it shows Template=Template, etc...

Everything else in the header should be fine and you can now copy and paste in the "template contents" you created earlier, right below the header and then close and save the file. To test it, open the template as described at the beginning and check that everything is the way you want it. If not go
   to the Manage Template window and edit the file.

   The main advantages of the Kate template feature Are:

* Finding templates is Fast! because they are built into the menu bar and
       don't have to be searched for in the file system.
* The first time you save the template it forces you to assign a file name - it does not overwrite your template - which is what always happens
       when you create your own set of templates.
* Highlighting works, even before you save the file and even if you do not give the file a standard extension like ".html" which helps prevent
       errors when filling in the template.

   Go to this site for more information:
http://docs.kde.org/stable/en/kdeaddons/kate-plugins/ filetemplates.html#k
   atefiletemplates-menu

       -- From TUX Webmaster Keith Daniels

     _________________________________________________________________

_______________________________________________
LUG mailing list
[email protected]
http://kym.net/mailman/listinfo/lug
%LUG is generously hosted by INFOCOM http://www.infocom.co.ug/

The above comments and data are owned by whoever posted them (including 
attachments if any). The List's Host is not responsible for them in any way.
---------------------------------------

Reply via email to