4 * Collects Subversion data from the HTML document using keywords and
5 * adds them to the Page object for other Subversion-dependent filters
9 class XHTMLCompiler_DOMFilter_Subversion
extends XHTMLCompiler_DOMFilter
12 protected $name = 'Subversion';
13 protected $prefix = 'svn';
16 // svn:revision = $Revision$
17 // svn:author = $Author$
18 // svn:head-url = $HeadURL$
19 // // svn:id = $Id$ (redundant, but should be accepted)
21 // All can be determined from a `svn status` call, but that's
22 // expensive and should be avoided.
24 public function process(DOMDocument
$dom, $page, $manager) {
26 // TODO: Id can be used to grab date, author and revision info
27 // Not HeadURL, unfortunantely, so there'll need to be two
29 // retrieve unparsed values
30 $keys = array('date', 'revision', 'author', 'head-url'); // 'id'
32 foreach ($keys as $key) {
33 $vals[$key] = $this->confiscateAttr(
34 $dom->documentElement
, $this->ns
, $key
39 foreach ($vals as $key => $val) {
41 $val = false; // technically unnecessary, but be explicit
46 $l = strpos($val, ' ') +
1, // index of first space + 1
47 strlen($val) - $l - 2 // exclude last two characters
51 // insert into page object
52 $page->registerSVNKeywords(
53 $vals['date'], $vals['revision'], $vals['author'], $vals['head-url']