How do I adjust the Content Completion feature?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
deannelson
Posts: 7
Joined: Thu Jun 01, 2006 11:38 pm

How do I adjust the Content Completion feature?

Post by deannelson »

Hello,
I would like to adjust the content completion feature when it puts an itemized list tag set in Docbook. Right now it comes up with something like this:

Code: Select all


<itemizedlist>
<listitem></listitem>
</itemizedlist>
I would like it to actually fill in the <para> tags also, since that will be my mode for 99% of the time, like this:

Code: Select all


<itemizedlist>
<listitem><para></para></listitem>
</itemizedlist>
So how can I make this happen? I assume there is template file somewhere or does it actually get all of the fill-in stuff from the DTD?

Thanks,
Dean Nelson
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Dean,

It gets all the stuff from the DTD or schema :), the support is generic and works in the same way with any DTD or schema.
Anyway, there are more that the proposals that are gathered from the DTD or schema that are presented in the content completion window. oXygen has also support for *abbreviations* or *code templates*. These are fragments of code plus the place where the caret position should be placed associated with a name. Then you can type in a prefix of the name followed by CTRL+Space and you will get all the code templates whose names start with that prefix. For instance you can go to Options->Preferences -- Editor -- Code Templates and define a new template as follows:

Click on New button
For Name enter ilp
For Description enter Enter itemizedlist/listitem/para.
Associate with XML Editor
Content

Code: Select all


<itemizedlist>
<listitem><para>${caret}</para></listitem>
</itemizedlist>
Click Ok to finish the addition.
Click Ok to apply the changes and close the preferences dialog.

After that if you type when you edit a file

ilp

followed by CTRL+Enter you will end up with

Code: Select all


        <itemizedlist>
<listitem><para>|</para></listitem>
</itemizedlist>
entered in the file and properly indented, and the caret placed inside the para element, | above stands for the caret position.

Best Regards,
George
George Cristian Bina
deannelson
Posts: 7
Joined: Thu Jun 01, 2006 11:38 pm

Post by deannelson »

Thanks George!

I do have a remotely related question in dealing with the docbook DTD that OXYGEN references during onscreen validation.

When I have a <sectioninfo> included in a <section>, immediately following the section title the onscreen validation flags this as a no-no but when I run/build the document the tools do not complain about this. The section below illustrates the order that I use:

Code: Select all


<section> <title>This is a section Title</title>
<sectioninfo>
<corpauthor>Dean Nelson</corpauthor>
<corpname>EEC</corpname>
<date> Oct 23, 2006</date>
</sectioninfo>
<para> ..stuff.. </para>

</section>
But if I move the title to below the secioninfo everything validates.

Why?

Dean Nelson
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi,

If you click on the section element and then look into the oXygen Model View then you will see that the model for section starts like below:

(sectioninfo?,(title,subtitle?,titleabbrev?),...

That is, a section can start with optionally a sectioninfo as the first element, then there is a required title element and optionally subtitle and a titleabbrev elements.

So a valid document always contains sectioninfo before title.

Now the stylesheets that process the document may not be very sensitive to the order of elements, imagine for instance that you match on section then you output the title and apply templates on sectioninfo - this will have the same result no matter the order of title and sectioninfo inside section.

Best Regards,
George
George Cristian Bina
deannelson
Posts: 7
Joined: Thu Jun 01, 2006 11:38 pm

Post by deannelson »

Thanks! I guess I'd better look closer at the DTD.
Post Reply