/usr/share/php/texy/src/Texy/modules/TexyHorizLineModule.php is in php-texy 2.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | <?php
/**
* This file is part of the Texy! (http://texy.info)
* Copyright (c) 2004 David Grudl (http://davidgrudl.com)
*/
/**
* Horizontal line module.
*
* @author David Grudl
*/
final class TexyHorizLineModule extends TexyModule
{
/** @var array default CSS class */
public $classes = array(
'-' => NULL,
'*' => NULL,
);
public function __construct($texy)
{
$this->texy = $texy;
$texy->addHandler('horizline', array($this, 'solve'));
$texy->registerBlockPattern(
array($this, 'pattern'),
'#^(\*{3,}+|-{3,}+)\ *'.TexyPatterns::MODIFIER.'?()$#mU',
'horizline'
);
}
/**
* Callback for: -------.
*
* @param TexyBlockParser
* @param array regexp matches
* @param string pattern name
* @return TexyHtml
*/
public function pattern($parser, $matches)
{
list(, $mType, $mMod) = $matches;
// [1] => ---
// [2] => .(title)[class]{style}<>
$mod = new TexyModifier($mMod);
return $this->texy->invokeAroundHandlers('horizline', $parser, array($mType, $mod));
}
/**
* Finish invocation.
*
* @param TexyHandlerInvocation handler invocation
* @param string
* @param TexyModifier
* @return TexyHtml
*/
public function solve($invocation, $type, $modifier)
{
$el = TexyHtml::el('hr');
$modifier->decorate($invocation->texy, $el);
$class = $this->classes[ $type[0] ];
if ($class && !isset($modifier->classes[$class])) {
$el->attrs['class'][] = $class;
}
return $el;
}
}
|