Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | minor refactorings to the wiki commands |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
bfb4d414dda55cc41956eefd176eada6 |
User & Date: | stephan 2008-05-15 20:26:25.000 |
Context
2008-05-15
| ||
20:28 | removed as part of the /doc port ... (check-in: fda26ca3 user: stephan tags: trunk) | |
20:26 | minor refactorings to the wiki commands ... (check-in: bfb4d414 user: stephan tags: trunk) | |
20:25 | initial ports of static .html to static /doc .wiki ... (check-in: d87ca60c user: stephan tags: trunk) | |
Changes
Changes to src/wiki.c.
1 2 3 4 5 6 7 8 9 | /* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of | > | 1 2 3 4 5 6 7 8 9 10 | /* ** Copyright (c) 2007 D. Richard Hipp ** Copyright (c) 2008 Stephan Beal ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
︙ | ︙ | |||
597 598 599 600 601 602 603 | @ disables all wiki formatting rules through the matching @ </nowiki> element. @ </ol> style_footer(); } /* | | < < < < < > > | > > > > > > > > > > > > | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | @ disables all wiki formatting rules through the matching @ </nowiki> element. @ </ol> style_footer(); } /* ** wiki_cmd_commit() is the implementation of "wiki commit ...". ** ** As arguments it expects: ** ** zPageName = the wiki entry's name. ** ** in = input file. The file is read until EOF but is not closed ** by this function (it might be stdin!). ** ** Returns 0 on error, non-zero on success. ** ** TODOs: ** - take EITHER zPageName OR rid. We don't need both. ** - make use of the return value. Add more error checking. ** - give the uuid back to the caller so it can be shown ** in the status output. ("committed version XXXXX of page ...") ** - return some status telling the user if there were no diffs ** (i.e. no commit). How can we find this out? */ int wiki_cmd_commit( char const * zPageName, FILE * in ) { Blob wiki; /* Wiki page content */ Blob content; /* read-in content */ Blob cksum; /* wiki checksum */ int rid; /* rid of existing entry. */ int nrid; /* not really sure */ char * zDate; /* timestamp */ char * zUuid; /* uuid for rid */ rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x" " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" " ORDER BY x.mtime DESC LIMIT 1", zPageName ); if( ! rid ){ fossil_fatal("wiki commit NewEntry not yet implemented."); } blob_read_from_channel( &content, in, -1 ); // ^^^ Reminder: we should allow empty (zero-byte) entries, so don't exit // if read returns 0. blob_zero(&wiki); zDate = db_text(0, "SELECT datetime('now')"); zDate[10] = 'T'; blob_appendf(&wiki, "D %s\n", zDate); |
︙ | ︙ | |||
751 752 753 754 755 756 757 | fossil_fatal("wiki page [%s] not found",zPageName); } for(i=strlen(zBody); i>0 && isspace(zBody[i-1]); i--){} printf("%.*s\n", i, zBody); return; }else if( strncmp(g.argv[2],"commit",n)==0 ){ | < < < < < < < < < | | 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | fossil_fatal("wiki page [%s] not found",zPageName); } for(i=strlen(zBody); i>0 && isspace(zBody[i-1]); i--){} printf("%.*s\n", i, zBody); return; }else if( strncmp(g.argv[2],"commit",n)==0 ){ char *zPageName; if( g.argc!=4 ){ usage("commit PAGENAME"); } zPageName = g.argv[3]; wiki_cmd_commit( zPageName, stdin ); printf("Committed wiki page %s.\n", zPageName); }else if( strncmp(g.argv[2],"delete",n)==0 ){ if( g.argc!=5 ){ usage("delete PAGENAME"); } fossil_fatal("delete not yet implemented."); |
︙ | ︙ | |||
792 793 794 795 796 797 798 | }else { goto wiki_cmd_usage; } return; wiki_cmd_usage: | | | 793 794 795 796 797 798 799 800 801 | }else { goto wiki_cmd_usage; } return; wiki_cmd_usage: usage("export|commit|list ..."); } |