Index: src/style.c
==================================================================
--- src/style.c
+++ src/style.c
@@ -115,53 +115,65 @@
**
** Note %z format. The string returned by this function is always
** obtained from fossil_malloc() so rendering it with %z will reclaim
** that memory space.
**
-** There are two versions of this routine: href() does a plain hyperlink
-** and xhref() adds extra attribute text.
+** There are three versions of this routine: href() does a plain hyperlink
+** and xhref() adds extra attribute text. The btn() version adds a
+** single "class='inlinebutton'" class to the anchor.
**
** g.perm.Hyperlink is true if the user has the Hyperlink (h) property.
** Most logged in users should have this property, since we can assume
** that a logged in user is not a bot. Only "nobody" lacks g.perm.Hyperlink,
** typically.
*/
-char *xhref(const char *zExtra, const char *zFormat, ...){
+char *vxhref(const char *zExtra, const char *zFormat, va_list ap){
char *zUrl;
+ Blob ref = empty_blob;
+ blob_append(&ref, "", zUrl);
+ fossil_free(zUrl);
+ }else{
+ if( nHref>=nHrefAlloc ){
+ nHrefAlloc = nHrefAlloc*2 + 10;
+ aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
+ }
+ aHref[nHref++] = zUrl;
+ blob_appendf(&ref, "id='a%d' href='%R/honeypot'>", nHref);
+ }
+ blob_materialize(&ref);
+ return ref.aData;
+}
+char *xhref(const char *zExtra, const char *zFormat, ...){
+ char *zResult;
va_list ap;
va_start(ap, zFormat);
- zUrl = vmprintf(zFormat, ap);
+ zResult = vxhref(zExtra, zFormat, ap);
va_end(ap);
- if( g.perm.Hyperlink && !g.javascriptHyperlink ){
- char *zHUrl = mprintf("", zExtra, zUrl);
- fossil_free(zUrl);
- return zHUrl;
- }
- if( nHref>=nHrefAlloc ){
- nHrefAlloc = nHrefAlloc*2 + 10;
- aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
- }
- aHref[nHref++] = zUrl;
- return mprintf("", zExtra, nHref);
+ return zResult;
}
char *href(const char *zFormat, ...){
- char *zUrl;
+ char *zResult;
+ va_list ap;
+ va_start(ap, zFormat);
+ zResult = vxhref(0, zFormat, ap);
+ va_end(ap);
+ return zResult;
+}
+char *btn(const char *zFormat, ...){
+ char *zResult;
va_list ap;
va_start(ap, zFormat);
- zUrl = vmprintf(zFormat, ap);
+ zResult = vxhref("class='inlinebutton'", zFormat, ap);
va_end(ap);
- if( g.perm.Hyperlink && !g.javascriptHyperlink ){
- char *zHUrl = mprintf("", zUrl);
- fossil_free(zUrl);
- return zHUrl;
- }
- if( nHref>=nHrefAlloc ){
- nHrefAlloc = nHrefAlloc*2 + 10;
- aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
- }
- aHref[nHref++] = zUrl;
- return mprintf("", nHref);
+ return zResult;
}
/*
** Generate
+ @ %z(btn("%R/fdiff?sbs=1&v1=%s&v2=%s",zOld,zNew))diff
}
}
db_reset(&fchngQuery);
if( inUl ){
@