Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/infrastructure/markup/markuprule/PhutilRemarkupUnderlineRule.php
12241 views
1
<?php
2
3
final class PhutilRemarkupUnderlineRule extends PhutilRemarkupRule {
4
5
public function getPriority() {
6
return 1000.0;
7
}
8
9
public function apply($text) {
10
if ($this->getEngine()->isTextMode()) {
11
return $text;
12
}
13
14
return $this->replaceHTML(
15
'@(?<!_|/)__([^\s_/].*?_*)__(?!/|\.\S)@s',
16
array($this, 'applyCallback'),
17
$text);
18
}
19
20
protected function applyCallback(array $matches) {
21
return hsprintf('<u>%s</u>', $matches[1]);
22
}
23
24
}
25
26