Tags:
create new tag
, view all tags
TWiki currently fails silently if an INCLUDEd topic does not exist. This is appropriate in many cases.

In some cases it makes sense to have a visual warning if an included topic is missing. A small enhancement is now in the TWikiAlphaRelease (for CairoRelease), where failed INCLUDEs are shown in red text. This can be switched on and off in the preferences, default is off (for backward compatibility)

Add this to your TWikiPreferences, and possibly to WebPreferences:

  • Warn if %INCLUDE{}% of other topic fails (if set to on); silently fail (if empty); can be overwritten by web preferences:
    • Set INCLUDEWARNING =

Sample warning if %INCLUDE{"NotExistingTopic"}% fails:

Warning: Can't INCLUDE NotExistingTopic, topic not found

-- PeterThoeny - 30 Jul 2003

Yes! Very good smile And consider this warning:

  • Example to create missing includes directly:

This allows you to

  1. Write up structure in master file with lots of %INCLUDEs
  2. Have missing includes available as edit links
  3. Create sub-docs as you go
  4. Have parent - child relationsship correct without extra work
Note
The IncludeIndexPlugin (incidentally) solves the same problem, but the parent page will be the online index, not the acual including page

-- PeterKlausner - 30 Jul 2003

I would've preferred this to be configurable using two approaches:

  • Via a TWikiVariable. This is only appropriate if you need this switched on across an entire web - TWiki encourages due to lack of heirarchically nested webs (logically or physically) the
  • Via attributes of the the include - ie:
    %INCLUDE{"SomeTopic" warn="true" warning="SomeTopic not defined as yet"}%
    This makes the feature more usable in somewhere like codev or in various other situations where it's not appropriate to be switched on all the time.

Also, odd how random new ideas go straight into the core with no discussion and lots of ideas people discuss and request for months on end get ignored... (Let alone included) Not a personal problem/whinge - I merge anything I like/want into my private tree at will, but I do find this odd. Very odd, since this particular feature doesn't look that well thought out - it's not internationalisable, customisable or anything, and only web,site (or authenticated user) level granularity - not topic level as well which it really needs to be.

-- MichaelSparks - 30 Jul 2003

This is very good feedback, spec gets enhanced accordingly.

Sidenote: I discussed the original spec at work and it was considered a useful enhancement (in fact it was needed for a particular large refactoring case). I documented it here and put it into Alpha for review. Peter and Michael bring good feedback, and the spec gets enhanced accordingly. This is the spirit of OpenSource. I know that many other patches are pending, this will be addressed over time as announced in AppealToCodevCommunityByCoreTeam.

Enhanced spec:

  • INCLUDEWARNING preference setting can be:
    • off or empty: Fail silently
    • on: Warn with default message
    • else: Warning string, where $topic gets replaced with the included topic name. Example:
      • Set INCLUDEWARNING = Note: Included topic $topic does not exist yet
  • This can be overridden by a warn="..." parameter in %INCLUDE{}%. (The funny thing is that a colleague at work had a similar idea like Michael, but just with one warn="..." parameter.)

TWikiPreferences and TWikiVariables are updated accordingly. In TWikiAlphaRelease (for CairoRelease) and in TWiki.org.

-- PeterThoeny - 23 Aug 2003

I submitted a patch proposal that adds the possiblity to have a topic as the warn fallback using the following syntax:

warn="topic:topicname"

See the code at IncludeWarnTopic.

-- ChristopherOezbek - 20 Sep 2004

WebForm
TopicClassification FeatureDone
TopicSummary Preference to optionally warn when included topic does not exist; with the option to create the included topic
InterestedParties

AssignedTo

AssignedToCore PeterThoeny
ScheduledFor CairoRelease
RelatedTopics

SpecProgress 100%
ImplProgress 100%
DocProgress 100%
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2004-09-20 - ChristopherOezbek
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.