forked from Cavemanon/cavepaintings
make anchors visible in the page, not just in the markup
This commit is contained in:
parent
9c71f59061
commit
c651845401
@ -39,7 +39,7 @@ class BBCode extends FormatterExtension {
|
||||
}
|
||||
$text = preg_replace('!^>>([^\d].+)!', '<blockquote><small>$1</small></blockquote>', $text);
|
||||
$text = preg_replace('!>>(\d+)(#c?\d+)?!s', '<a class="shm-clink" data-clink-sel="$2" href="'.make_link('post/view/$1$2').'">>>$1$2</a>', $text);
|
||||
$text = preg_replace('!\[anchor=(.*?)\](.*?)\[/anchor\]!s', '<a name="bb-$1">$2</a>', $text); // add "bb-" to avoid clashing with eg #top
|
||||
$text = preg_replace('!\[anchor=(.*?)\](.*?)\[/anchor\]!s', '<span class="anchor">$2 <a class="alink" href="#bb-$1" name="bb-$1" title="link to this anchor"> ¶ </a></span>', $text); // add "bb-" to avoid clashing with eg #top
|
||||
$text = preg_replace('!\[url=site://(.*?)(#c\d+)?\](.*?)\[/url\]!s', '<a class="shm-clink" data-clink-sel="$2" href="'.make_link('$1$2').'">$3</a>', $text);
|
||||
$text = preg_replace('!\[url\]site://(.*?)(#c\d+)?\[/url\]!s', '<a class="shm-clink" data-clink-sel="$2" href="'.make_link('$1$2').'">$1$2</a>', $text);
|
||||
$text = preg_replace('!\[url=((?:https?|ftp|irc|mailto)://.*?)\](.*?)\[/url\]!s', '<a href="$1">$2</a>', $text);
|
||||
|
@ -8,3 +8,9 @@ BLOCKQUOTE {
|
||||
padding: 8px;
|
||||
background: #DDD;
|
||||
}
|
||||
.anchor A.alink {
|
||||
visibility: hidden;
|
||||
}
|
||||
.anchor:hover A.alink {
|
||||
visibility: visible;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class BBCodeUnitTest extends UnitTestCase {
|
||||
public function testAnchor() {
|
||||
$this->assertEqual(
|
||||
$this->filter("[anchor=rules]Rules[/anchor]"),
|
||||
"<a name=\"bb-rules\">Rules</a>");
|
||||
'<span class="anchor">Rules <a class="alink" href="#bb-rules" name="bb-rules" title="link to this anchor"> ¶ </a></span>');
|
||||
}
|
||||
|
||||
private function filter($in) {
|
||||
|
Loading…
Reference in New Issue
Block a user