Page MenuHomec4science

PhutilRemarkupRuleUnderline.php
No OneTemporary

File Metadata

Created
Tue, Nov 5, 16:40

PhutilRemarkupRuleUnderline.php

<?php
final class PhutilRemarkupRuleUnderline
extends PhutilRemarkupRule {
public function getPriority() {
return 1000.0;
}
public function apply($text) {
if ($this->getEngine()->isTextMode()) {
return $text;
}
return $this->replaceHTML(
'@(?<!_|/)__([^\s_/].*?_*)__(?!/|\.\S)@s',
array($this, 'applyCallback'),
$text);
}
protected function applyCallback($matches) {
return hsprintf('<u>%s</u>', $matches[1]);
}
}

Event Timeline