Differences From:
File
src/wikiformat.c
part of check-in
[ecd1f09632]
- Initial commit of Creole Wiki Parser extension.
by
robert on
2009-05-08 09:52:38.
[view]
To:
File
src/wikiformat.c
part of check-in
[7a2c37063a]
- merge trunk into creole branch
by
bob on
2009-09-22 07:49:39.
[view]
@@ -919,8 +919,23 @@
**
** Actually, this routine might or might not append the hyperlink, depending
** on current rendering rules: specifically does the current user have
** "History" permission.
+**
+** [http://www.fossil-scm.org/]
+** [https://www.fossil-scm.org/]
+** [ftp://www.fossil-scm.org/]
+** [mailto:fossil-users@lists.fossil-scm.org]
+**
+** [/path]
+**
+** [./relpath]
+**
+** [WikiPageName]
+**
+** [0123456789abcdef]
+**
+** [#fragment]
*/
static void openHyperlink(
Renderer *p, /* Rendering context */
const char *zTarget, /* Hyperlink traget; text within [...] */
@@ -941,16 +956,16 @@
blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zBaseURL, zTarget);
}else{
zTerm = "";
}
- }else if( zTarget[0]=='.' ){
+ }else if( zTarget[0]=='.' || zTarget[0]=='#' ){
if( 1 /* g.okHistory */ ){
blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
}else{
zTerm = "";
}
}else if( is_valid_uuid(zTarget) ){
- int isClosed;
+ int isClosed = 0;
if( is_ticket(zTarget, &isClosed) ){
/* Special display processing for tickets. Display the hyperlink
** as crossed out if the ticket is closed.
*/
@@ -1352,8 +1367,34 @@
blob_zero(&out);
blob_read_from_file(&in, g.argv[2]);
wiki_convert(&in, &out, 0);
blob_write_to_file(&out, "-");
+}
+
+/*
+** Search for a <title>...</title> at the beginning of a wiki page.
+** Return true (nonzero) if a title is found. Return zero if there is
+** not title.
+**
+** If a title is found, initialize the pTitle blob to be the content
+** of the title and initialize pTail to be the text that follows the
+** title.
+*/
+int wiki_find_title(Blob *pIn, Blob *pTitle, Blob *pTail){
+ char *z;
+ int i;
+ int iStart;
+ z = blob_str(pIn);
+ for(i=0; isspace(z[i]); i++){}
+ if( z[i]!='<' ) return 0;
+ i++;
+ if( strncmp(&z[i],"title>", 6)!=0 ) return 0;
+ iStart = i+6;
+ 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;
}
/*