An API for markup language filtering in Drupal.
This module provides an API to let other module developers define a set of valid tags and attributes (which may be valid within the context of 1 or more tags — including a case where an attribute may be valid within all tags).
When enabled as an input filter, this module will poll all modules conforming to it's API for the set of elements and attributes which those modules define as valid, combine them into two big lists (one for attributes and one for elements), then filter out any element not in the element list and any attribute either not in the attribute list, or out of context as defined by the attribute list.
This module will allow other modules conforming to it's API to add on to it's settings form if the module wants. It will also define it's own settings.
Dependencies
- PHP 5
- Drupal 6.x
-
Drupal core's
filtermodule
Installation
Drupal 6
-
Download into your site's
modulesfolder (by default at/sites/default/modules— you may need to create themodulesfolder if it doesn't already exist). - Log in to your site as the super-administrator (user-id 1).
-
Enable the module from
Administer->Site building->Modules(it will be in theInput Filtergroup). Also, enable the modules which conform to it's API and you want to use as a filter (try theXHTML Modularization 1.1 Markup API pluginmodule which comes packaged withmarkup_api). -
Edit an input filter from
Administer->Site configuration->Input formats, clickingconfigurein theoperationscolumn of the table listing the available input formats in the same row as the format you want to configure.. -
Enable the filter by checking the box labeled
Markup Filter API, then clickingSave configurationat the bottom of the page. -
Set your desired configuration from the
Configurepane for the input format. -
Ensure that the module is reasonably placed in the
Rearrangepane for the input format. This module works best near the bottom, but above the HTML Corrector filter (if it's enabled for this format).
Authors
- M Parker — you can contact me via my drupal.org account page
Future
This module will likely stay in beta until automated testing with SimpleTest has been implemented. If you'd like to contribute tests, please do so — see the 'Contributing' section below for more information.
A feature that I'd really like to implement sometime is an "overrides" box which lets the administrator allow or deny elements and attributes. These allow/deny rules would override anything set by other modules that conform to the markup_api API.
I haven't really thought about how version numbering is going to work. I think it's tradition to increment the major version number if the API changes... but I'd also like to keep security updates + bug fixes on a separate track from the addition of new features. Obviously, since the project is still in Beta, this isn't a pressing concern right now, but feel free to leave me a message with your insight if you wish!
On the subject of new versions, I haven't had time to work on a Drupal 7 version yet, but I intend to do so at some time in the future.
Contributing
Contributions are welcome! If you have new features, bug fixes or any code that you'd like to submit, clone this project, make your changes, check that they conform to the Drupal coding standards (I suggest using the Coder module to check), then create a patch and put it on the issue queue to let me know about your changes.
Please note that, by submitting a patch, you licence your code to be used under the same terms as the rest of this project, i.e.: the GNU General Public License, version 2 or later (please also refer to the "Yes, I promise to upload GPLv2+ code" issue at Drupal.org).