Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Some elements moved to correct order in wiki AllowedMarkup array. Removed hardcoded link in resolveHyperlink and also made it handle outside links, such as http, ftp, mailto, etc... When looking for valid HTML codes, I changed isalpha to isalnum so that H1, H2, etc... would be recognized. Better code for setting inital checkout db entry. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
55dc2abc60a4692e7b029f3dcbafb986 |
| User & Date: | jnc 2007-09-24 01:38:45.000 |
Context
|
2007-09-24
| ||
| 04:37 | Added style.css page that get's from the repo or uses a built in style.css. Removed static formatting in header/footer, replaced with divs, spans and ids which the style.css can totally control. The default style.css is simple, uses blue colors from timeline date area. Fixed minor bug on setup_ulist where it would display footer at top. check-in: 5cd9597428 user: jnc tags: trunk | |
| 01:38 | Some elements moved to correct order in wiki AllowedMarkup array. Removed hardcoded link in resolveHyperlink and also made it handle outside links, such as http, ftp, mailto, etc... When looking for valid HTML codes, I changed isalpha to isalnum so that H1, H2, etc... would be recognized. Better code for setting inital checkout db entry. check-in: 55dc2abc60 user: jnc tags: trunk | |
|
2007-09-23
| ||
| 23:05 | One more minor change to the fix of ff4c, set the current checkout to 1 if this is a brand new file. check-in: 746a0b8588 user: jnc tags: trunk | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
885 886 887 888 889 890 891 |
file_canonical_name(g.argv[2], &path);
db_open_repository(blob_str(&path));
db_init_database("./_FOSSIL_", zLocalSchema, (char*)0);
db_open_local();
db_lset("repository", blob_str(&path));
vid = db_int(0, "SELECT pid FROM plink y"
" WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)");
| < > | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 |
file_canonical_name(g.argv[2], &path);
db_open_repository(blob_str(&path));
db_init_database("./_FOSSIL_", zLocalSchema, (char*)0);
db_open_local();
db_lset("repository", blob_str(&path));
vid = db_int(0, "SELECT pid FROM plink y"
" WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)");
if( vid==0 ){
db_lset_int("checkout", 1);
}else{
db_lset_int("checkout", vid);
g.argv = azNewArgv;
g.argc = 3;
update_cmd();
}
}
/*
|
| ︙ | ︙ |
Changes to src/wikiformat.c.
| ︙ | ︙ | |||
124 125 126 127 128 129 130 | ** and in numerical sequence. The first markup type must be zero. ** The value for MARKUP_XYZ must correspond to the <xyz> entry ** in aAllowedMarkup[]. */ #define MARKUP_INVALID 255 #define MARKUP_A 0 #define MARKUP_ADDRESS 1 | > | | < | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | ** and in numerical sequence. The first markup type must be zero. ** The value for MARKUP_XYZ must correspond to the <xyz> entry ** in aAllowedMarkup[]. */ #define MARKUP_INVALID 255 #define MARKUP_A 0 #define MARKUP_ADDRESS 1 #define MARKUP_B 2 #define MARKUP_BIG 3 #define MARKUP_BLOCKQUOTE 4 #define MARKUP_BR 5 #define MARKUP_CENTER 6 #define MARKUP_CITE 7 #define MARKUP_CODE 8 #define MARKUP_DD 9 #define MARKUP_DFN 10 #define MARKUP_DL 11 |
| ︙ | ︙ | |||
153 154 155 156 157 158 159 | #define MARKUP_KBD 24 #define MARKUP_LI 25 #define MARKUP_NOBR 26 #define MARKUP_NOWIKI 27 #define MARKUP_OL 28 #define MARKUP_P 29 #define MARKUP_PRE 30 | > | | < < | > | 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 | #define MARKUP_KBD 24 #define MARKUP_LI 25 #define MARKUP_NOBR 26 #define MARKUP_NOWIKI 27 #define MARKUP_OL 28 #define MARKUP_P 29 #define MARKUP_PRE 30 #define MARKUP_S 31 #define MARKUP_SAMP 32 #define MARKUP_SMALL 33 #define MARKUP_STRIKE 34 #define MARKUP_STRONG 35 #define MARKUP_SUB 36 #define MARKUP_SUP 37 #define MARKUP_TABLE 38 #define MARKUP_TD 39 #define MARKUP_TH 40 #define MARKUP_TR 41 #define MARKUP_TT 42 #define MARKUP_U 43 #define MARKUP_UL 44 #define MARKUP_VAR 45 #define MARKUP_VERBATIM 46 /* ** The various markup is divided into the following types: */ #define MUTYPE_SINGLE 0x0001 /* <img>, <br>, or <hr> */ |
| ︙ | ︙ | |||
195 196 197 198 199 200 201 202 203 |
const char *zName; /* Name of the markup */
char iCode; /* The MARKUP_* code */
short int iType; /* The MUTYPE_* code */
int allowedAttr; /* Allowed attributes on this markup */
} aMarkup[] = {
{ "a", MARKUP_A, MUTYPE_HYPERLINK, ATTR_HREF },
{ "address", MARKUP_ADDRESS, MUTYPE_BLOCK, 0 },
{ "big", MARKUP_BIG, MUTYPE_FONT, 0 },
{ "blockquote", MARKUP_BLOCKQUOTE, MUTYPE_BLOCK, 0 },
| > < | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
const char *zName; /* Name of the markup */
char iCode; /* The MARKUP_* code */
short int iType; /* The MUTYPE_* code */
int allowedAttr; /* Allowed attributes on this markup */
} aMarkup[] = {
{ "a", MARKUP_A, MUTYPE_HYPERLINK, ATTR_HREF },
{ "address", MARKUP_ADDRESS, MUTYPE_BLOCK, 0 },
{ "b", MARKUP_B, MUTYPE_FONT, 0 },
{ "big", MARKUP_BIG, MUTYPE_FONT, 0 },
{ "blockquote", MARKUP_BLOCKQUOTE, MUTYPE_BLOCK, 0 },
{ "br", MARKUP_BR, MUTYPE_SINGLE, ATTR_CLEAR },
{ "center", MARKUP_CENTER, MUTYPE_BLOCK, 0 },
{ "cite", MARKUP_CITE, MUTYPE_FONT, 0 },
{ "code", MARKUP_CODE, MUTYPE_FONT, 0 },
{ "dd", MARKUP_DD, MUTYPE_LI, 0 },
{ "dfn", MARKUP_DFN, MUTYPE_FONT, 0 },
{ "dl", MARKUP_DL, MUTYPE_LIST, ATTR_COMPACT },
|
| ︙ | ︙ | |||
230 231 232 233 234 235 236 237 238 |
ATTR_TYPE|ATTR_VALUE },
{ "nobr", MARKUP_NOBR, MUTYPE_FONT, 0 },
{ "nowiki", MARKUP_NOWIKI, MUTYPE_SPECIAL, 0 },
{ "ol", MARKUP_OL, MUTYPE_LIST,
ATTR_START|ATTR_TYPE|ATTR_COMPACT },
{ "p", MARKUP_P, MUTYPE_BLOCK, ATTR_ALIGN },
{ "pre", MARKUP_PRE, MUTYPE_BLOCK, 0 },
{ "samp", MARKUP_SAMP, MUTYPE_FONT, 0 },
{ "small", MARKUP_SMALL, MUTYPE_FONT, 0 },
| > < > < | 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 |
ATTR_TYPE|ATTR_VALUE },
{ "nobr", MARKUP_NOBR, MUTYPE_FONT, 0 },
{ "nowiki", MARKUP_NOWIKI, MUTYPE_SPECIAL, 0 },
{ "ol", MARKUP_OL, MUTYPE_LIST,
ATTR_START|ATTR_TYPE|ATTR_COMPACT },
{ "p", MARKUP_P, MUTYPE_BLOCK, ATTR_ALIGN },
{ "pre", MARKUP_PRE, MUTYPE_BLOCK, 0 },
{ "s", MARKUP_S, MUTYPE_FONT, 0 },
{ "samp", MARKUP_SAMP, MUTYPE_FONT, 0 },
{ "small", MARKUP_SMALL, MUTYPE_FONT, 0 },
{ "strike", MARKUP_STRIKE, MUTYPE_FONT, 0 },
{ "strong", MARKUP_STRONG, MUTYPE_FONT, 0 },
{ "sub", MARKUP_SUB, MUTYPE_FONT, 0 },
{ "sup", MARKUP_SUP, MUTYPE_FONT, 0 },
{ "table", MARKUP_TABLE, MUTYPE_TABLE,
ATTR_ALIGN|ATTR_BGCOLOR|ATTR_BORDER|ATTR_CELLPADDING|
ATTR_CELLSPACING|ATTR_HSPACE|ATTR_VSPACE },
{ "td", MARKUP_TD, MUTYPE_TD,
ATTR_ALIGN|ATTR_BGCOLOR|ATTR_COLSPAN|
ATTR_ROWSPAN|ATTR_VALIGN },
{ "th", MARKUP_TH, MUTYPE_TD,
ATTR_ALIGN|ATTR_BGCOLOR|ATTR_COLSPAN|
ATTR_ROWSPAN|ATTR_VALIGN },
{ "tr", MARKUP_TR, MUTYPE_TR,
ATTR_ALIGN|ATTR_BGCOLOR||ATTR_VALIGN },
{ "tt", MARKUP_TT, MUTYPE_FONT, 0 },
{ "u", MARKUP_U, MUTYPE_FONT, 0 },
{ "ul", MARKUP_UL, MUTYPE_LIST,
ATTR_TYPE|ATTR_COMPACT },
{ "var", MARKUP_VAR, MUTYPE_FONT, 0 },
{ "verbatim", MARKUP_VERBATIM, MUTYPE_SPECIAL, ATTR_ID },
};
/*
** Use binary search to locate a tag in the aMarkup[] table.
*/
|
| ︙ | ︙ | |||
311 312 313 314 315 316 317 |
** it is not well-formed markup, return 0.
*/
static int markupLength(const char *z){
int n = 1;
int inparen = 0;
if( z[n]=='/' ){ n++; }
if( !isalpha(z[n]) ) return 0;
| | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
** it is not well-formed markup, return 0.
*/
static int markupLength(const char *z){
int n = 1;
int inparen = 0;
if( z[n]=='/' ){ n++; }
if( !isalpha(z[n]) ) return 0;
while( isalnum(z[n]) ){ n++; }
if( z[n]!='>' && !isspace(z[n]) ) return 0;
while( z[n] && (z[n]!='>' || inparen) ){
if( z[n]=='"' ){
inparen = !inparen;
}
n++;
}
|
| ︙ | ︙ | |||
714 715 716 717 718 719 720 |
}
/*
** Resolve a hyperlink. The argument is the content of the [...]
** in the wiki. Append the URL to the output of the Renderer.
*/
static void resolveHyperlink(const char *zTarget, Renderer *p){
| > > > > > > | > > > | 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 |
}
/*
** Resolve a hyperlink. The argument is the content of the [...]
** in the wiki. Append the URL to the output of the Renderer.
*/
static void resolveHyperlink(const char *zTarget, Renderer *p){
if( strncmp(zTarget, "http:", 5)==0
|| strncmp(zTarget, "https:", 6)==0
|| strncmp(zTarget, "ftp:", 4)==0
|| strncmp(zTarget, "mailto:", 7)==0
|| strncmp(zTarget, "gopher:", 7)==0
){
blob_appendf(p->pOut, zTarget);
}else{
blob_appendf(p->pOut, "%s/wiki/%T", g.zBaseURL, zTarget);
}
}
/*
** Check to see if the given parsed markup is the correct
** </verbatim> tag.
*/
static int endVerbatim(Renderer *p, ParsedMarkup *pMarkup){
|
| ︙ | ︙ |