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.
Commit
7caaa287b82a19988adb4a8dc6797fc057e793084afc0b7419360c0bfd87d10b
Parent
b9fa7e28712c598…
1 file changed
+13
+13
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -341,19 +341,32 @@ | ||
| 341 | 341 | @ <h1><i>Deleted</i></h1> |
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | if( zContent && zContent[0] ){ |
| 345 | 345 | Blob x; |
| 346 | + const int isFossilWiki = zMimetype==0 | |
| 347 | + || fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0; | |
| 346 | 348 | if( bScroll ){ |
| 347 | 349 | @ <div class='forumPostBody'> |
| 348 | 350 | }else{ |
| 349 | 351 | @ <div class='forumPostFullBody'> |
| 350 | 352 | } |
| 351 | 353 | blob_init(&x, 0, 0); |
| 352 | 354 | blob_append(&x, zContent, -1); |
| 353 | 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 | + } | |
| 354 | 364 | wiki_render_by_mimetype(&x, zMimetype); |
| 365 | + if( isFossilWiki ){ | |
| 366 | + @ </div> | |
| 367 | + } | |
| 355 | 368 | blob_reset(&x); |
| 356 | 369 | @ </div> |
| 357 | 370 | }else{ |
| 358 | 371 | @ <i>Deleted</i> |
| 359 | 372 | } |
| 360 | 373 |
| --- 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 |