- Compatibility with Markdown established
- The help document is now linked in the plugin panel
- Hard-coded output now localized
This commit is contained in:
Frank Hochmuth 2024-02-10 19:36:50 +01:00 committed by GitHub
commit 41ca6c7000
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 111 additions and 12 deletions

View File

@ -1,9 +1,8 @@
The footnote plugin creates links between numbers in the content and the corresponding footnote below the text. It's quite straightforward - to try, just create a sample entry with the following content: The footnote plugin creates links between numbers in the content and the corresponding footnote below the text. It's quite straightforward - to try, just create a sample entry with the following content:
Here is some text[^1] with a note. The text goes on and has another reference[^2] to a footnote.
Here is some text[1] with a note. The text goes on and has another reference[2] to a footnote.
[footnotes] [footnotes]
[1] here is the note [^1]: *here* is the note
[2] and the second one :) [^2]: and the _second_ one :)

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Poznámka pod čarou',
'footnotes' => 'Poznámky pod čarou',
'back' => 'Zpět na'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Fodnote',
'footnotes' => 'Fodnoter',
'back' => 'Tilbage til'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Fußnote',
'footnotes' => 'Fußnoten',
'back' => 'Zurück zu'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Υποσημείωση',
'footnotes' => 'Υποσημειώσεις',
'back' => 'Πίσω στο'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Footnote',
'footnotes' => 'Footnotes',
'back' => 'Back to'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Nota a pie de página',
'footnotes' => 'Notas a pie de página',
'back' => 'Volver a'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Note de bas de page',
'footnotes' => 'Notes de bas de page',
'back' => 'Retour &agrave;'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Nota a piè di pagina',
'footnotes' => 'Note a piè di pagina',
'back' => 'Torna a'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'フットノート',
'footnotes' => '脚注',
'back' => 'へ戻る'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Voetnoot',
'footnotes' => 'Voetnoten',
'back' => 'Terug naar'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Nota de rodapé',
'footnotes' => 'Notas de rodapé',
'back' => 'Voltar para'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Сноска',
'footnotes' => 'Сноски',
'back' => 'Назад к'
);
?>

View File

@ -0,0 +1,7 @@
<?php
$lang ['plugin'] ['footnotes'] = array(
'footnote' => 'Opomba',
'footnotes' => 'Opombe pod črto',
'back' => 'Nazaj na'
);
?>

View File

@ -1,11 +1,11 @@
<?php <?php
/* /*
* Plugin Name: FootNotes * Plugin Name: FootNotes
* Version: 1.0 * Version: 1.0.1
* Plugin URI: https://www.flatpress.org * Plugin URI: https://www.flatpress.org
* Author: FlatPress * Author: FlatPress
* Author URI: https://www.flatpress.org * Author URI: https://www.flatpress.org
* Description: Enables footnotes in your entries. Part of the standard distribution. * Description: Enables footnotes in your entries. Part of the standard distribution. <a href="./fp-plugins/footnotes/doc_footnotes.txt" title="Instructions" target="_blank">[Instructions]</a>
*/ */
define('FOOTNOTES_START', '[footnotes]'); define('FOOTNOTES_START', '[footnotes]');
@ -21,16 +21,22 @@ class footnotes_class {
} }
function note($n, $s) { function note($n, $s) {
$lang = lang_load('plugin:footnotes');
$back = $lang ['plugin'] ['footnotes'] ['back'];
$id = $this->id; $id = $this->id;
$this->refs = true; $this->refs = true;
return '<li>' . trim($s) . " <a id=\"$id-fn-{$n}\" href=\"#$id-rel-{$n}\" " . "title=\"Back {$n}\">^top</a>" . '</li>'; return '<li>' . trim($s) . " <a id=\"$id-fn-{$n}\" href=\"#$id-rel-{$n}\" " . "title=\"{$back} {$n}\">&#8617;</a>" . '</li>';
} }
function footnotes($matches) { function footnotes($matches) {
$str = '<div class="footnotes"><h4>Footnotes</h4><ol>'; $lang = lang_load('plugin:footnotes');
$footnotes = $lang ['plugin'] ['footnotes'] ['footnotes'];
$lines = preg_split('|\[([0-9]+)\]|', $matches [1], -1, PREG_SPLIT_DELIM_CAPTURE); $str = '<div class="footnotes"><h4>' . $footnotes . '</h4><ol>';
$lines = preg_split('|\[\^([0-9]+)\]\:|', $matches [1], -1, PREG_SPLIT_DELIM_CAPTURE);
// first array element is always empty - remove // first array element is always empty - remove
array_shift($lines); array_shift($lines);
@ -46,6 +52,9 @@ class footnotes_class {
} }
function references($matches) { function references($matches) {
$lang = lang_load('plugin:footnotes');
$footnote = $lang ['plugin'] ['footnotes'] ['footnote'];
$n = $matches [1]; $n = $matches [1];
$id = $this->id; $id = $this->id;
@ -53,7 +62,7 @@ class footnotes_class {
$href_rel = "{$id}-rel-{$n}"; $href_rel = "{$id}-rel-{$n}";
$href_note = "{$id}-fn-{$n}"; $href_note = "{$id}-fn-{$n}";
return "<sup><a id=\"$href_rel\" href=\"#$href_note\" title=\"note {$n}\">{$n}</a></sup>"; return "<sup><a id=\"$href_rel\" href=\"#$href_note\" title=\"{$footnote} {$n}\">{$n}</a></sup>";
} }
function headings($matches) { function headings($matches) {
@ -92,7 +101,7 @@ function plugin_footnotes_filter($text) {
if (!$footnotes_obj->refs) if (!$footnotes_obj->refs)
return $text; return $text;
$text = preg_replace_callback('|\[([0-9]+)\]|', array( $text = preg_replace_callback('|\[\^([0-9]+)\]|', array(
&$footnotes_obj, &$footnotes_obj,
'references' 'references'
), $text); ), $text);