32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#define WIKI_NOBADLINKS 0x010 /* Ignore broken hyperlinks */
#define WIKI_LINKSONLY 0x020 /* No markup. Only decorate links */
#define WIKI_NEWLINE 0x040 /* Honor \n - break lines at each \n */
#define WIKI_MARKDOWNLINKS 0x080 /* Resolve hyperlinks as in markdown */
#define WIKI_SAFE 0x100 /* Make the result safe for embedding */
#define WIKI_TARGET_BLANK 0x200 /* Hyperlinks go to a new window */
#define WIKI_NOBRACKET 0x400 /* Omit extra [..] around hyperlinks */
#endif
/*
** These are the only markup attributes allowed.
*/
enum allowed_attr_t {
|
>
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#define WIKI_NOBADLINKS 0x010 /* Ignore broken hyperlinks */
#define WIKI_LINKSONLY 0x020 /* No markup. Only decorate links */
#define WIKI_NEWLINE 0x040 /* Honor \n - break lines at each \n */
#define WIKI_MARKDOWNLINKS 0x080 /* Resolve hyperlinks as in markdown */
#define WIKI_SAFE 0x100 /* Make the result safe for embedding */
#define WIKI_TARGET_BLANK 0x200 /* Hyperlinks go to a new window */
#define WIKI_NOBRACKET 0x400 /* Omit extra [..] around hyperlinks */
#define WIKI_ADMIN 0x800 /* Ignore g.perm.Hyperlink */
#endif
/*
** These are the only markup attributes allowed.
*/
enum allowed_attr_t {
|
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
|
}else if( !in_this_repo(zTarget) ){
if( (mFlags & (WIKI_LINKSONLY|WIKI_NOBADLINKS))!=0 ){
zTerm = "";
}else{
blob_appendf(pOut, "<span class=\"brokenlink\">%s", zLB);
zTerm = "]</span>";
}
}else if( g.perm.Hyperlink ){
blob_appendf(pOut, "%z%s",xhref(zExtraNS, "%R/info/%s", zTarget), zLB);
zTerm = "]</a>";
}else{
zTerm = "";
}
if( zTerm[0]==']' && (mFlags & WIKI_NOBRACKET)!=0 ) zTerm++;
}else if( (zRemote = interwiki_url(zTarget))!=0 ){
|
|
|
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
|
}else if( !in_this_repo(zTarget) ){
if( (mFlags & (WIKI_LINKSONLY|WIKI_NOBADLINKS))!=0 ){
zTerm = "";
}else{
blob_appendf(pOut, "<span class=\"brokenlink\">%s", zLB);
zTerm = "]</span>";
}
}else if( g.perm.Hyperlink || (mFlags & WIKI_ADMIN)!=0 ){
blob_appendf(pOut, "%z%s",xhref(zExtraNS, "%R/info/%s", zTarget), zLB);
zTerm = "]</a>";
}else{
zTerm = "";
}
if( zTerm[0]==']' && (mFlags & WIKI_NOBRACKET)!=0 ) zTerm++;
}else if( (zRemote = interwiki_url(zTarget))!=0 ){
|
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
|
blob_appendf(pOut, "<span class=\"brokenlink\">[%h]", zTarget);
zTerm = "</span>";
}
if( zExtra ) fossil_free(zExtra);
assert( (int)strlen(zTerm)<nClose );
sqlite3_snprintf(nClose, zClose, "%s", zTerm);
}
/*
** Check to see if the given parsed markup is the correct
** </verbatim> tag.
*/
static int endVerbatim(Renderer *p, ParsedMarkup *pMarkup){
char *z;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
|
blob_appendf(pOut, "<span class=\"brokenlink\">[%h]", zTarget);
zTerm = "</span>";
}
if( zExtra ) fossil_free(zExtra);
assert( (int)strlen(zTerm)<nClose );
sqlite3_snprintf(nClose, zClose, "%s", zTerm);
}
/*
** Check zTarget to see if it looks like a valid hyperlink target.
** Return true if it does seem valid and false if not.
*/
int wiki_valid_link_target(char *zTarget){
char zClose[30];
Blob notUsed;
blob_init(¬Used, 0, 0);
wiki_resolve_hyperlink(¬Used, WIKI_NOBADLINKS|WIKI_ADMIN,
zTarget, zClose, sizeof(zClose)-1, 0, 0);
blob_reset(¬Used);
return zClose[0]!=0;
}
/*
** Check to see if the given parsed markup is the correct
** </verbatim> tag.
*/
static int endVerbatim(Renderer *p, ParsedMarkup *pMarkup){
char *z;
|