• R/O
  • SSH
  • HTTPS

ptiblogphp: Commit


Commit MetaInfo

Revision40 (tree)
Time2021-06-30 17:04:27
Authormateuszviste

Log Message

welcome message is markdown-processed as well (like articles)

Change Summary

Incremental Difference

--- trunk/changes.txt (revision 39)
+++ trunk/changes.txt (revision 40)
@@ -4,7 +4,7 @@
44 ******************************************************************************
55
66 ver xxxxxxxx
7- - articles are filtered through a markdown processor, allows for nicer styles
7+ - articles and welcome message are filtered through a markdown processor
88 - authentication form features a cancel link
99 - format and language of timestamps are configurable
1010 - title string is properly htmlized (special characters escaped)
--- trunk/index.php (revision 39)
+++ trunk/index.php (revision 40)
@@ -135,6 +135,12 @@
135135 return(array_reverse($r));
136136 }
137137
138+ function markdownoutput($md) {
139+ $Parsedown = new Parsedown();
140+ $Parsedown->setBreaksEnabled(true);
141+ echo $Parsedown->text($md) . "\n";
142+ }
143+
138144 // ustaw locale dla generowania dat
139145 setlocale(LC_TIME, $DATELOCALE);
140146
@@ -212,7 +218,7 @@
212218 }
213219
214220 if (($p == 0) && (empty($action))) {
215- readfile("welcome.txt");
221+ markdownoutput(file_get_contents('welcome.txt'));
216222 } else if ($action === 'nowywpis') {
217223 echo "<p>Édition</p>\n";
218224 } else if ($action === 'login') {
@@ -308,9 +314,7 @@
308314 }
309315 echo "<h2>{$artcontent[0]}</h2>\n";
310316 echo '<h3>' . strftime($TIMESTAMPFORMAT, $art) . "</h3>\n";
311- $Parsedown = new Parsedown();
312- $Parsedown->setBreaksEnabled(true);
313- echo $Parsedown->text($artcontent[1]) . "\n";
317+ markdownoutput($artcontent[1]);
314318 // mamy jakieś załączniki? (nie zdjęcia)
315319 $lista_plikow = ListaPlikow($art, 2);
316320 if (!empty($lista_plikow)) {
--- trunk/welcome.txt (revision 39)
+++ trunk/welcome.txt (revision 40)
@@ -1,3 +1,3 @@
1-<p>Welcome to ptiblogphp! This is a default welcome message. You should modify it by editing the welcome.txt file.</p>
1+Welcome to ptiblogphp! This is a default welcome message. You should modify it by editing the welcome.txt file.
22
3-<p>This file contains HTML, so you may use all kinds of HTML constructs like <span style="font-style: italic; font-weight: bold; color: red;">special font effects</span>, <a href="http://ptiblogphp.osdn.io">cool links</a> or <span title="hello, I am a popup message" style="text-decoration: underline wavy;">other fancy stuff</span>.</p>
3+This file uses the markdown syntax, so you may use all kinds of markdown constructs like ***special font effects*** or [cool links](http://ptiblogphp.osdn.io). You may also use inline HTML for any <span title="hello, I am a popup message" style="text-decoration: underline wavy;">other fancy stuff</span>.
Show on old repository browser