Extending Quanta

Chapter 5. Extending Quanta

This chapter describes how to customize Quanta to your particular needs and how you can help Quanta become better.

Creating Your Own Docs for Quanta

Probably the most notable additions to Quanta for the general user will be the addition of documentation for the markup or scripting language that you like best. To that end, this chapter will explain how I create the php documentation tree for my personal use.

Before starting on creating your own documentation, you may wish to check out the Quanta repository to see if someone else has already done this set.

There are two parts to this process. First, you must obtain the existing documentation for the markup/scripting/etc language that you're after. Second, you have to create the docrc file. The first is up to you, the second is what we'll cover here.

The general form of the docrc file is as follows:


#KDE Config File
[Tree]
Doc dir=<path, relative to this file, of the documentation html files> e.g. php42/
#top level elements
Top Element=<Your description for these docs> e.g. PHP 4.2 documentation

Section 1=Section1.html
Section 2=#Sec2.1,#Sec2.2,#Sec2.3
Sec2.1=Sec2.1.html
Sec2.2=Sec2.2.html
Sec2.3=Sec2.3.html
...

[Context]
ContextList=func1,func2,tag1,tag2,tag3
func1=func1.html
func2=func2.html
tag1=tag1.html
tag2=tag2.html
tag3=tag3.html

The docrc is broken down into two sections: Tree and Context.

The Tree section defines the presentation aspect of the documentation in the documentation tab. For example, you'll see that in the php docs you have something akin to this:

Relating this to the above, my php docrc looks like this:


#KDE Config File

[Tree]

Doc dir=php42/

#top level elements
Top Element=PHP 4.2 documentation

PHP 4.2 documentation=Table of Contents,#Getting Started,#Language Reference

Table of Contents=index.html

Getting Started=Introduction, ...
Introduction=introduction.html
...

Language Reference=Basic syntax, ...
Basic syntax=language.basic-syntax.html
...

Notice the # in front of “Getting Started” and “Language Reference”. This indicates that these are sub containers in the tree and have content of their own. I don't believe that there is a set limit to the depth here (other than that driven by sanity) - use your judgement.

For the Table of Contents, you'll notice that it is referenced directly to a file (and consequently shows up at the bottom of the tree view - directories first!).

Important

Spaces don't adversely affect anything, but watch out for & and < characters. These should likely be replaced by &amp; and &lt; respectively in all of the xml based Quanta resource files.

The Context section is the section of the docrc file that is used to facilitate context sensitive help. For example, you're writing a PHP script and you'd like to see the docs for the mysql_fetch_array function. You simply highlight the function and then press (Ctrl+H) for context help. Woosh! You're viewing the docs on mysql_fetch_array. There are only two entry types here: the ContextList and the file association lines.

ContextList

Really simple, this is just a comma separated list of the context items you wish to have available (for PHP, these are the functions for PHP).

File association lines

These are of the form context item=html doc page. e.g. acos=function.acos.html

A pared down version of my docrc Context section is as follows:


#Keywords for context help
[Context]
ContextList=abs,acos,acosh,addcslashes,addslashes,...

abs=function.abs.html
acos=function.acos.html
acosh=function.acosh.html
addcslashes=function.addcslashes.html
addslashes=function.addslashes.html
...

Now you can just save your docrc file, save it in $HOME/.kde/share/apps/quanta/doc or $KDEDIR/share/apps/quatna/doc for local or global use respectively. Then create a directory (the one specified in your docrc file) in the same directory as your docrc file and copy your html doc pages in there.

You'll need to restart Quanta and then you'll see your docs.

Once you're sure that they're good and worth sharing, send the docrc file along with a description of any pertinent information on what docs you used to the Quanta repository for use by the Quanta community. You won't get rich, but you'll feel great knowing that you contributed to the best web development platform around.

KDE Logo