Fossil SCM
Better titles for the /wiki page for associated wiki.
Commit
57443202ae0ef2353a3682d79c1b4334b206ab302b1cf12c4da02c3d4d12505d
Parent
32d9be6d719b60d…
2 files changed
+4
-2
+53
-30
+4
-2
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -2272,18 +2272,20 @@ | ||
| 2272 | 2272 | if( fossil_islower(desc.aData[0]) ){ |
| 2273 | 2273 | desc.aData[0] = fossil_toupper(desc.aData[0]); |
| 2274 | 2274 | } |
| 2275 | 2275 | if( zBrName |
| 2276 | 2276 | && !PB("nowiki") |
| 2277 | - && wiki_render_associated("branch", zBrName, WIKIASSOC_FULL_TITLE) | |
| 2277 | + && wiki_render_associated("branch", zBrName, | |
| 2278 | + WIKIASSOC_FULL_TITLE|WIKIASSOC_MENU) | |
| 2278 | 2279 | ){ |
| 2279 | 2280 | @ <div class="section">%b(&desc)</div> |
| 2280 | 2281 | }else |
| 2281 | 2282 | if( zTagName |
| 2282 | 2283 | && matchStyle==MS_EXACT |
| 2283 | 2284 | && !PB("nowiki") |
| 2284 | - && wiki_render_associated("tag", zTagName, WIKIASSOC_FULL_TITLE) | |
| 2285 | + && wiki_render_associated("tag", zTagName, | |
| 2286 | + WIKIASSOC_FULL_TITLE|WIKIASSOC_MENU) | |
| 2285 | 2287 | ){ |
| 2286 | 2288 | @ <div class="section">%b(&desc)</div> |
| 2287 | 2289 | } else{ |
| 2288 | 2290 | @ <h2>%b(&desc)</h2> |
| 2289 | 2291 | } |
| 2290 | 2292 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2272,18 +2272,20 @@ | |
| 2272 | if( fossil_islower(desc.aData[0]) ){ |
| 2273 | desc.aData[0] = fossil_toupper(desc.aData[0]); |
| 2274 | } |
| 2275 | if( zBrName |
| 2276 | && !PB("nowiki") |
| 2277 | && wiki_render_associated("branch", zBrName, WIKIASSOC_FULL_TITLE) |
| 2278 | ){ |
| 2279 | @ <div class="section">%b(&desc)</div> |
| 2280 | }else |
| 2281 | if( zTagName |
| 2282 | && matchStyle==MS_EXACT |
| 2283 | && !PB("nowiki") |
| 2284 | && wiki_render_associated("tag", zTagName, WIKIASSOC_FULL_TITLE) |
| 2285 | ){ |
| 2286 | @ <div class="section">%b(&desc)</div> |
| 2287 | } else{ |
| 2288 | @ <h2>%b(&desc)</h2> |
| 2289 | } |
| 2290 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2272,18 +2272,20 @@ | |
| 2272 | if( fossil_islower(desc.aData[0]) ){ |
| 2273 | desc.aData[0] = fossil_toupper(desc.aData[0]); |
| 2274 | } |
| 2275 | if( zBrName |
| 2276 | && !PB("nowiki") |
| 2277 | && wiki_render_associated("branch", zBrName, |
| 2278 | WIKIASSOC_FULL_TITLE|WIKIASSOC_MENU) |
| 2279 | ){ |
| 2280 | @ <div class="section">%b(&desc)</div> |
| 2281 | }else |
| 2282 | if( zTagName |
| 2283 | && matchStyle==MS_EXACT |
| 2284 | && !PB("nowiki") |
| 2285 | && wiki_render_associated("tag", zTagName, |
| 2286 | WIKIASSOC_FULL_TITLE|WIKIASSOC_MENU) |
| 2287 | ){ |
| 2288 | @ <div class="section">%b(&desc)</div> |
| 2289 | } else{ |
| 2290 | @ <h2>%b(&desc)</h2> |
| 2291 | } |
| 2292 |
+53
-30
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -343,10 +343,38 @@ | ||
| 343 | 343 | style_header("Wiki Search"); |
| 344 | 344 | wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX); |
| 345 | 345 | search_screen(SRCH_WIKI, 0); |
| 346 | 346 | style_footer(); |
| 347 | 347 | } |
| 348 | + | |
| 349 | +/* | |
| 350 | +** Add an appropriate style_header() for either the /wiki or /wikiedit page | |
| 351 | +** for zPageName. | |
| 352 | +*/ | |
| 353 | +static void wiki_page_header(const char *zPageName, const char *zExtra){ | |
| 354 | + if( db_get_boolean("wiki-about",1)==0 ){ | |
| 355 | + style_header("%s%s", zExtra, zPageName); | |
| 356 | + }else | |
| 357 | + if( sqlite3_strglob("checkin/*", zPageName)==0 | |
| 358 | + && db_exists("SELECT 1 FROM blob WHERE uuid=%Q",zPageName+8) | |
| 359 | + ){ | |
| 360 | + style_header("Notes About Checkin %S", zPageName + 8); | |
| 361 | + style_submenu_element("Checkin Timeline","%R/timeline?f=%s",zPageName + 8); | |
| 362 | + style_submenu_element("Checkin Info","%R/info/%s",zPageName + 8); | |
| 363 | + }else | |
| 364 | + if( sqlite3_strglob("branch/*", zPageName)==0 ){ | |
| 365 | + style_header("Notes About Branch %h", zPageName + 7); | |
| 366 | + style_submenu_element("Branch Timeline","%R/timeline?r=%t",zPageName + 7); | |
| 367 | + }else | |
| 368 | + if( sqlite3_strglob("tag/*", zPageName)==0 ){ | |
| 369 | + style_header("Notes About Tag %h", zPageName + 4); | |
| 370 | + style_submenu_element("Tag Timeline","%R/timeline?t=%t",zPageName + 4); | |
| 371 | + } | |
| 372 | + else{ | |
| 373 | + style_header("%s%s", zExtra, zPageName); | |
| 374 | + } | |
| 375 | +} | |
| 348 | 376 | |
| 349 | 377 | /* |
| 350 | 378 | ** WEBPAGE: wiki |
| 351 | 379 | ** URL: /wiki?name=PAGENAME |
| 352 | 380 | */ |
| @@ -410,11 +438,11 @@ | ||
| 410 | 438 | style_submenu_element("History", "%s/whistory?name=%T", |
| 411 | 439 | g.zTop, zPageName); |
| 412 | 440 | } |
| 413 | 441 | } |
| 414 | 442 | style_set_current_page("%T?name=%T", g.zPath, zPageName); |
| 415 | - style_header("%s", zPageName); | |
| 443 | + wiki_page_header(zPageName, ""); | |
| 416 | 444 | wiki_standard_submenu(submenuFlags); |
| 417 | 445 | if( zBody[0]==0 ){ |
| 418 | 446 | @ <i>This page has been deleted</i> |
| 419 | 447 | }else{ |
| 420 | 448 | blob_init(&wiki, zBody, -1); |
| @@ -579,33 +607,11 @@ | ||
| 579 | 607 | } |
| 580 | 608 | if( zBody==0 ){ |
| 581 | 609 | zBody = mprintf("<i>Empty Page</i>"); |
| 582 | 610 | } |
| 583 | 611 | style_set_current_page("%T?name=%T", g.zPath, zPageName); |
| 584 | - | |
| 585 | - if( db_get_boolean("wiki-about",1)==0 ){ | |
| 586 | - style_header("Edit: %s", zPageName); | |
| 587 | - }else | |
| 588 | - if( sqlite3_strglob("checkin/*", zPageName)==0 | |
| 589 | - && db_exists("SELECT 1 FROM blob WHERE uuid=%Q",zPageName+8) | |
| 590 | - ){ | |
| 591 | - style_header("Notes About Checkin %S", zPageName + 8); | |
| 592 | - style_submenu_element("Checkin Timeline","%R/timeline?f=%s",zPageName + 8); | |
| 593 | - style_submenu_element("Checkin Info","%R/info/%s",zPageName + 8); | |
| 594 | - }else | |
| 595 | - if( sqlite3_strglob("branch/*", zPageName)==0 ){ | |
| 596 | - style_header("Notes About Branch %h", zPageName + 7); | |
| 597 | - style_submenu_element("Branch Timeline","%R/timeline?r=%t",zPageName + 7); | |
| 598 | - }else | |
| 599 | - if( sqlite3_strglob("tag/*", zPageName)==0 ){ | |
| 600 | - style_header("Notes About Tag %h", zPageName + 4); | |
| 601 | - style_submenu_element("Tag Timeline","%R/timeline?t=%t",zPageName + 4); | |
| 602 | - } | |
| 603 | - else{ | |
| 604 | - style_header("Edit: %s", zPageName); | |
| 605 | - } | |
| 606 | - | |
| 612 | + wiki_page_header(zPageName, "Edit: "); | |
| 607 | 613 | if( rid && !isSandbox && g.perm.ApndWiki ){ |
| 608 | 614 | if( g.perm.Attach ){ |
| 609 | 615 | style_submenu_element("Attach", |
| 610 | 616 | "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T", |
| 611 | 617 | g.zTop, zPageName, g.zTop, zPageName); |
| @@ -1519,10 +1525,11 @@ | ||
| 1519 | 1525 | /* |
| 1520 | 1526 | ** Allowed flags for wiki_render_associated |
| 1521 | 1527 | */ |
| 1522 | 1528 | #if INTERFACE |
| 1523 | 1529 | #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */ |
| 1530 | +#define WIKIASSOC_MENU 0x00002 /* Add a submenu to the About section */ | |
| 1524 | 1531 | #endif |
| 1525 | 1532 | |
| 1526 | 1533 | /* |
| 1527 | 1534 | ** Show the default Section label for an associated wiki page. |
| 1528 | 1535 | */ |
| @@ -1537,10 +1544,23 @@ | ||
| 1537 | 1544 | @ <div class="section">About checkin %.20h(zName)</div> |
| 1538 | 1545 | }else{ |
| 1539 | 1546 | @ <div class="section">About %s(zPrefix) %h(zName)</div> |
| 1540 | 1547 | } |
| 1541 | 1548 | } |
| 1549 | + | |
| 1550 | +/* | |
| 1551 | +** Add an "Wiki" button in a submenu for a Wiki page. | |
| 1552 | +*/ | |
| 1553 | +static void wiki_section_menu( | |
| 1554 | + const char *zPrefix, /* "branch", "tag", or "checkin" */ | |
| 1555 | + const char *zName, /* Name of the object */ | |
| 1556 | + unsigned int mFlags /* Zero or more WIKIASSOC_* flags */ | |
| 1557 | +){ | |
| 1558 | + if( g.perm.WrWiki && (mFlags & WIKIASSOC_MENU)!=0 ){ | |
| 1559 | + style_submenu_element("Wiki", "%R/wiki?name=%s/%t", zPrefix, zName); | |
| 1560 | + } | |
| 1561 | +} | |
| 1542 | 1562 | |
| 1543 | 1563 | /* |
| 1544 | 1564 | ** Check to see if there exists a wiki page with a name zPrefix/zName. |
| 1545 | 1565 | ** If there is, then render a <div class='section'>..</div> and |
| 1546 | 1566 | ** return true. |
| @@ -1573,37 +1593,40 @@ | ||
| 1573 | 1593 | if( blob_size(&title) ){ |
| 1574 | 1594 | @ <div class="section">%h(blob_str(&title))</div> |
| 1575 | 1595 | }else{ |
| 1576 | 1596 | wiki_section_label(zPrefix, zName, mFlags); |
| 1577 | 1597 | } |
| 1598 | + wiki_section_menu(zPrefix, zName, mFlags); | |
| 1578 | 1599 | convert_href_and_output(&tail); |
| 1579 | 1600 | blob_reset(&tail); |
| 1580 | 1601 | blob_reset(&title); |
| 1581 | 1602 | blob_reset(&markdown); |
| 1582 | 1603 | }else if( fossil_strcmp(pWiki->zMimetype, "text/plain")==0 ){ |
| 1583 | 1604 | wiki_section_label(zPrefix, zName, mFlags); |
| 1605 | + wiki_section_menu(zPrefix, zName, mFlags); | |
| 1584 | 1606 | @ <pre> |
| 1585 | 1607 | @ %h(pWiki->zWiki) |
| 1586 | 1608 | @ </pre> |
| 1587 | 1609 | }else{ |
| 1588 | 1610 | Blob tail = BLOB_INITIALIZER; |
| 1589 | 1611 | Blob title = BLOB_INITIALIZER; |
| 1590 | 1612 | Blob wiki; |
| 1613 | + Blob *pBody; | |
| 1591 | 1614 | blob_init(&wiki, pWiki->zWiki, -1); |
| 1592 | 1615 | if( wiki_find_title(&wiki, &title, &tail) ){ |
| 1593 | 1616 | @ <div class="section">%h(blob_str(&title))</div> |
| 1594 | - @ <div class="wiki"> | |
| 1595 | - wiki_convert(&tail, 0, WIKI_BUTTONS); | |
| 1596 | - @ </div> | |
| 1617 | + pBody = &tail; | |
| 1597 | 1618 | }else{ |
| 1598 | 1619 | wiki_section_label(zPrefix, zName, mFlags); |
| 1599 | - @ <div class="wiki"> | |
| 1600 | - wiki_convert(&wiki, 0, WIKI_BUTTONS); | |
| 1601 | - @ </div> | |
| 1620 | + pBody = &wiki; | |
| 1602 | 1621 | } |
| 1622 | + wiki_section_menu(zPrefix, zName, mFlags); | |
| 1623 | + @ <div class="wiki"> | |
| 1624 | + wiki_convert(pBody, 0, WIKI_BUTTONS); | |
| 1625 | + @ </div> | |
| 1603 | 1626 | blob_reset(&tail); |
| 1604 | 1627 | blob_reset(&title); |
| 1605 | 1628 | blob_reset(&wiki); |
| 1606 | 1629 | } |
| 1607 | 1630 | manifest_destroy(pWiki); |
| 1608 | 1631 | return 1; |
| 1609 | 1632 | } |
| 1610 | 1633 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -343,10 +343,38 @@ | |
| 343 | style_header("Wiki Search"); |
| 344 | wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX); |
| 345 | search_screen(SRCH_WIKI, 0); |
| 346 | style_footer(); |
| 347 | } |
| 348 | |
| 349 | /* |
| 350 | ** WEBPAGE: wiki |
| 351 | ** URL: /wiki?name=PAGENAME |
| 352 | */ |
| @@ -410,11 +438,11 @@ | |
| 410 | style_submenu_element("History", "%s/whistory?name=%T", |
| 411 | g.zTop, zPageName); |
| 412 | } |
| 413 | } |
| 414 | style_set_current_page("%T?name=%T", g.zPath, zPageName); |
| 415 | style_header("%s", zPageName); |
| 416 | wiki_standard_submenu(submenuFlags); |
| 417 | if( zBody[0]==0 ){ |
| 418 | @ <i>This page has been deleted</i> |
| 419 | }else{ |
| 420 | blob_init(&wiki, zBody, -1); |
| @@ -579,33 +607,11 @@ | |
| 579 | } |
| 580 | if( zBody==0 ){ |
| 581 | zBody = mprintf("<i>Empty Page</i>"); |
| 582 | } |
| 583 | style_set_current_page("%T?name=%T", g.zPath, zPageName); |
| 584 | |
| 585 | if( db_get_boolean("wiki-about",1)==0 ){ |
| 586 | style_header("Edit: %s", zPageName); |
| 587 | }else |
| 588 | if( sqlite3_strglob("checkin/*", zPageName)==0 |
| 589 | && db_exists("SELECT 1 FROM blob WHERE uuid=%Q",zPageName+8) |
| 590 | ){ |
| 591 | style_header("Notes About Checkin %S", zPageName + 8); |
| 592 | style_submenu_element("Checkin Timeline","%R/timeline?f=%s",zPageName + 8); |
| 593 | style_submenu_element("Checkin Info","%R/info/%s",zPageName + 8); |
| 594 | }else |
| 595 | if( sqlite3_strglob("branch/*", zPageName)==0 ){ |
| 596 | style_header("Notes About Branch %h", zPageName + 7); |
| 597 | style_submenu_element("Branch Timeline","%R/timeline?r=%t",zPageName + 7); |
| 598 | }else |
| 599 | if( sqlite3_strglob("tag/*", zPageName)==0 ){ |
| 600 | style_header("Notes About Tag %h", zPageName + 4); |
| 601 | style_submenu_element("Tag Timeline","%R/timeline?t=%t",zPageName + 4); |
| 602 | } |
| 603 | else{ |
| 604 | style_header("Edit: %s", zPageName); |
| 605 | } |
| 606 | |
| 607 | if( rid && !isSandbox && g.perm.ApndWiki ){ |
| 608 | if( g.perm.Attach ){ |
| 609 | style_submenu_element("Attach", |
| 610 | "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T", |
| 611 | g.zTop, zPageName, g.zTop, zPageName); |
| @@ -1519,10 +1525,11 @@ | |
| 1519 | /* |
| 1520 | ** Allowed flags for wiki_render_associated |
| 1521 | */ |
| 1522 | #if INTERFACE |
| 1523 | #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */ |
| 1524 | #endif |
| 1525 | |
| 1526 | /* |
| 1527 | ** Show the default Section label for an associated wiki page. |
| 1528 | */ |
| @@ -1537,10 +1544,23 @@ | |
| 1537 | @ <div class="section">About checkin %.20h(zName)</div> |
| 1538 | }else{ |
| 1539 | @ <div class="section">About %s(zPrefix) %h(zName)</div> |
| 1540 | } |
| 1541 | } |
| 1542 | |
| 1543 | /* |
| 1544 | ** Check to see if there exists a wiki page with a name zPrefix/zName. |
| 1545 | ** If there is, then render a <div class='section'>..</div> and |
| 1546 | ** return true. |
| @@ -1573,37 +1593,40 @@ | |
| 1573 | if( blob_size(&title) ){ |
| 1574 | @ <div class="section">%h(blob_str(&title))</div> |
| 1575 | }else{ |
| 1576 | wiki_section_label(zPrefix, zName, mFlags); |
| 1577 | } |
| 1578 | convert_href_and_output(&tail); |
| 1579 | blob_reset(&tail); |
| 1580 | blob_reset(&title); |
| 1581 | blob_reset(&markdown); |
| 1582 | }else if( fossil_strcmp(pWiki->zMimetype, "text/plain")==0 ){ |
| 1583 | wiki_section_label(zPrefix, zName, mFlags); |
| 1584 | @ <pre> |
| 1585 | @ %h(pWiki->zWiki) |
| 1586 | @ </pre> |
| 1587 | }else{ |
| 1588 | Blob tail = BLOB_INITIALIZER; |
| 1589 | Blob title = BLOB_INITIALIZER; |
| 1590 | Blob wiki; |
| 1591 | blob_init(&wiki, pWiki->zWiki, -1); |
| 1592 | if( wiki_find_title(&wiki, &title, &tail) ){ |
| 1593 | @ <div class="section">%h(blob_str(&title))</div> |
| 1594 | @ <div class="wiki"> |
| 1595 | wiki_convert(&tail, 0, WIKI_BUTTONS); |
| 1596 | @ </div> |
| 1597 | }else{ |
| 1598 | wiki_section_label(zPrefix, zName, mFlags); |
| 1599 | @ <div class="wiki"> |
| 1600 | wiki_convert(&wiki, 0, WIKI_BUTTONS); |
| 1601 | @ </div> |
| 1602 | } |
| 1603 | blob_reset(&tail); |
| 1604 | blob_reset(&title); |
| 1605 | blob_reset(&wiki); |
| 1606 | } |
| 1607 | manifest_destroy(pWiki); |
| 1608 | return 1; |
| 1609 | } |
| 1610 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -343,10 +343,38 @@ | |
| 343 | style_header("Wiki Search"); |
| 344 | wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX); |
| 345 | search_screen(SRCH_WIKI, 0); |
| 346 | style_footer(); |
| 347 | } |
| 348 | |
| 349 | /* |
| 350 | ** Add an appropriate style_header() for either the /wiki or /wikiedit page |
| 351 | ** for zPageName. |
| 352 | */ |
| 353 | static void wiki_page_header(const char *zPageName, const char *zExtra){ |
| 354 | if( db_get_boolean("wiki-about",1)==0 ){ |
| 355 | style_header("%s%s", zExtra, zPageName); |
| 356 | }else |
| 357 | if( sqlite3_strglob("checkin/*", zPageName)==0 |
| 358 | && db_exists("SELECT 1 FROM blob WHERE uuid=%Q",zPageName+8) |
| 359 | ){ |
| 360 | style_header("Notes About Checkin %S", zPageName + 8); |
| 361 | style_submenu_element("Checkin Timeline","%R/timeline?f=%s",zPageName + 8); |
| 362 | style_submenu_element("Checkin Info","%R/info/%s",zPageName + 8); |
| 363 | }else |
| 364 | if( sqlite3_strglob("branch/*", zPageName)==0 ){ |
| 365 | style_header("Notes About Branch %h", zPageName + 7); |
| 366 | style_submenu_element("Branch Timeline","%R/timeline?r=%t",zPageName + 7); |
| 367 | }else |
| 368 | if( sqlite3_strglob("tag/*", zPageName)==0 ){ |
| 369 | style_header("Notes About Tag %h", zPageName + 4); |
| 370 | style_submenu_element("Tag Timeline","%R/timeline?t=%t",zPageName + 4); |
| 371 | } |
| 372 | else{ |
| 373 | style_header("%s%s", zExtra, zPageName); |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | /* |
| 378 | ** WEBPAGE: wiki |
| 379 | ** URL: /wiki?name=PAGENAME |
| 380 | */ |
| @@ -410,11 +438,11 @@ | |
| 438 | style_submenu_element("History", "%s/whistory?name=%T", |
| 439 | g.zTop, zPageName); |
| 440 | } |
| 441 | } |
| 442 | style_set_current_page("%T?name=%T", g.zPath, zPageName); |
| 443 | wiki_page_header(zPageName, ""); |
| 444 | wiki_standard_submenu(submenuFlags); |
| 445 | if( zBody[0]==0 ){ |
| 446 | @ <i>This page has been deleted</i> |
| 447 | }else{ |
| 448 | blob_init(&wiki, zBody, -1); |
| @@ -579,33 +607,11 @@ | |
| 607 | } |
| 608 | if( zBody==0 ){ |
| 609 | zBody = mprintf("<i>Empty Page</i>"); |
| 610 | } |
| 611 | style_set_current_page("%T?name=%T", g.zPath, zPageName); |
| 612 | wiki_page_header(zPageName, "Edit: "); |
| 613 | if( rid && !isSandbox && g.perm.ApndWiki ){ |
| 614 | if( g.perm.Attach ){ |
| 615 | style_submenu_element("Attach", |
| 616 | "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T", |
| 617 | g.zTop, zPageName, g.zTop, zPageName); |
| @@ -1519,10 +1525,11 @@ | |
| 1525 | /* |
| 1526 | ** Allowed flags for wiki_render_associated |
| 1527 | */ |
| 1528 | #if INTERFACE |
| 1529 | #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */ |
| 1530 | #define WIKIASSOC_MENU 0x00002 /* Add a submenu to the About section */ |
| 1531 | #endif |
| 1532 | |
| 1533 | /* |
| 1534 | ** Show the default Section label for an associated wiki page. |
| 1535 | */ |
| @@ -1537,10 +1544,23 @@ | |
| 1544 | @ <div class="section">About checkin %.20h(zName)</div> |
| 1545 | }else{ |
| 1546 | @ <div class="section">About %s(zPrefix) %h(zName)</div> |
| 1547 | } |
| 1548 | } |
| 1549 | |
| 1550 | /* |
| 1551 | ** Add an "Wiki" button in a submenu for a Wiki page. |
| 1552 | */ |
| 1553 | static void wiki_section_menu( |
| 1554 | const char *zPrefix, /* "branch", "tag", or "checkin" */ |
| 1555 | const char *zName, /* Name of the object */ |
| 1556 | unsigned int mFlags /* Zero or more WIKIASSOC_* flags */ |
| 1557 | ){ |
| 1558 | if( g.perm.WrWiki && (mFlags & WIKIASSOC_MENU)!=0 ){ |
| 1559 | style_submenu_element("Wiki", "%R/wiki?name=%s/%t", zPrefix, zName); |
| 1560 | } |
| 1561 | } |
| 1562 | |
| 1563 | /* |
| 1564 | ** Check to see if there exists a wiki page with a name zPrefix/zName. |
| 1565 | ** If there is, then render a <div class='section'>..</div> and |
| 1566 | ** return true. |
| @@ -1573,37 +1593,40 @@ | |
| 1593 | if( blob_size(&title) ){ |
| 1594 | @ <div class="section">%h(blob_str(&title))</div> |
| 1595 | }else{ |
| 1596 | wiki_section_label(zPrefix, zName, mFlags); |
| 1597 | } |
| 1598 | wiki_section_menu(zPrefix, zName, mFlags); |
| 1599 | convert_href_and_output(&tail); |
| 1600 | blob_reset(&tail); |
| 1601 | blob_reset(&title); |
| 1602 | blob_reset(&markdown); |
| 1603 | }else if( fossil_strcmp(pWiki->zMimetype, "text/plain")==0 ){ |
| 1604 | wiki_section_label(zPrefix, zName, mFlags); |
| 1605 | wiki_section_menu(zPrefix, zName, mFlags); |
| 1606 | @ <pre> |
| 1607 | @ %h(pWiki->zWiki) |
| 1608 | @ </pre> |
| 1609 | }else{ |
| 1610 | Blob tail = BLOB_INITIALIZER; |
| 1611 | Blob title = BLOB_INITIALIZER; |
| 1612 | Blob wiki; |
| 1613 | Blob *pBody; |
| 1614 | blob_init(&wiki, pWiki->zWiki, -1); |
| 1615 | if( wiki_find_title(&wiki, &title, &tail) ){ |
| 1616 | @ <div class="section">%h(blob_str(&title))</div> |
| 1617 | pBody = &tail; |
| 1618 | }else{ |
| 1619 | wiki_section_label(zPrefix, zName, mFlags); |
| 1620 | pBody = &wiki; |
| 1621 | } |
| 1622 | wiki_section_menu(zPrefix, zName, mFlags); |
| 1623 | @ <div class="wiki"> |
| 1624 | wiki_convert(pBody, 0, WIKI_BUTTONS); |
| 1625 | @ </div> |
| 1626 | blob_reset(&tail); |
| 1627 | blob_reset(&title); |
| 1628 | blob_reset(&wiki); |
| 1629 | } |
| 1630 | manifest_destroy(pWiki); |
| 1631 | return 1; |
| 1632 | } |
| 1633 |