Fossil SCM

When rendering fossil-wiki forum posts, add a wrapper DIV around them so that the CSS which expects that for markdown and plain-text posts still applies. This fixes the sideways layout of fossil-wiki posts like that seen in [https://fossil-scm.org/forum/forumpost/3d709776b8 | forumpost/3d709776b8]. Note that a simpler fix would be to add the wrapper element to wiki_render_by_mimetype(), but that might have undesired side effects in/via the many other uses of that function.

stephan 2020-09-02 10:55 trunk
Commit 7caaa287b82a19988adb4a8dc6797fc057e793084afc0b7419360c0bfd87d10b
1 file changed +13
+13
--- src/forum.c
+++ src/forum.c
@@ -341,19 +341,32 @@
341341
@ <h1><i>Deleted</i></h1>
342342
}
343343
}
344344
if( zContent && zContent[0] ){
345345
Blob x;
346
+ const int isFossilWiki = zMimetype==0
347
+ || fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0;
346348
if( bScroll ){
347349
@ <div class='forumPostBody'>
348350
}else{
349351
@ <div class='forumPostFullBody'>
350352
}
351353
blob_init(&x, 0, 0);
352354
blob_append(&x, zContent, -1);
353355
safe_html_context(DOCSRC_FORUM);
356
+ if( isFossilWiki ){
357
+ /* Markdown and plain-text rendering add a wrapper DIV resp. PRE
358
+ ** element around the post, and some CSS relies on its existence
359
+ ** in order to handle expansion/collapse of the post. Fossil
360
+ ** Wiki rendering does not do so, so we must wrap those manually
361
+ ** here. */
362
+ @ <div class='fossilWiki'>
363
+ }
354364
wiki_render_by_mimetype(&x, zMimetype);
365
+ if( isFossilWiki ){
366
+ @ </div>
367
+ }
355368
blob_reset(&x);
356369
@ </div>
357370
}else{
358371
@ <i>Deleted</i>
359372
}
360373
--- src/forum.c
+++ src/forum.c
@@ -341,19 +341,32 @@
341 @ <h1><i>Deleted</i></h1>
342 }
343 }
344 if( zContent && zContent[0] ){
345 Blob x;
 
 
346 if( bScroll ){
347 @ <div class='forumPostBody'>
348 }else{
349 @ <div class='forumPostFullBody'>
350 }
351 blob_init(&x, 0, 0);
352 blob_append(&x, zContent, -1);
353 safe_html_context(DOCSRC_FORUM);
 
 
 
 
 
 
 
 
354 wiki_render_by_mimetype(&x, zMimetype);
 
 
 
355 blob_reset(&x);
356 @ </div>
357 }else{
358 @ <i>Deleted</i>
359 }
360
--- src/forum.c
+++ src/forum.c
@@ -341,19 +341,32 @@
341 @ <h1><i>Deleted</i></h1>
342 }
343 }
344 if( zContent && zContent[0] ){
345 Blob x;
346 const int isFossilWiki = zMimetype==0
347 || fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0;
348 if( bScroll ){
349 @ <div class='forumPostBody'>
350 }else{
351 @ <div class='forumPostFullBody'>
352 }
353 blob_init(&x, 0, 0);
354 blob_append(&x, zContent, -1);
355 safe_html_context(DOCSRC_FORUM);
356 if( isFossilWiki ){
357 /* Markdown and plain-text rendering add a wrapper DIV resp. PRE
358 ** element around the post, and some CSS relies on its existence
359 ** in order to handle expansion/collapse of the post. Fossil
360 ** Wiki rendering does not do so, so we must wrap those manually
361 ** here. */
362 @ <div class='fossilWiki'>
363 }
364 wiki_render_by_mimetype(&x, zMimetype);
365 if( isFossilWiki ){
366 @ </div>
367 }
368 blob_reset(&x);
369 @ </div>
370 }else{
371 @ <i>Deleted</i>
372 }
373

Keyboard Shortcuts

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