Fossil SCM

Change the default markup language for Forum to Markdown.

drh 2018-08-15 12:09 trunk
Commit 5f3cb278fdb0ac3f42d31bda1754139092e2c4cc805bfc0369f7297ed2706049
1 file changed +8 -3
+8 -3
--- src/forum.c
+++ src/forum.c
@@ -19,10 +19,15 @@
1919
*/
2020
#include "config.h"
2121
#include <assert.h>
2222
#include "forum.h"
2323
24
+/*
25
+** Default to using Markdown markup
26
+*/
27
+#define DEFAULT_FORUM_MIMETYPE "text/x-markdown"
28
+
2429
#if INTERFACE
2530
/*
2631
** Each instance of the following object represents a single message -
2732
** either the initial post, an edit to a post, a reply, or an edit to
2833
** a reply.
@@ -705,11 +710,11 @@
705710
**
706711
** Start a new forum thread.
707712
*/
708713
void forumnew_page(void){
709714
const char *zTitle = PDT("title","");
710
- const char *zMimetype = PD("mimetype","text/x-fossil-wiki");
715
+ const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE);
711716
const char *zContent = PDT("content","");
712717
login_check_credentials();
713718
if( !g.perm.WrForum ){
714719
login_needed(g.anon.WrForum);
715720
return;
@@ -801,11 +806,11 @@
801806
}
802807
}
803808
isDelete = P("nullout")!=0;
804809
if( P("submit") && isCsrfSafe ){
805810
int done = 1;
806
- const char *zMimetype = PD("mimetype","text/x-fossil-wiki");
811
+ const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE);
807812
const char *zContent = PDT("content","");
808813
if( P("reply") ){
809814
done = forum_post(0, fpid, 0, 0, zMimetype, zContent);
810815
}else if( P("edit") || isDelete ){
811816
done = forum_post(P("title"), 0, fpid, 0, zMimetype, zContent);
@@ -856,11 +861,11 @@
856861
@ <input type="hidden" name="edit" value="1">
857862
forum_from_line();
858863
forum_entry_widget(zTitle, zMimetype, zContent);
859864
}else{
860865
/* Reply */
861
- zMimetype = PD("mimetype","text/x-fossil-wiki");
866
+ zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE);
862867
zContent = PDT("content","");
863868
style_header("Reply");
864869
@ <h1>Replying To:</h1>
865870
forum_render(0, pPost->zMimetype, pPost->zWiki, "forumEdit");
866871
if( P("preview") ){
867872
--- src/forum.c
+++ src/forum.c
@@ -19,10 +19,15 @@
19 */
20 #include "config.h"
21 #include <assert.h>
22 #include "forum.h"
23
 
 
 
 
 
24 #if INTERFACE
25 /*
26 ** Each instance of the following object represents a single message -
27 ** either the initial post, an edit to a post, a reply, or an edit to
28 ** a reply.
@@ -705,11 +710,11 @@
705 **
706 ** Start a new forum thread.
707 */
708 void forumnew_page(void){
709 const char *zTitle = PDT("title","");
710 const char *zMimetype = PD("mimetype","text/x-fossil-wiki");
711 const char *zContent = PDT("content","");
712 login_check_credentials();
713 if( !g.perm.WrForum ){
714 login_needed(g.anon.WrForum);
715 return;
@@ -801,11 +806,11 @@
801 }
802 }
803 isDelete = P("nullout")!=0;
804 if( P("submit") && isCsrfSafe ){
805 int done = 1;
806 const char *zMimetype = PD("mimetype","text/x-fossil-wiki");
807 const char *zContent = PDT("content","");
808 if( P("reply") ){
809 done = forum_post(0, fpid, 0, 0, zMimetype, zContent);
810 }else if( P("edit") || isDelete ){
811 done = forum_post(P("title"), 0, fpid, 0, zMimetype, zContent);
@@ -856,11 +861,11 @@
856 @ <input type="hidden" name="edit" value="1">
857 forum_from_line();
858 forum_entry_widget(zTitle, zMimetype, zContent);
859 }else{
860 /* Reply */
861 zMimetype = PD("mimetype","text/x-fossil-wiki");
862 zContent = PDT("content","");
863 style_header("Reply");
864 @ <h1>Replying To:</h1>
865 forum_render(0, pPost->zMimetype, pPost->zWiki, "forumEdit");
866 if( P("preview") ){
867
--- src/forum.c
+++ src/forum.c
@@ -19,10 +19,15 @@
19 */
20 #include "config.h"
21 #include <assert.h>
22 #include "forum.h"
23
24 /*
25 ** Default to using Markdown markup
26 */
27 #define DEFAULT_FORUM_MIMETYPE "text/x-markdown"
28
29 #if INTERFACE
30 /*
31 ** Each instance of the following object represents a single message -
32 ** either the initial post, an edit to a post, a reply, or an edit to
33 ** a reply.
@@ -705,11 +710,11 @@
710 **
711 ** Start a new forum thread.
712 */
713 void forumnew_page(void){
714 const char *zTitle = PDT("title","");
715 const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE);
716 const char *zContent = PDT("content","");
717 login_check_credentials();
718 if( !g.perm.WrForum ){
719 login_needed(g.anon.WrForum);
720 return;
@@ -801,11 +806,11 @@
806 }
807 }
808 isDelete = P("nullout")!=0;
809 if( P("submit") && isCsrfSafe ){
810 int done = 1;
811 const char *zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE);
812 const char *zContent = PDT("content","");
813 if( P("reply") ){
814 done = forum_post(0, fpid, 0, 0, zMimetype, zContent);
815 }else if( P("edit") || isDelete ){
816 done = forum_post(P("title"), 0, fpid, 0, zMimetype, zContent);
@@ -856,11 +861,11 @@
861 @ <input type="hidden" name="edit" value="1">
862 forum_from_line();
863 forum_entry_widget(zTitle, zMimetype, zContent);
864 }else{
865 /* Reply */
866 zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE);
867 zContent = PDT("content","");
868 style_header("Reply");
869 @ <h1>Replying To:</h1>
870 forum_render(0, pPost->zMimetype, pPost->zWiki, "forumEdit");
871 if( P("preview") ){
872

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button