Add CSS for markdown footnotes.

CSS is added via addToCSS().

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein 2017-07-16 22:35:43 +02:00
parent 3faf2386cb
commit 617427a383
2 changed files with 65 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Version 1.25:
=============
Changes by Thomas Hochstein <thh@inter.net>
- Add CSS for footnotes via addToCSS().
Version 1.24:
=============
Changes by Thomas Hochstein <thh@inter.net>

View file

@ -31,9 +31,13 @@ class serendipity_event_markdown extends serendipity_event
'smarty' => '2.6.7',
'php' => '5.3.0'
));
$propbag->add('version', '1.24');
$propbag->add('version', '1.25');
$propbag->add('cachable_events', array('frontend_display' => true));
$propbag->add('event_hooks', array('frontend_display' => true, 'frontend_comment' => true));
$propbag->add('event_hooks', array(
'frontend_display' => true,
'frontend_comment' => true,
'css' => true
));
$propbag->add('groups', array('MARKUP'));
$this->markup_elements = array(
@ -197,6 +201,16 @@ class serendipity_event_markdown extends serendipity_event
return true;
break;
case 'css':
// if (strpos($eventData, '.footnotes')) {
// return true;
// }
$this->addToCSS($eventData);
return true;
break;
default:
return false;
}
@ -237,6 +251,49 @@ class serendipity_event_markdown extends serendipity_event
return Markdown($text);
}
*/
function addToCSS(&$eventData) {
$eventData .= '
/* Footnotes (generated by serendipity_event_markdown) */
footnote-ref:after {
content: ")";
}
.footnotes hr {
border-top: dashed #ccc;
border-width: 1px;
}
/* mostly taken from http://www.456bereastreet.com/archive/201105/styling_ordered_list_numbers/ */
.footnotes ol {
counter-reset: li;
margin-top: .2em;
margin-left: 1.5em;
padding-left: 0;
}
.footnotes ol > li {
list-style: none;
position: relative;
padding-left: .5em;
font-size: 90%;
}
.footnotes ol > li:before {
content: counter(li)")";
counter-increment: li;
position: absolute;
left: -2em;
top: -.1em;
width: 2em;
text-align: right;
font-size: 80%;
font-weight: bold;
}
/* --- end of Footnotes */
';
}
}
/* vim: set sts=4 ts=4 expandtab :