Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Clean up and merge updates from trunk |
|---|---|
| Timelines: | family | ancestors | descendants | both | creole |
| Files: | files | file ages | folders |
| SHA1: |
7a39dde24bbc2436e41d32085410b76f |
| User & Date: | robert 2009-09-26 08:17:33.000 |
Context
|
2009-09-26
| ||
| 14:33 | Minor fixes to creole check-in: cacb8db398 user: robert tags: creole | |
| 08:17 | Clean up and merge updates from trunk check-in: 7a39dde24b user: robert tags: creole | |
|
2009-09-23
| ||
| 16:54 | place the cursor in the username text box on the login screen. check-in: ca08c1d1b3 user: rwilson tags: trunk | |
|
2009-09-22
| ||
| 07:49 | merge trunk into creole branch check-in: 7a2c37063a user: bob tags: creole | |
Changes
Changes to src/configure.c.
| ︙ | ︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
static struct {
const char *zName; /* Name of the configuration parameter */
int groupMask; /* Which config groups is it part of */
} aConfig[] = {
{ "css", CONFIGSET_SKIN },
{ "header", CONFIGSET_SKIN },
{ "footer", CONFIGSET_SKIN },
{ "project-name", CONFIGSET_PROJ },
{ "project-description", CONFIGSET_PROJ },
{ "index-page", CONFIGSET_SKIN },
{ "timeline-block-markup", CONFIGSET_SKIN },
{ "timeline-max-comment", CONFIGSET_SKIN },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
| > > | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
static struct {
const char *zName; /* Name of the configuration parameter */
int groupMask; /* Which config groups is it part of */
} aConfig[] = {
{ "css", CONFIGSET_SKIN },
{ "header", CONFIGSET_SKIN },
{ "footer", CONFIGSET_SKIN },
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "project-name", CONFIGSET_PROJ },
{ "project-description", CONFIGSET_PROJ },
{ "index-page", CONFIGSET_SKIN },
{ "timeline-block-markup", CONFIGSET_SKIN },
{ "timeline-max-comment", CONFIGSET_SKIN },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
|
| ︙ | ︙ |
Changes to src/creoleparser.c.
| ︙ | ︙ | |||
26 27 28 29 30 31 32 | ** This file contains code to render creole 1.0 formated text as html. */ #include <assert.h> #include "config.h" #include "creoleparser.h" #if INTERFACE | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
** This file contains code to render creole 1.0 formated text as html.
*/
#include <assert.h>
#include "config.h"
#include "creoleparser.h"
#if INTERFACE
#define HAVE_CREOLE_MACRO 1
#endif
//{{{ LOCAL INTERFACE
#if LOCAL_INTERFACE
#define POOL_CHUNK_SIZE 100
|
| ︙ | ︙ | |||
59 60 61 62 63 64 65 |
#define KIND_MONOSPACED 0x0004000
#define KIND_BREAK 0x0008000
#define KIND_TABLE_ROW 0x0010000
//}}}
//{{{ FLAG
// keep first four bits free
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < < < < < < < < < < < < < < | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 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 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 |
#define KIND_MONOSPACED 0x0004000
#define KIND_BREAK 0x0008000
#define KIND_TABLE_ROW 0x0010000
//}}}
//{{{ FLAG
// keep first four bits free
#define FLAG_CENTER 0x0000100
//}}}
struct Node {//{{{
char *start;
char *end;
int kind;
int level;
int flags;
Node *parent;
Node *next;
Node *children;
};
//}}}
struct NodePool {//{{{
NodePool *next;
Node a[POOL_CHUNK_SIZE];
}
//}}}
struct Parser {//{{{
Blob *pOut; /* Output appended to this blob */
Renderer *r;
NodePool *pool;
int nFree;
Node *this;
Node *previous;
Node *list;
char *cursor;
int lineWasBlank;
int charCount;
Node *item;
Node *istack;
char *icursor;
char *iend;
int inLink;
int inTable;
int iesc;
Blob *iblob;
};
//}}}
#endif
const int KIND_LIST = (KIND_UNORDERED_LIST | KIND_ORDERED_LIST);
const int KIND_LIST_OR_PARAGRAPH = (KIND_PARAGRAPH | KIND_UNORDERED_LIST | KIND_ORDERED_LIST);
//}}}
//{{{ POOL MANAGEMENT
static Node *pool_new(Parser *p){
if ( p->pool == NULL || p->nFree == 0){
NodePool *temp = p->pool;
p->pool = malloc(sizeof(NodePool));
if( p->pool == NULL ) fossil_panic("out of memory");
p->pool->next = temp;
p->nFree = POOL_CHUNK_SIZE;
}
p->nFree -= 1;
Node *node = &(p->pool->a[p->nFree]);
memset(node, 0, sizeof(*node));
return node;
}
static void pool_free(Parser *p){
NodePool *temp;
while (p->pool != NULL){
temp = p->pool;
p->pool = temp->next;
free(temp);
}
}
//}}}
//{{{ Utility Methods
static char *cr_skipBlanks(Parser *p, char* z){//{{{
char *s = z;
while (z[0] == ' ' || z[0] == '\t') z++;
p->charCount = z - s;
return z;
}
//}}}
static int cr_countBlanks(Parser *p, char* z){//{{{
cr_skipBlanks(p, z);
return p->charCount;
}
//}}}
static char *cr_skipChars(Parser *p, char *z, char c){//{{{
char *s = z;
while (z[0] == c) z++;
p->charCount = z - s;
return z;
}
//}}}
static int cr_countChars(Parser *p, char *z, char c){//{{{
cr_skipChars(p, z, c);
return p->charCount;
}
//}}}
static char *cr_nextLine(Parser *p, char *z){//{{{
p->lineWasBlank = 1;
while (1){
switch (z[0]){
case '\r':
if (z[1] == '\n') {
z[0] = ' ';
return z + 2;
}
z[0] = '\n';
return z + 1;
case'\n':
return z + 1;
case '\t':
z[0] = ' ';
z++;
break;
case ' ':
z++;
break;
case '\0':
return z;
default:
p->lineWasBlank = 0;
z++;
}
}
}
//}}}
//}}}
//{{{ INLINE PARSER
static int cr_isEsc(Parser *p){//{{{
if (p->iesc){
blob_append(p->iblob, p->icursor, 1);
p->iesc = 0;
p->icursor += 1;
return 1;
}
return 0;
}
//}}}
static int cr_iOpen(Parser *p, int kind){//{{{
switch (kind){
case KIND_BOLD:
blob_append(p->iblob, "<strong>", 8);
return 1;
case KIND_ITALIC:
blob_append(p->iblob, "<em>", 4);
return 1;
case KIND_SUPERSCRIPT:
blob_append(p->iblob, "<sup>", 5);
return 1;
case KIND_SUBSCRIPT:
blob_append(p->iblob, "<sub>", 5);
return 1;
case KIND_MONOSPACED:
blob_append(p->iblob, "<tt>", 4);
return 1;
}
return 0;
}
//}}}
static int cr_iClose(Parser *p, int kind){//{{{
switch (kind){
case KIND_BOLD:
blob_append(p->iblob, "</strong>", 9);
return 1;
case KIND_ITALIC:
blob_append(p->iblob, "</em>", 5);
return 1;
case KIND_SUPERSCRIPT:
blob_append(p->iblob, "</sup>", 6);
return 1;
case KIND_SUBSCRIPT:
blob_append(p->iblob, "</sub>", 6);
return 1;
case KIND_MONOSPACED:
blob_append(p->iblob, "</tt>", 5);
return 1;
}
return 0;
}
//}}}
static void cr_iMarkup(Parser *p, int kind){//{{{
if (p->iesc) {
blob_append(p->iblob, p->icursor, 1);
p->icursor +=1;
p->iesc =0;
return;
}
if (p->icursor[1] != p->icursor[0]) {
blob_append(p->iblob, p->icursor, 1);
p->icursor +=1;
return;
}
p->icursor += 2;
if (kind & KIND_BREAK) {
blob_append(p->iblob, "<br />", 6);
return;
}
if (kind & KIND_ITALIC && p->icursor[-3] == ':'){
blob_append(p->iblob, "//", 2);
return;
}
Node *n = p->istack;
int found = 0;
while (n) {
if (n->kind & kind) {
found = 1;
break;
}
n = n->next;
}
if (!found) {
n = pool_new(p);
n->kind = kind;
n->next = p->istack;
p->istack = n;
assert(cr_iOpen(p, kind));
return;
};
n= p->istack;
while (n){
p->istack = n->next;
assert(cr_iClose(p, n->kind));
if (kind == n->kind) return;
n = p->istack;
}
}
//}}}
static int cr_iNoWiki(Parser *p){//{{{
if ((p->iend - p->icursor)<6) return 0;
if (p->icursor[1]!='{' || p->icursor[2]!='{')
return 0;
char *s = p->icursor + 3;
int count = p->iend - p->icursor - 6;
while (count--){
if (s[0]=='}' && s[1]=='}' && s[2]=='}' && s[3]!='}'){
blob_appendf(p->iblob, "<tt style='background:oldlace'>%s</tt>", htmlize(p->icursor + 3, s - p->icursor-3));
p->icursor = s + 3;
return 1;
}
s++;
}
return 0;
}
//}}}
static int cr_iImage(Parser *p){//{{{
if (p->inLink) return 0;
if ((p->iend - p->icursor)<3) return 0;
if (p->icursor[1]!='{') return 0;
char *s = p->icursor + 2;
char *bar = NULL;
int count = p->iend - p->icursor - 4;
while (count--){
if (s[0]=='}' && s[1]=='}'){
if (!bar) bar = p->icursor + 2;
blob_appendf(p->iblob, "<span style='color:green;border:1px solid green;'>%s</span>", htmlize(bar, s - bar ));
p->icursor = s + 2;
return 1;
}
if (!bar && s[0]=='|') bar=s+1;
s++;
}
return 0;
}
//}}}
static int cr_iMacro(Parser *p){//{{{
if (p->inLink) return 0;
if ((p->iend - p->icursor)<3) return 0;
if (p->icursor[1]!='<') return 0;
char *s = p->icursor + 2;
int count = p->iend - p->icursor - 3;
while (count--){
blob_appendf(p->iblob, "|~%s|", s,2 );
if (s[0]=='>' && s[1]=='>'){
blob_appendf(p->iblob, "<span style='color:red;border:1px solid red;'>%s</span>", htmlize(p->icursor, s - p->icursor + 2));
p->icursor = s + 2;
return 1;
}
s++;
}
return 0;
}
//}}}
static void cr_renderLink(Parser *p, char *s, char *bar, char *e){//{{{
int tsize = bar-s;
int dsize = e - bar-1;
if (tsize < 1) return;
if (dsize < 1) dsize = 0;
char zTarget[tsize + 1];
memcpy(zTarget, s, tsize);
zTarget[tsize] = '\0';
char zClose[20];
Blob *pOut = p->r->pOut;
p->r->pOut = p->iblob;
wf_openHyperlink(p->r, zTarget, zClose, sizeof(zClose));
p->r->pOut = pOut;
if (dsize)
cr_parseInline(p, bar+1, e) ;
else
blob_append(p->iblob, htmlize(s, tsize), -1);
blob_append(p->iblob, zClose, -1);
}
//}}}
static int cr_iLink(Parser *p){//{{{
if (p->inLink) return 0;
if ((p->iend - p->icursor)<3) return 0;
if (p->icursor[1]!='[') return 0;
char *s = p->icursor + 2;
char *bar = NULL;
int count = p->iend - p->icursor -3;
while (count--){
if (s[0]==']' && s[1]==']'){
if (!bar) bar = s;
p->inLink = 1;
cr_renderLink(p, p->icursor+2, bar, s);
p->inLink = 0;
p->icursor = s + 2;
return 1;
}
if (!bar && s[0]=='|') bar=s;
s++;
}
return 0;
}
//}}}
LOCAL char *cr_parseInline(Parser *p, char *s, char *e){//{{{
int save_iesc = p->iesc;
char *save_iend = p->iend;
Node *save_istack = p->istack;
p->iesc = 0;
p->iend = e;
p->istack = NULL;
p->icursor = s;
char *eof = NULL;
while (!eof && p->icursor < p->iend ){
switch (*p->icursor) {//{{{
case '~':
if (p->iesc) {
blob_append(p->iblob, "~", 1);
p->iesc = 0;
}
p->iesc = !p->iesc;
p->icursor+=1;
break;
case '*':
cr_iMarkup(p, KIND_BOLD);
break;
case '/':
cr_iMarkup(p, KIND_ITALIC);
break;
case '^':
cr_iMarkup(p, KIND_SUPERSCRIPT);
break;
case ',':
cr_iMarkup(p, KIND_SUBSCRIPT);
break;
case '#':
cr_iMarkup(p, KIND_MONOSPACED);
break;
case '\\':
cr_iMarkup(p, KIND_BREAK);
break;
case '{':
if (cr_isEsc(p)) break;
if (cr_iNoWiki(p)) break;
if (cr_iImage(p)) break;
blob_append(p->iblob, p->icursor, 1);
p->icursor += 1;
break;
case '[':
if (cr_isEsc(p)) break;
if (cr_iLink(p)) break;
blob_append(p->iblob, p->icursor, 1);
p->icursor += 1;
break;
case '<':
if (cr_isEsc(p)) break;
if (cr_iMacro(p)) break;
blob_append(p->iblob, "<", 4);
p->icursor += 1;
break;
case '>':
if (p->iesc) {
blob_append(p->iblob, "~", 1);
p->iesc = 0;
}
blob_append(p->iblob, ">", 4);
p->icursor += 1;
break;
case '&':
if (p->iesc) {
blob_append(p->iblob, "~", 1);
p->iesc = 0;
}
blob_append(p->iblob, "&", 5);
p->icursor += 1;
break;
case '|':
if (p->inTable){
if (p->iesc) {
blob_append(p->iblob, p->icursor, 1);
p->iesc = 0;
p->icursor += 1;
break;
}
eof = p->icursor + 1;
break;
}
// fall through to default
default:
if (p->iesc) {
blob_append(p->iblob, "~", 1);
p->iesc = 0;
}
blob_append(p->iblob, p->icursor, 1);
p->icursor +=1;
}//}}}
}
while (p->istack){
cr_iClose(p, p->istack->kind);
p->istack = p->istack->next;
}
p->iesc = save_iesc;
p->iend = save_iend;
p->istack = save_istack;
return eof;
}
//}}}
//}}}
//{{{ BLOCK PARSER
static void cr_renderListItem(Parser *p, Node *n){//{{{
blob_append(p->iblob, "<li>", 4);
cr_parseInline(p, n->start, n->end);
if (n->children){
int ord = (n->children->kind & KIND_ORDERED_LIST);
if (ord) blob_append(p->iblob, "<ol>", 4);
else blob_append(p->iblob, "<ul>", 4);
n = n->children;
while (n){
cr_renderListItem(p, n);
n = n->next;
}
if (ord) blob_append(p->iblob, "</ol>", 5);
else blob_append(p->iblob, "</ul>", 5);
}
blob_append(p->iblob, "</li>", 5);
}
//}}}
static void cr_renderList(Parser *p){//{{{
Node *n = p->list;
while (n->parent !=n) n = n->parent;
int ord = (n->kind & KIND_ORDERED_LIST);
if (ord) blob_append(p->iblob, "\n\n<ol>", -1);
else blob_append(p->iblob, "\n\n<ul>", -1);
while (n) {
cr_renderListItem(p, n);
n = n->next;
}
if (ord) blob_append(p->iblob, "</ol>", 5);
else blob_append(p->iblob, "</ul>", 5);
}
//}}}
static void cr_renderTableRow(Parser *p, Node *row){//{{{
char *s = row->start;
int th;
blob_append(p->iblob, "\n<tr>", -1);
while (s && s < row->end){
if ((th = *s == '=')) {
s++;
blob_append(p->iblob, "<th>", -1);
}
else {
blob_append(p->iblob, "<td>", -1);
}
s = cr_parseInline(p, s, row->end);
if (th)
blob_append(p->iblob, "</th>\n", -1);
else
blob_append(p->iblob, "</td>\n", -1);
if (!s) break;
}
blob_append(p->iblob, "</tr>", 5);
}
//}}}
static void cr_renderTable(Parser *p, Node *n){//{{{
Node *row = n->children;
blob_append(p->iblob, "<table class='creoletable'>", -1);
p->inTable = 1;
while (row){
cr_renderTableRow(p, row);
row = row->next;
}
blob_append(p->iblob, "</table>", -1);
p->inTable = 0;
}
//}}}
static void cr_render(Parser *p, Node *node){//{{{
if (node->kind & KIND_PARAGRAPH){
blob_append(p->iblob, "\n<p>", -1);
cr_parseInline(p, node->start, node->end );
blob_append(p->iblob, "</p>\n", -1 );
}
if (node->kind & KIND_HEADING){
blob_appendf(p->iblob,
"\n<h%d %s>",
node->level,
(node->flags & FLAG_CENTER) ? " style='text-align:center;'" : ""
);
cr_parseInline(p, node->start, node->end);
blob_appendf(p->iblob, "</h%d>\n", node->level );
return;
}
if (node->kind & KIND_HORIZONTAL_RULE){
blob_append(p->iblob, "<hr />", -1);
return;
}
if (node->kind & KIND_LIST){
cr_renderList(p);
p->list = NULL;
return;
}
if (node->kind & KIND_TABLE){
cr_renderTable(p, node);
return;
}
if (node->kind & KIND_NO_WIKI_BLOCK){
blob_appendf(p->iblob,
"\n<blockquote style='background:oldlace'><pre>%s</pre></blockquote>\n",
htmlize( node->start, node->end - node->start)
);
}
}
//}}}
static char *cr_findEndOfBlock(Parser *p, char *s, char c){//{{{
char *end;
while (s[0]){
end = s;
if (s[0] == c && s[0] == c && s[0] == c) {
s = cr_nextLine(p, s + 3);
if (p->lineWasBlank) {
p->cursor = s;
return end;
}
}
else {
s = cr_nextLine(p, s);
}
}
return 0;
}
//}}}
static int cr_addListItem(Parser *p, Node *n){//{{{
n->parent = n;
n->next = n->children = NULL;
if (!p->list) {
if (n->level != 1) return 0;
p->list = n;
return 1;
}
Node *list = p->list;
while (n->level < list->level){
list = list->parent;
}
if (n->level == list->level){
if (n->kind != list->kind){
if (n->level>1) return 0;
cr_renderList(p);
p->list = n;
return 1;
}
n->parent = list->parent;
p->list = list->next = n;
return 1;
}
if ( (n->level - list->level) > 1 ) return 0;
n->parent = p->list;
p->list->children = n;
p->list = n;
return 1;
}
//}}}
static int isEndWikiMarker(Parser *p){//{{{
char *s = p->cursor;
if (memcmp(s, "<<fossil>>", 10)) return 0;
p->this->start = s;
p->this->kind = KIND_END_WIKI_MARKER;
p->cursor += 10;
return 1;
}
///}}}
static int isNoWikiBlock(Parser *p){//{{{
char *s = p->cursor;
if (s[0] != '{') return 0; s++;
if (s[0] != '{') return 0; s++;
if (s[0] != '{') return 0; s++;
s = cr_nextLine(p, s);
if (!p->lineWasBlank) return 0;
p->this->start = s;
s = cr_findEndOfBlock(p, s, '}');
if (!s) return 0;
// p->cursor was set by findEndOfBlock
p->this->kind = KIND_NO_WIKI_BLOCK;
p->this->end = s;
return 1;
}
//}}}
static int isParaBreak(Parser *p){//{{{
char *s = cr_nextLine(p, p->cursor);
if (!p->lineWasBlank) return 0;
p->cursor = s;
p->this->kind = KIND_PARA_BREAK;
return 1;
}
//}}}
static int isHeading(Parser *p){//{{{
char *s = cr_skipBlanks(p, p->cursor);
int flags = 0;
int level = cr_countChars(p, s, '=');
if (!level) return 0;
s += level;
if (s[0] == '<' && s[1] == '>') {
flags |= FLAG_CENTER;
s += 2;
}
s = cr_skipBlanks(p, s);
p->this->start = s;
s = cr_nextLine(p, s);
char *z = s;
if (s[-1] == '\n') s--;
while(s[-1] == ' ' || s[-1]=='\t') s--;
while(s[-1] == '=' ) s--;
if (p->this->start < s){
p->cursor = z;
p->this->kind = KIND_HEADING;
p->this->end = s;
p->this->level = level;
p->this->flags |= flags;
return 1;
}
return 0;
}
//}}}
static int isHorizontalRule(Parser *p){//{{{
char *s = cr_skipBlanks(p, p->cursor);
int level = cr_countChars(p, s, '-');
if (level < 4) return 0;
s = cr_nextLine(p, s + level);
if (!p->lineWasBlank) return 0;
p->cursor = s;
p->this->kind = KIND_HORIZONTAL_RULE;
return 1;
}
//}}}
static int isListItem(Parser *p){//{{{
char *s = cr_skipBlanks(p, p->cursor);
int level = cr_countChars(p, s, '#');
if (!level) level = cr_countChars(p, s, '*');
if ( !level) return 0;
p->this->kind = (s[0] == '#') ? KIND_ORDERED_LIST : KIND_UNORDERED_LIST;
p->this->level = level;
s = cr_skipBlanks(p, s + level);
p->this->start = s;
s = cr_nextLine(p, s);
if (p->lineWasBlank) return 0;
if (cr_addListItem(p, p->this)){
p->cursor = p->this->end = s;
return 1;
}
p->this->kind = 0;
return 0;
}
//}}}
static int isTable(Parser *p){//{{{
p->this->start = p->cursor;
char *s = cr_skipBlanks(p, p->cursor);
if (s[0] != '|') return 0;
s +=1;
p->this->kind = KIND_TABLE;
//p->cursor = p->this->end = cr_nextLine(p, s);
Node *row;
Node *tail = NULL;
while (1) {
row = pool_new(p);
row->kind = KIND_TABLE_ROW;
if (tail) tail = tail->next = row;
else p->this->children = tail = row;
row->start = s;
p->cursor = s = row->end = p->this->end = cr_nextLine(p, s);
if (row->end[-1] == '\n') row->end -= 1;
while(row->end[-1] == ' ' ) row->end -= 1;
if (row->end[-1] == '|') row->end -= 1;
if (!*s) break;
// blanks *not* normalized
s = cr_skipBlanks(p, p->cursor);
if (s[0] != '|') break;
s++;
}
return 1;
};
//}}}
static int isParagraph(Parser *p){//{{{
char *s = p->cursor;
p->this->start = s;
s = cr_nextLine(p, s);
p->cursor = p->this->end = s;
p->this->kind = KIND_PARAGRAPH;
return 1;
}
//}}}
static void cr_parse(Parser *p, char* z){//{{{
p->previous = pool_new(p);
p->previous->kind = KIND_PARA_BREAK;
p->this = pool_new(p);
p->this->kind = KIND_PARA_BREAK;
p->inLink = 0;
p->inTable = 0;
p->cursor = z;
p->list = NULL;
p->istack = NULL;
while (p->cursor[0]) {
while (1){
// must be first
if (isNoWikiBlock(p)) break;
if (isParaBreak(p)) break;
// order not important
if (isHeading(p)) break;
if (isHorizontalRule(p)) break;
if (isListItem(p)) break;
if (isTable(p)) break;
// here for efficiency?
if (isEndWikiMarker(p)) break;
// must be last
if (isParagraph(p)); break;
// doh!
assert(0);
}
int kind = p->this->kind;
int prev = p->previous->kind;
if (kind & KIND_END_WIKI_MARKER) return;
if (kind == KIND_PARAGRAPH && prev & KIND_LIST_OR_PARAGRAPH) {
p->previous->end = p->this->end;
p->this = pool_new(p);
continue;
}
if ( !(kind & KIND_LIST && prev & KIND_LIST) )
cr_render(p, p->previous);
p->previous = p->this;
p->this = pool_new(p);
}
}
//}}}
//}}}
char *wiki_render_creole(Renderer *r, char *z){
Parser parser;
Parser *p = &parser;
p->r = r;
p->iblob = r->pOut;
p->nFree = 0;
p->pool = NULL;
cr_parse(p, z);
cr_render(p, p->previous);
pool_free(p);
return p->cursor;
}
|
Changes to src/doc.c.
| ︙ | ︙ | |||
314 315 316 317 318 319 320 321 322 323 324 325 326 327 | } return "application/x-fossil-artifact"; } /* ** WEBPAGE: doc ** URL: /doc?name=BASELINE/PATH ** ** BASELINE can be either a baseline uuid prefix or magic words "tip" ** to me the most recently checked in baseline or "ckout" to mean the ** content of the local checkout, if any. PATH is the relative pathname ** of some file. This method returns the file content. ** ** If PATH matches the patterns *.wiki or *.txt then formatting content | > | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | } return "application/x-fossil-artifact"; } /* ** WEBPAGE: doc ** URL: /doc?name=BASELINE/PATH ** URL: /doc/BASELINE/PATH ** ** BASELINE can be either a baseline uuid prefix or magic words "tip" ** to me the most recently checked in baseline or "ckout" to mean the ** content of the local checkout, if any. PATH is the relative pathname ** of some file. This method returns the file content. ** ** If PATH matches the patterns *.wiki or *.txt then formatting content |
| ︙ | ︙ | |||
436 437 438 439 440 441 442 |
}
db_end_transaction(0);
}
/* The file is now contained in the filebody blob. Deliver the
** file to the user
*/
| > > | > | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
}
db_end_transaction(0);
}
/* The file is now contained in the filebody blob. Deliver the
** file to the user
*/
zMime = P("mimetype");
if( zMime==0 ){
zMime = mimetype_from_name(zName);
}
if( strcmp(zMime, "application/x-fossil-wiki")==0 ){
Blob title, tail;
if( wiki_find_title(&filebody, &title, &tail) ){
style_header(blob_str(&title));
wiki_convert(&tail, 0, 0);
}else{
style_header("Documentation");
|
| ︙ | ︙ | |||
467 468 469 470 471 472 473 |
/* Jump here when unable to locate the document */
db_end_transaction(0);
style_header("Document Not Found");
@ <p>No such document: %h(PD("name","tip/index.wiki"))</p>
style_footer();
return;
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
/* Jump here when unable to locate the document */
db_end_transaction(0);
style_header("Document Not Found");
@ <p>No such document: %h(PD("name","tip/index.wiki"))</p>
style_footer();
return;
}
/*
** The default logo.
*/
static const unsigned char aLogo[] = {
71, 73, 70, 56, 55, 97, 62, 0, 71, 0, 244, 0, 0, 85,
129, 149, 95, 136, 155, 99, 139, 157, 106, 144, 162, 113, 150, 166,
116, 152, 168, 127, 160, 175, 138, 168, 182, 148, 176, 188, 159, 184,
195, 170, 192, 202, 180, 199, 208, 184, 202, 210, 191, 207, 215, 201,
215, 221, 212, 223, 228, 223, 231, 235, 226, 227, 226, 226, 234, 237,
233, 239, 241, 240, 244, 246, 244, 247, 248, 255, 255, 255, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0,
0, 0, 62, 0, 71, 0, 0, 5, 255, 96, 100, 141, 100, 105,
158, 168, 37, 41, 132, 192, 164, 112, 44, 207, 102, 99, 0, 56,
16, 84, 116, 239, 199, 141, 65, 110, 232, 248, 25, 141, 193, 161,
82, 113, 108, 202, 32, 55, 229, 210, 73, 61, 41, 164, 88, 102,
181, 10, 41, 96, 179, 91, 106, 35, 240, 5, 135, 143, 137, 242,
87, 123, 246, 33, 190, 81, 108, 163, 237, 198, 14, 30, 113, 233,
131, 78, 115, 72, 11, 115, 87, 101, 19, 124, 51, 66, 74, 8,
19, 16, 67, 100, 74, 133, 50, 15, 101, 135, 56, 11, 74, 6,
143, 49, 126, 106, 56, 8, 145, 67, 9, 152, 48, 139, 155, 5,
22, 13, 74, 115, 161, 41, 147, 101, 13, 130, 57, 132, 170, 40,
167, 155, 0, 94, 57, 3, 178, 48, 183, 181, 57, 160, 186, 40,
19, 141, 189, 0, 69, 192, 40, 16, 195, 155, 185, 199, 41, 201,
189, 191, 205, 193, 188, 131, 210, 49, 175, 88, 209, 214, 38, 19,
3, 11, 19, 111, 127, 60, 219, 39, 55, 204, 19, 11, 6, 100,
5, 10, 227, 228, 37, 163, 0, 239, 117, 56, 238, 243, 49, 195,
177, 247, 48, 158, 56, 251, 50, 216, 254, 197, 56, 128, 107, 158,
2, 125, 171, 114, 92, 218, 246, 96, 66, 3, 4, 50, 134, 176,
145, 6, 97, 64, 144, 24, 19, 136, 108, 91, 177, 160, 0, 194,
19, 253, 0, 216, 107, 214, 224, 192, 129, 5, 16, 83, 255, 244,
43, 213, 195, 24, 159, 27, 169, 64, 230, 88, 208, 227, 129, 182,
54, 4, 89, 158, 24, 181, 163, 199, 1, 155, 52, 233, 8, 130,
176, 83, 24, 128, 137, 50, 18, 32, 48, 48, 114, 11, 173, 137,
19, 110, 4, 64, 105, 1, 194, 30, 140, 68, 15, 24, 24, 224,
50, 76, 70, 0, 11, 171, 54, 26, 160, 181, 194, 149, 148, 40,
174, 148, 122, 64, 180, 208, 161, 17, 207, 112, 164, 1, 128, 96,
148, 78, 18, 21, 194, 33, 229, 51, 247, 65, 133, 97, 5, 250,
69, 229, 100, 34, 220, 128, 166, 116, 190, 62, 8, 167, 195, 170,
47, 163, 0, 130, 90, 152, 11, 160, 173, 170, 27, 154, 26, 91,
232, 151, 171, 18, 14, 162, 253, 98, 170, 18, 70, 171, 64, 219,
10, 67, 136, 134, 187, 116, 75, 180, 46, 179, 174, 135, 4, 189,
229, 231, 78, 40, 10, 62, 226, 164, 172, 64, 240, 167, 170, 10,
18, 124, 188, 10, 107, 65, 193, 94, 11, 93, 171, 28, 248, 17,
239, 46, 140, 78, 97, 34, 25, 153, 36, 99, 65, 130, 7, 203,
183, 168, 51, 34, 136, 25, 140, 10, 6, 16, 28, 255, 145, 241,
230, 140, 10, 66, 178, 167, 112, 48, 192, 128, 129, 9, 31, 141,
84, 138, 63, 163, 162, 2, 203, 206, 240, 56, 55, 98, 192, 188,
15, 185, 50, 160, 6, 0, 125, 62, 33, 214, 195, 33, 5, 24,
184, 25, 231, 14, 201, 245, 144, 23, 126, 104, 228, 0, 145, 2,
13, 140, 244, 212, 17, 21, 20, 176, 159, 17, 95, 225, 160, 128,
16, 1, 32, 224, 142, 32, 227, 125, 87, 64, 0, 16, 54, 129,
205, 2, 141, 76, 53, 130, 103, 37, 166, 64, 144, 107, 78, 196,
5, 192, 0, 54, 50, 229, 9, 141, 49, 84, 194, 35, 12, 196,
153, 48, 192, 137, 57, 84, 24, 7, 87, 159, 249, 240, 215, 143,
105, 241, 118, 149, 9, 139, 4, 64, 203, 141, 35, 140, 129, 131,
16, 222, 125, 231, 128, 2, 238, 17, 152, 66, 3, 5, 56, 224,
159, 103, 16, 76, 25, 75, 5, 11, 164, 215, 96, 9, 14, 16,
36, 225, 15, 11, 40, 144, 192, 156, 41, 10, 178, 199, 3, 66,
64, 80, 193, 3, 124, 90, 48, 129, 129, 102, 177, 18, 192, 154,
49, 84, 240, 208, 92, 22, 149, 96, 39, 9, 31, 74, 17, 94,
3, 8, 177, 199, 72, 59, 85, 76, 25, 216, 8, 139, 194, 197,
138, 163, 69, 96, 115, 0, 147, 72, 72, 84, 28, 14, 79, 86,
233, 230, 23, 113, 26, 160, 128, 3, 10, 58, 129, 103, 14, 159,
214, 163, 146, 117, 238, 213, 154, 128, 151, 109, 84, 64, 217, 13,
27, 10, 228, 39, 2, 235, 164, 168, 74, 8, 0, 59,
};
/*
** WEBPAGE: logo
**
** Return the logo image. This image is available to anybody who can see
** the login page. It is designed for use in the upper left-hand corner
** of the header.
*/
void logo_page(void){
Blob logo;
char *zMime;
zMime = db_get("logo-mimetype", "image/gif");
blob_zero(&logo);
db_blob(&logo, "SELECT value FROM config WHERE name='logo-image'");
if( blob_size(&logo)==0 ){
blob_init(&logo, (char*)aLogo, sizeof(aLogo));
}
cgi_set_content_type(zMime);
cgi_set_content(&logo);
}
|
Changes to src/login.c.
| ︙ | ︙ | |||
216 217 218 219 220 221 222 |
if( P("g") ){
@ <input type="hidden" name="g" value="%h(P("g"))">
}
@ <table align="left" hspace="10">
@ <tr>
@ <td align="right">User ID:</td>
if( anonFlag ){
| | | > | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
if( P("g") ){
@ <input type="hidden" name="g" value="%h(P("g"))">
}
@ <table align="left" hspace="10">
@ <tr>
@ <td align="right">User ID:</td>
if( anonFlag ){
@ <td><input type="text" id="u" name="u" value="anonymous" size=30></td>
}else{
@ <td><input type="text" id="u" name="u" value="" size=30></td>
}
@ </tr>
@ <tr>
@ <td align="right">Password:</td>
@ <td><input type="password" name="p" value="" size=30></td>
@ </tr>
if( g.zLogin==0 ){
zAnonPw = db_text(0, "SELECT pw FROM user"
" WHERE login='anonymous'"
" AND cap!=''");
}
@ <tr>
@ <td></td>
@ <td><input type="submit" name="in" value="Login"></td>
@ </tr>
@ </table>
@ <script>document.getElementById('u').focus()</script>
if( g.zLogin==0 ){
@ <p>Enter
}else{
@ <p>You are currently logged in as <b>%h(g.zLogin)</b></p>
@ <p>To change your login to a different user, enter
}
@ your user-id and password at the left and press the
|
| ︙ | ︙ |
Changes to src/manifest.c.
| ︙ | ︙ | |||
950 951 952 953 954 955 956 |
if( !isNew ){
for(i=0; i<pManifest->nField; i++){
if( strcmp(pManifest->aField[i].zName, zStatusColumn)==0 ){
zNewStatus = pManifest->aField[i].zValue;
}
}
if( zNewStatus ){
| | | | 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 |
if( !isNew ){
for(i=0; i<pManifest->nField; i++){
if( strcmp(pManifest->aField[i].zName, zStatusColumn)==0 ){
zNewStatus = pManifest->aField[i].zValue;
}
}
if( zNewStatus ){
blob_appendf(&comment, "%h ticket [%.10s]: <i>%s</i>",
zNewStatus, pManifest->zTicketUuid, zTitle
);
if( pManifest->nField>1 ){
blob_appendf(&comment, " plus %d other change%s",
pManifest->nField-1, pManifest->nField==2 ? "" : "s");
}
blob_appendf(&brief, "%h ticket [%.10s].",
zNewStatus, pManifest->zTicketUuid);
}else{
zNewStatus = db_text("unknown",
"SELECT %s FROM ticket WHERE tkt_uuid='%s'",
zStatusColumn, pManifest->zTicketUuid
);
blob_appendf(&comment, "Ticket [%.10s] <i>%s</i> status still %h with "
"%d other change%s",
pManifest->zTicketUuid, zTitle, zNewStatus, pManifest->nField,
pManifest->nField==1 ? "" : "s"
);
free(zNewStatus);
blob_appendf(&brief, "Ticket [%.10s]: %d change%s",
pManifest->zTicketUuid, pManifest->nField,
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
"Configure the trouble-ticketing system for this repository");
setup_menu_entry("CSS", "setup_editcss",
"Edit the Cascading Style Sheet used by all pages of this repository");
setup_menu_entry("Header", "setup_header",
"Edit HTML text inserted at the top of every page");
setup_menu_entry("Footer", "setup_footer",
"Edit HTML text inserted at the bottom of every page");
setup_menu_entry("Shunned", "shun",
"Show artifacts that are shunned by this repository");
setup_menu_entry("Log", "rcvfromlist",
"A record of received artifacts and their sources");
setup_menu_entry("Stats", "stat",
"Display repository statistics");
@ </table>
| > > | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
"Configure the trouble-ticketing system for this repository");
setup_menu_entry("CSS", "setup_editcss",
"Edit the Cascading Style Sheet used by all pages of this repository");
setup_menu_entry("Header", "setup_header",
"Edit HTML text inserted at the top of every page");
setup_menu_entry("Footer", "setup_footer",
"Edit HTML text inserted at the bottom of every page");
setup_menu_entry("Logo", "setup_logo",
"Change the logo image for the server");
setup_menu_entry("Shunned", "shun",
"Show artifacts that are shunned by this repository");
setup_menu_entry("Log", "rcvfromlist",
"A record of received artifacts and their sources");
setup_menu_entry("Stats", "stat",
"Display repository statistics");
@ </table>
|
| ︙ | ︙ | |||
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | @ <input type="submit" name="clear" value="Revert To Default"> @ </form> @ <hr> @ Here is the default page footer: @ <blockquote><pre> @ %h(zDefaultFooter) @ </pre></blockquote> style_footer(); db_end_transaction(0); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 |
@ <input type="submit" name="clear" value="Revert To Default">
@ </form>
@ <hr>
@ Here is the default page footer:
@ <blockquote><pre>
@ %h(zDefaultFooter)
@ </pre></blockquote>
style_footer();
db_end_transaction(0);
}
/*
** WEBPAGE: setup_logo
*/
void setup_logo(void){
const char *zMime = "image/gif";
const char *aImg = P("im");
int szImg = atoi(PD("im:bytes","0"));
if( szImg>0 ){
zMime = PD("im:mimetype","image/gif");
}
login_check_credentials();
if( !g.okSetup ){
login_needed();
}
db_begin_transaction();
if( P("set")!=0 && zMime && zMime[0] && szImg>0 ){
Blob img;
Stmt ins;
blob_init(&img, aImg, szImg);
db_prepare(&ins,
"REPLACE INTO config(name, value)"
" VALUES('logo-image',:bytes)"
);
db_bind_blob(&ins, ":bytes", &img);
db_step(&ins);
db_finalize(&ins);
db_multi_exec(
"REPLACE INTO config(name, value) VALUES('logo-mimetype',%Q)",
zMime
);
}else if( P("clr")!=0 ){
db_multi_exec(
"DELETE FROM config WHERE name GLOB 'logo-*'"
);
}
style_header("Edit Project Logo");
@ <p>The current project logo has a MIME-Type of <b>%h(zMime)</b> and looks
@ like this:</p>
@ <blockquote><img src="%s(g.zTop)/logo" alt="logo"></blockquote>
@
@ <form action="%s(g.zBaseURL)/setup_logo" method="POST"
@ enctype="multipart/form-data">
@ <p>The logo is accessible to all users at this URL:
@ <a href="%s(g.zBaseURL)/logo">%s(g.zBaseURL)/logo</a>.
@ To set a new logo image, select a file to use as the logo using
@ the entry box below and then press the "Change Logo" button.</p>
login_insert_csrf_secret();
@ Logo Image file:
@ <input type="file" name="im" size="60" accepts="image/*"><br>
@ <input type="submit" name="set" value="Change Logo">
@ <input type="submit" name="clr" value="Revert To Default">
@ </form>
style_footer();
db_end_transaction(0);
}
|
Changes to src/style.c.
| ︙ | ︙ | |||
141 142 143 144 145 146 147 |
@ </div>
}
@ <div class="content">
cgi_destination(CGI_BODY);
/* Put the footer at the bottom of the page.
*/
| | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
@ </div>
}
@ <div class="content">
cgi_destination(CGI_BODY);
/* Put the footer at the bottom of the page.
*/
@ </div><br clear="both"></br>
zFooter = db_get("footer", (char*)zDefaultFooter);
if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
Th_Render(zFooter);
if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
/* Render trace log if TH1 tracing is enabled. */
if( g.thTrace ){
|
| ︙ | ︙ | |||
189 190 191 192 193 194 195 | @ href="$baseurl/timeline.rss"> @ <link rel="stylesheet" href="$baseurl/style.css" type="text/css" @ media="screen"> @ </head> @ <body> @ <div class="header"> @ <div class="logo"> | | | | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
@ href="$baseurl/timeline.rss">
@ <link rel="stylesheet" href="$baseurl/style.css" type="text/css"
@ media="screen">
@ </head>
@ <body>
@ <div class="header">
@ <div class="logo">
@ <img src="/logo" alt="logo">
@ <br><nobr>$<project_name></nobr>
@ </div>
@ <div class="title">$<title></div>
@ <div class="status"><nobr><th1>
@ if {[info exists login]} {
@ puts "Logged in as $login"
@ } else {
@ puts "Not logged in"
|
| ︙ | ︙ | |||
267 268 269 270 271 272 273 |
@ }
@
@ /* The page title centered at the top of each page */
@ div.title {
@ display: table-cell;
@ font-size: 2em;
@ font-weight: bold;
| | > | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
@ }
@
@ /* The page title centered at the top of each page */
@ div.title {
@ display: table-cell;
@ font-size: 2em;
@ font-weight: bold;
@ text-align: left;
@ padding: 0 0 0 1em;
@ color: #558195;
@ vertical-align: bottom;
@ width: 100%;
@ }
@
@ /* The login status message in the top right-hand corner */
@ div.status {
|
| ︙ | ︙ | |||
390 391 392 393 394 395 396 |
@ border: 1px solid #ff0000;
@ }
@
@ div.miniform {
@ font-size: smaller;
@ margin: 8px;
@ }
| < < < < < < < < < < < < < < < < < < < < < | | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
@ border: 1px solid #ff0000;
@ }
@
@ div.miniform {
@ font-size: smaller;
@ margin: 8px;
@ }
@ /* additions to support creole parser */
@
@ .creoletable {
@ border: 1px solid #666666;
@ border-spacing: 0;
@ margin: 1.5em 2em 1.8em 2em;
@ }
@ .creoletable * tr th {
|
| ︙ | ︙ | |||
434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
@ .creoletable * tr td {
@ padding: .4em .7em .45em .7em;
@ border-left: 1px solid #D9D9D9;
@ border-top: 1px solid #D9D9D9;
@ vertical-align: center;
@ empty-cells: show;
@ }
;
/*
** WEBPAGE: style.css
*/
void page_style_css(void){
char *zCSS = 0;
| > > > > > > > > > > > > > > | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
@ .creoletable * tr td {
@ padding: .4em .7em .45em .7em;
@ border-left: 1px solid #D9D9D9;
@ border-top: 1px solid #D9D9D9;
@ vertical-align: center;
@ empty-cells: show;
@ }
@ .creole-nowiki {
@ background: oldlace;
@ }
@ .creole-inline-nowiki {
@ background: oldlace;
@ }
@ .creole-image {
@ color:green;
@ border:1px solid green;
@ }
@ .creole-nomacro {
@ color:red;
@ border:1px solid red;
@ }
;
/*
** WEBPAGE: style.css
*/
void page_style_css(void){
char *zCSS = 0;
|
| ︙ | ︙ |
Changes to src/tktsetup.c.
| ︙ | ︙ | |||
361 362 363 364 365 366 367 | static const char zDefaultView[] = @ <table cellpadding="5"> @ <tr><td align="right">Ticket UUID:</td><td bgcolor="#d0d0d0" colspan="3"> @ $<tkt_uuid> @ </td></tr> @ <tr><td align="right">Title:</td> @ <td bgcolor="#d0d0d0" colspan="3" valign="top"> | | | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | static const char zDefaultView[] = @ <table cellpadding="5"> @ <tr><td align="right">Ticket UUID:</td><td bgcolor="#d0d0d0" colspan="3"> @ $<tkt_uuid> @ </td></tr> @ <tr><td align="right">Title:</td> @ <td bgcolor="#d0d0d0" colspan="3" valign="top"> @ <th1>wiki $title</th1> @ </td></tr> @ <tr><td align="right">Status:</td><td bgcolor="#d0d0d0"> @ $<status> @ </td> @ <td align="right">Type:</td><td bgcolor="#d0d0d0"> @ $<type> @ </td></tr> |
| ︙ | ︙ |
Changes to src/url.c.
| ︙ | ︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
g.urlDfltPort = 80;
iStart = 7;
}
for(i=iStart; (c=zUrl[i])!=0 && c!='/' && c!='@'; i++){}
if( c=='@' ){
for(j=iStart; j<i && zUrl[j]!=':'; j++){}
g.urlUser = mprintf("%.*s", j-iStart, &zUrl[iStart]);
if( j<i ){
g.urlPasswd = mprintf("%.*s", i-j-1, &zUrl[j+1]);
}
for(j=i+1; (c=zUrl[j])!=0 && c!='/' && c!=':'; j++){}
g.urlName = mprintf("%.*s", j-i-1, &zUrl[i+1]);
i = j;
}else{
for(i=iStart; (c=zUrl[i])!=0 && c!='/' && c!=':'; i++){}
g.urlName = mprintf("%.*s", i-iStart, &zUrl[iStart]);
| > > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
g.urlDfltPort = 80;
iStart = 7;
}
for(i=iStart; (c=zUrl[i])!=0 && c!='/' && c!='@'; i++){}
if( c=='@' ){
for(j=iStart; j<i && zUrl[j]!=':'; j++){}
g.urlUser = mprintf("%.*s", j-iStart, &zUrl[iStart]);
dehttpize(g.urlUser);
if( j<i ){
g.urlPasswd = mprintf("%.*s", i-j-1, &zUrl[j+1]);
dehttpize(g.urlPasswd);
}
for(j=i+1; (c=zUrl[j])!=0 && c!='/' && c!=':'; j++){}
g.urlName = mprintf("%.*s", j-i-1, &zUrl[i+1]);
i = j;
}else{
for(i=iStart; (c=zUrl[i])!=0 && c!='/' && c!=':'; i++){}
g.urlName = mprintf("%.*s", i-iStart, &zUrl[iStart]);
|
| ︙ | ︙ |
Changes to src/wikiformat.c.
| ︙ | ︙ | |||
1020 1021 1022 1023 1024 1025 1026 |
** Return the MUTYPE for the top of the stack.
*/
static int stackTopType(Renderer *p){
if( p->nStack<=0 ) return 0;
return aMarkup[p->aStack[p->nStack-1].iCode].iType;
}
| < | | < < | 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 |
** Return the MUTYPE for the top of the stack.
*/
static int stackTopType(Renderer *p){
if( p->nStack<=0 ) return 0;
return aMarkup[p->aStack[p->nStack-1].iCode].iType;
}
/*
** Convert the wiki in z[] into html in the renderer p. The
** renderer has already been initialized.
**
** This routine will probably modify the content of z[].
*/
static void wiki_render(Renderer *p, char *z){
int tokenType;
ParsedMarkup markup;
int n;
int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
while( z[0] ){
/*
** Additions to support macro extensions
*/
if (!p->inVerbatim && z[0]=='<' && z[1] == '<') {
z = wiki_render_macro(p, z, &tokenType);
if (tokenType) continue;
}
/* end additions */
n = nextToken(z, p, &tokenType);
p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);
switch( tokenType ){
case TOKEN_PARAGRAPH: {
if( inlineOnly ){
/* blob_append(p->pOut, " ¶ ", -1); */
blob_append(p->pOut, " ", -1);
}else{
if( p->wikiList ){
popStackToTag(p, p->wikiList);
|
| ︙ | ︙ | |||
1225 1226 1227 1228 1229 1230 1231 |
/* If the markup is not font-change markup ignore it if the
** font-change-only flag is set.
*/
if( (markup.iType&MUTYPE_FONT)==0 && (p->state & FONT_MARKUP_ONLY)!=0 ){
/* Do nothing */
}else
| < < < < < < > > > > > > | 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 |
/* If the markup is not font-change markup ignore it if the
** font-change-only flag is set.
*/
if( (markup.iType&MUTYPE_FONT)==0 && (p->state & FONT_MARKUP_ONLY)!=0 ){
/* Do nothing */
}else
if( markup.iCode==MARKUP_NOWIKI ){
if( markup.endTag ){
p->state |= ALLOW_WIKI;
}else{
p->state &= ~ALLOW_WIKI;
}
}else
/* Ignore block markup for in-line rendering.
*/
if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){
/* Do nothing */
}else
/* Generate end-tags */
if( markup.endTag ){
popStackToTag(p, markup.iCode);
}else
/* Push <div> markup onto the stack together with the id=ID attribute.
|
| ︙ | ︙ | |||
1353 1354 1355 1356 1357 1358 1359 |
while( renderer.nStack ){
popStack(&renderer);
}
blob_append(renderer.pOut, "\n", 1);
free(renderer.aStack);
}
| < | 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 |
while( renderer.nStack ){
popStack(&renderer);
}
blob_append(renderer.pOut, "\n", 1);
free(renderer.aStack);
}
/*
** COMMAND: test-wiki-render
*/
void test_wiki_render(void){
Blob in, out;
if( g.argc!=3 ) usage("FILE");
blob_zero(&out);
|
| ︙ | ︙ | |||
1392 1393 1394 1395 1396 1397 1398 |
for(i=iStart; z[i] && (z[i]!='<' || strncmp(&z[i],"</title>",8)!=0); i++){}
if( z[i]!='<' ) return 0;
blob_init(pTitle, &z[iStart], i-iStart);
blob_init(pTail, &z[i+8], -1);
return 1;
}
| < | > > > > > < | > > > > > > > > > > > > < | < | 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 |
for(i=iStart; z[i] && (z[i]!='<' || strncmp(&z[i],"</title>",8)!=0); i++){}
if( z[i]!='<' ) return 0;
blob_init(pTitle, &z[iStart], i-iStart);
blob_init(pTail, &z[i+8], -1);
return 1;
}
/*
** Additions to support macro extensions
**
** This only allows block level macros, not inline macros
**
** All macros must recognize '<<fossil>>' in the input
** stream and return control to fossil.
*/
char *wiki_render_macro(Renderer *p, char *z, int *tokenType){
if (!memcmp(z, "<<fossil>>", 10)){
*tokenType = 1;
return z + 10;
}
#ifdef HAVE_CREOLE_MACRO
if (!memcmp(z, "<<creole>>", 10)) {
*tokenType = 1;
return wiki_render_creole(p, z+10);
}
#endif
*tokenType = 0;
return z;
}
int wf_linkLength(const char *z){
return linkLength(z);
}
void wf_openHyperlink(
Renderer *p, /* Rendering context */
const char *zTarget, /* Hyperlink traget; text within [...] */
char *zClose, /* Write hyperlink closing text here */
int nClose /* Bytes available in zClose[] */
){
return openHyperlink(p, zTarget, zClose, nClose);
}
/* end additions */
|
Changes to src/xfer.c.
| ︙ | ︙ | |||
381 382 383 384 385 386 387 388 389 390 |
**
** Signature generation on the client side is handled by the
** http_exchange() routine.
*/
void check_login(Blob *pLogin, Blob *pNonce, Blob *pSig){
Stmt q;
int rc = -1;
db_prepare(&q,
"SELECT pw, cap, uid FROM user"
| > > | | | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
**
** Signature generation on the client side is handled by the
** http_exchange() routine.
*/
void check_login(Blob *pLogin, Blob *pNonce, Blob *pSig){
Stmt q;
int rc = -1;
char *zLogin = blob_terminate(pLogin);
defossilize(zLogin);
db_prepare(&q,
"SELECT pw, cap, uid FROM user"
" WHERE login=%Q"
" AND login NOT IN ('anonymous','nobody','developer','reader')"
" AND length(pw)>0",
zLogin
);
if( db_step(&q)==SQLITE_ROW ){
Blob pw, combined, hash;
blob_zero(&pw);
db_ephemeral_blob(&q, 0, &pw);
blob_zero(&combined);
blob_copy(&combined, pNonce);
|
| ︙ | ︙ | |||
519 520 521 522 523 524 525 |
}
/*
** Send a single config card for configuration item zName
*/
static void send_config_card(Xfer *pXfer, const char *zName){
if( zName[0]!='@' ){
| > > | | | < > | > | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
}
/*
** Send a single config card for configuration item zName
*/
static void send_config_card(Xfer *pXfer, const char *zName){
if( zName[0]!='@' ){
Blob val;
blob_zero(&val);
db_blob(&val, "SELECT value FROM config WHERE name=%Q", zName);
if( blob_size(&val)>0 ){
blob_appendf(pXfer->pOut, "config %s %d\n", zName, blob_size(&val));
blob_append(pXfer->pOut, blob_buffer(&val), blob_size(&val));
blob_reset(&val);
blob_append(pXfer->pOut, "\n", 1);
}
}else{
Blob content;
blob_zero(&content);
configure_render_special_name(zName, &content);
blob_appendf(pXfer->pOut, "config %s %d\n%s\n", zName,
blob_size(&content), blob_str(&content));
|
| ︙ | ︙ | |||
764 765 766 767 768 769 770 |
if( !g.okAdmin ){
cgi_reset_content();
@ error not\sauthorized\sto\spush\sconfiguration
nErr++;
break;
}
if( zName[0]!='@' ){
| > > > > > > > > > > | | | | > | 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 |
if( !g.okAdmin ){
cgi_reset_content();
@ error not\sauthorized\sto\spush\sconfiguration
nErr++;
break;
}
if( zName[0]!='@' ){
if( strcmp(zName, "logo-image")==0 ){
Stmt ins;
db_prepare(&ins,
"REPLACE INTO config(name, value) VALUES(:name, :value)"
);
db_bind_text(&ins, ":name", zName);
db_bind_blob(&ins, ":value", &content);
db_step(&ins);
db_finalize(&ins);
}else{
db_multi_exec(
"REPLACE INTO config(name,value) VALUES(%Q,%Q)",
zName, blob_str(&content)
);
}
}else{
/* Notice that we are evaluating arbitrary SQL received from the
** client. But this can only happen if the client has authenticated
** as an administrator, so presumably we trust the client at this
** point.
*/
if( !recvConfig ){
|
| ︙ | ︙ | |||
1126 1127 1128 1129 1130 1131 1132 |
const char *zName = blob_str(&xfer.aToken[1]);
Blob content;
blob_zero(&content);
blob_extract(xfer.pIn, size, &content);
g.okAdmin = g.okRdAddr = 1;
if( configure_is_exportable(zName) & origConfigRcvMask ){
if( zName[0]!='@' ){
| > > > > > > > > > > | | | | > | 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 |
const char *zName = blob_str(&xfer.aToken[1]);
Blob content;
blob_zero(&content);
blob_extract(xfer.pIn, size, &content);
g.okAdmin = g.okRdAddr = 1;
if( configure_is_exportable(zName) & origConfigRcvMask ){
if( zName[0]!='@' ){
if( strcmp(zName, "logo-image")==0 ){
Stmt ins;
db_prepare(&ins,
"REPLACE INTO config(name, value) VALUES(:name, :value)"
);
db_bind_text(&ins, ":name", zName);
db_bind_blob(&ins, ":value", &content);
db_step(&ins);
db_finalize(&ins);
}else{
db_multi_exec(
"REPLACE INTO config(name,value) VALUES(%Q,%Q)",
zName, blob_str(&content)
);
}
}else{
/* Notice that we are evaluating arbitrary SQL received from the
** server. But this can only happen if we have specifically
** requested configuration information from the server, so
** presumably the operator trusts the server.
*/
db_multi_exec("%s", blob_str(&content));
|
| ︙ | ︙ |
Changes to www/bugtheory.wiki.
| ︙ | ︙ | |||
111 112 113 114 115 116 117 | table schema and content is part of the local state of a repository and is not shared with other repositories during a sync, push, or pull. Each repository also defines scripts used to generate web pages for creating new tickets, viewing existing tickets, and modifying an existing ticket. These scripts consist of HTML with an embedded scripts written an a Tcl-like language called "TH1". Every new fossil | | | > | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | table schema and content is part of the local state of a repository and is not shared with other repositories during a sync, push, or pull. Each repository also defines scripts used to generate web pages for creating new tickets, viewing existing tickets, and modifying an existing ticket. These scripts consist of HTML with an embedded scripts written an a Tcl-like language called "TH1". Every new fossil repository is created with default scripts. Paul Ruizendaal has written documentation on the TH1 language that is available at [http://www.sqliteconcepts.org/THManual.pdf]. Administrators wishing to customize their ticket entry, viewing, and editing screens should modify the default scripts to suit their needs. These screen generator scripts are part of the local state of a repository and are not shared with other repositories during a sync, push, or pull. <i>To be continued...</i> |
Changes to www/index.wiki.
| ︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <ul> <li> [./quickstart.wiki | Quick Start] <li> [http://www.fossil-scm.org/download.html | Download] <li> [./build.wiki | Install] <li> [../COPYRIGHT-GPL2.txt | License] <li> [/timeline | Recent changes] <li> [./faq.wiki | FAQ] </ul> </td></tr> <tr><td> <center><img src="fossil3.gif"></center> </td></tr> </table> </table> | > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
<ul>
<li> [./quickstart.wiki | Quick Start]
<li> [http://www.fossil-scm.org/download.html | Download]
<li> [./build.wiki | Install]
<li> [../COPYRIGHT-GPL2.txt | License]
<li> [/timeline | Recent changes]
<li> [./faq.wiki | FAQ]
<li> Mailing list
<ul>
<li> [http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users | sign-up]
<li> [http://www.mail-archive.com/fossil-users@lists.fossil-scm.org | archives]
<ul>
</ul>
</td></tr>
<tr><td>
<center><img src="fossil3.gif"></center>
</td></tr>
</table>
</table>
|
| ︙ | ︙ | |||
104 105 106 107 108 109 110 |
not yet born.
* A tutorial on [./branching.wiki | branching], what it means and how
to do it using fossil.
* The [./selfcheck.wiki | automatic self-check] mechanism
helps insure project integrity.
* Fossil contains a [./wikitheory.wiki | built-in wiki].
* There is a
| | > > > > | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
not yet born.
* A tutorial on [./branching.wiki | branching], what it means and how
to do it using fossil.
* The [./selfcheck.wiki | automatic self-check] mechanism
helps insure project integrity.
* Fossil contains a [./wikitheory.wiki | built-in wiki].
* There is a
[http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users | mailing list] (with publically readable
[http://www.mail-archive.com/fossil-users@lists.fossil-scm.org | archives]
available for discussing fossil issues.
* [./stats.wiki | Performance statistics] taken from real-world projects
hosted on fossil.
* How to [./shunning.wiki | delete content] from a fossil repository.
* Some (unfinished but expanding) extended
[./reference.wiki | reference documentation] for the fossil command line.
* Documentation on the
[http://www.sqliteconcepts.org/THManual.pdf | TH1 Script Language] used
to configure the ticketing subsystem.
<h3>Links For Fossil Developer:</h3>
* [./pop.wiki | Principles Of Operation]
* The [./fileformat.wiki | file format] used by every content
file stored in the repository.
* The [./delta_format.wiki | format of deltas] used to
efficiently store changes between file revisions.
* The [./delta_encoder_algorithm.wiki | encoder algorithm] used to
efficiently generate deltas.
* The [./sync.wiki | synchronization protocol].
|