We need to move the Info method of Plugin and Theme up to Pluggable so
that they use the same stuff. As a result, we need to form the XML used
to define plugin/theme info a little better. As a result of changing
the format, all existing themes will explode.
This has to be done, because the areas that are published for a theme
need to go in that XML, and the XML needs to be stable.
I want to do this this week. I can publish a schema for the XML on the
wiki (Relax?), and others can look it over.
The schema should allow for themes and plugins to use the same format of
xml data, since they're both Pluggable. Soon after the info method of
plugins would go away to be replaced by the Pluggable info method,
meaning plugins wouldn't need to execute any more to get their infos.
It would just use the xml file instead (although the plugin should still
be sandboxed so it's known to work).
Your consideration is appreciated.
Owen
The Plugin class is used for more than just a container for its methods.
Being derived from the Plugin class denotes a certain status that is
used by the rest of the code.
Owen
Validated XSD:
http://pastoid.com/azc+/
Sample XML:
http://pastoid.com/aya+0/
I can't find an online tool to validate the XML using the XSD, but the
XML should validate if you have a desktop tool that supports XSDs.
Owen
We have a responsibility to make good, sensible formats where we can,
and I think that takes priority over letting theme developers take
shortcuts. Assume that every themer would love to have their theme's
strings translated - there's no reason to avoid starting out with the
data in the right place for that to happen.
I see the choices as two: 1) make the files shorter by omitting values
and using obscured, if documented, defaults or 2) make the files longer
but necessarily obvious. I like choice 2 for the little suffered
discomfort of clarity.
> 3) You are aware that there /will/ be many different, optional controls
> which different formcontrols require. Does the accommodate that? Does it
> matter?
If by "optional controls" you mean "optional attributes", then yes, I am
aware, and it should accommodate that as-is. Nonetheless, I am human
and fallible, so I posted it rather than keeping it to myself that
others could verify my work and provide potential corrections.
I suggest that if you have a particular concern that you think this
format will not address, then you bring it to light, like in point #4 below.
> 4) I don't see anything in there for <option> children. Should those be
> included?
Yes. I'll add that in a new iteration.
> 5) Can we make storage optional? The whole point is to make it easier
> for themers to create configuration, and forcing them to think about
> storage makes that harder. If not supplied, we'd provide
> an intelligent default based upon the form location.
If storage is optional, then the default should be "null:null", since
specifying no storage should indicate that no storage is required, and
the developer will handle it with code.
Remember that this is not the Theme XML spec, it is the Pluggable XML
spec. As such, it makes no sense to default storage to one place when
the bulk of configuration options may be stored elsewhere by the other
pluggable type.
Owen
Yes, producing one static, documented format that doesn't change is more
clear, more simple, than having the file behave in completely different
ways based on the value assigned to a type attribute of the XML's first
node. That's the basis of my entire thesis -- there's no reason to even
debate your additional points.
The alternative to a generic format produces at least two documents,
each including its own differences in how things work. This also
produces much more conditional code, which needs to be maintained. None
of this maintenance and complication of documentation is of benefit to
anyone.
Moreover, this is a first draft, which will also have a first
implementation. I think it will be better to refine from something
generic to something specific than vice-versa.
If it turns out that themers are befuddled by what you perceive as
complication, then we can make adjustments before release or for the
next release. It would be wise to have actual experimental data to
review before making those kinds of assumptions.
Owen
The Pluggable XML format does need some more written-language
documentation, even though the XSD is mostly complete. (Some guidance
from those who know on how to correct the XSD to work with non-local
validators would be helpful.)
Until that documentation is written (which you are welcome to begin,
instead of waiting for someone else), you can find these resources here:
Pluggable XSD: http://schemas.habariproject.org/Pluggable-1.2.xsd
Sample XML: http://schemas.habariproject.org/pluggable-sample.xml
If while writing the documentation, you have specific questions, posting
them here should yield specific direct answers and input from others.
Regarding another query posed about tying plugins explicitly to Habari
versions --
I'm unsure that this is the best approach, in the same way that I know
that a theme's requiring a specific plugin by name is the wrong
approach. Primarily my opinion on this is based on the concept that
it's not a version of Habari that a plugin targets, but a feature that
Habari provides.
So the question is, should Habari itself provide "features", as included
in the pluggable xml, that plugins can then require or recommend as
needed?
Bear in mind that major version releases of Habari should be API-stable.
So it would be useful to include a single feature of "Habari 1.0" when
that time comes. But for the 0.x branch, features change so often,
especially in the trunk, that simply indicating "0.7" as a requirement
may not be enough. Especially for the useful features that we continue
to modify and add in 0.7, an 0.7 Habari checked out at the beginning of
the branch's life would not have any of the features implied by the
requisite of "0.7".
Owen
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>to <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
This will make validators look in the right place for xml.xsd instead of looking to http://schemas.habariproject.org/xml.xsd which doesn't exist.
The w3 validator works because it does have a local copy of xml.xsd.Indeed. Thanks for that.
I've added a little validator script to schemas.hp.o so that you can
test your own XML:
http://schemas.habariproject.org/pluggable_validator.php
If you try to validate this plugin, you'll get an error:
http://svn.habariproject.org/habari-extras/plugins/twitter/branches/0.7-1.x/twitter.plugin.xml
This is because there is no <authrourl> element. If you change that in
the textbox, and move the url as a property of the author element, like
this:
<author url="http://habariproject.org/">Habari Community</author>
Then validate the Text (click that radio button), you'll see it validate.
Hopefully, that'll be a useful tool.
Also note that I've updated the xsd file to 1.3, since limiting required
elements to a specific order was making most plugin XML fail. The side
effect is that there's really no way to say that the XML requires a
<name> element. There are some technical reasons why this is so --
changing them would make other things in the format less desirable.
Owen