I would prefer that the timeline and other places that display check-in comments does not emit links to wiki pages that have been deleted. I'm still trying to wrap my head around the sources and thus don't feel comfortable making this change myself. So I'll just write down what I've found, even though you guys surely already know this.

It seems to me that validWikiPageName() is the core function to modify, but there needs to be an extra flag in Renderer to specify whether or not deleted pages should be linked. Deleted page detection can be done as in wiki_prepare_page_list() and wcontent_page() (nonzero second column). Also modify vxprintf() to pass this no-missing-wiki-link flag to wiki_convert() if one of the special printf flags is set, e.g. flag_leftjustify or whatever we're least disgusted about abusing. And of course modify wherever the printf format is used (all those @ lines...) to take advantage where appropriate.

Actually there's a simpler approach since the wiki appears to be doing something special with bracketed text to pages that never existed. Bracketed text within a wiki always links to a wiki page, provided that the (potential) title is well-formed and doesn't already link to another artifact. So simply make the validWikiPageName() modification and leave everything else alone. That's pretty easy:

$ f diff
Index: src/wikiformat.c
==================================================================
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1150,11 +1150,13 @@
     return zTarget+5;
   }
   if( strcmp(zTarget, "Sandbox")==0 ) return zTarget;
   if( wiki_name_is_wellformed((const unsigned char *)zTarget)
    && ((p->state & WIKI_NOBADLINKS)==0 ||
- db_exists("SELECT 1 FROM tag WHERE tagname GLOB 'wiki-%q'", zTarget))
+        db_exists("SELECT 1 FROM tag WHERE tagname GLOB 'wiki-%q'"
+                  " AND (SELECT value FROM tagxref WHERE tagid=tag.tagid"
+                  " ORDER BY mtime DESC LIMIT 1) > 0", zTarget))
   ){
     return zTarget;
   }
   return 0;
 }

I'm running it right now, and it seems to work the way I want it. But I don't know what all to test.

--
Andy Goth | <andrew.m.goth/at/gmail/dot/com>
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to