1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-27 09:12:30 +01:00
Files
pentadactyl-pm/common/locale/en-US/developer.xml
2009-11-01 00:16:55 -04:00

144 lines
5.4 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="chrome://liberator/content/help.xsl"?>
<!DOCTYPE document SYSTEM "chrome://liberator/content/liberator.dtd">
<document
name="developer"
title="&liberator.appname; Developer information"
xmlns="http://vimperator.org/namespaces/liberator"
xmlns:html="http://www.w3.org/1999/xhtml">
<h1 tag="developer-information">Developer information</h1>
<h2 tag="writing-docs documentation">Writing documentation</h2>
<p>
For every new feature, writing documentation is <em>mandatory</em> for the
patch to be accepted. The docs are written in an XML dialect similar to
XHTML, with a few tags specific to our documentation. For example:
</p>
<code><![CDATA[
<item>
<tags><![CDATA[<F1> :help :h help]]]]><![CDATA[></tags>
<spec>:h<oa>elp</oa> <a>subject</a></spec>
<spec><![CDATA[<F1>]]]]><![CDATA[></spec>
<description>
<p>
Open help window.
The default section is shown unless <a>subject</a> is specified.
If you need help for a specific topic, try <ex>:help overview</ex>.
</p>
</description>
</item>
]]></code>
<p>
creates a new help section for the command <ex>:help</ex> and for
the related key binding, <k name="F1"/>. It also creates help tags
for the command, its shortcuts, the key binding, and the general
topic, 'help'. These tags enable linking to this section when from
other mentions of the topic and from the <ex>:help</ex> command.
The above code displays as:
</p>
<html:div style="margin: 2em;">
<item>
<tags><![CDATA[<F1> :help :h help]]></tags>
<spec>:h<oa>elp</oa> <a>subject</a></spec>
<spec><![CDATA[<F1>]]></spec>
<description>
<p>
Open help window.
The default section is shown unless <a>subject</a> is specified.
If you need help for a specific topic, try <ex>:help overview</ex>.
</p>
</description>
</item>
</html:div>
If you don't know in which file/section you should put some
documentation, ask on the mailing list or on #vimperator.
<h2 tag="generating-docs">Generating documentation</h2>
You can also autogenerate most of the XML help after you have
written a new command, mapping or option. For this, use:
:echo util.generateHelp(commands.get("addons"), "Extra text")
<h2 tag="writing-plugins">Writing plugins</h2>
Writing &liberator.appname; plugins is incredibly simple.
Plugins are simply JavaScript files which run with full chrome
privileges and have full access to the &liberator.appname; and
&liberator.host; APIs. Each plugin has its own global object,
which means that the variables and functions that you create
won't pollute the global <em>window</em> or private
<em>liberator</em> namespaces. This means that there's no need
to wrap your plugin in a closure, as is often the practice in
JavaScript development. Furthermore, any plugin which is
installed in your <o>runtimepath</o><em>/plugin</em> directory
will find its context stored in
<em>plugins.&lt;pluginName></em>, which is often invaluable
during development and testing.
<h3 tag="plugin-documentation">Plugin documentation</h3>
Plugins may provide inline documentation, which will appear on
the <ex>:help plugins</ex> page. The markup for help entries
is the same as the above, with a few more plugin specific
entries. Here is an example from the popular
<em>flashblock</em> extension:
<code><![CDATA[
var INFO =
<plugin name="flashblock" version="1.0"
href="http://ticket.vimperator.org/9"
summary="Flash Blocker"
xmlns="http://vimperator.org/namespaces/liberator">
<author email="maglione.k@gmail.com">Kris Maglione</author>
<license href="http://opensource.org/licenses/mit-license.php">MIT</license>
<project name="Vimperator" minVersion="2.0"/>
<p>
This plugin provides the same features as the ever popular FlashBlock
Firefox addon. Flash animations are substituted with place holders which
play the original animation when clicked. Additionally, this plugin provides
options to control which sites can play animations without restrictions, and
triggers to toggle the playing of animation on the current page.
commandline from the data in a given form.
</p>
<item>
<tags>'flashblock' 'fb'</tags>
<spec>'flashblock' 'fb'</spec>
<type>boolean</type>
<default>true</default>
<description>
<p>
Controls the blocking of flash animations. When true, place
holders are substituted for flash animations on untrusted sites.
</p>
</description>
</item>]]>
<em></em><![CDATA[
</plugin>;
]]>
</code>
The inline XML is made possible by
<link topic="https://developer.mozilla.org/en/E4X">E4X</link>.
It's important that the documentation be assigned to the
<em>INFO</em> variable, or &liberator.appname; will not be able
to find it. The documentation that you provide behaves exactly
as other &liberator.appname; documentation, which means that
the tags you provide are available via <ex>:help</ex> with
full tag completion and cross-referencing support. Although
documentation is not required, we strongly recommend that all
plugin authors provide at least basic documentation of the
functionality of their plugins and of each of the options,
commands, and especially mappings that they provide.
</document>
<!-- vim:se sts=4 sw=4 et: -->