Tags:
create new tag
, view all tags

Embed Topic Plugin

View & edit embedded topics combined into one page. Unlimited nesting of topics.

What this is for

There are many ways this plugin could be used, but the most obvious is to modularize large topics. It is like the built-in include feature, but a bit more powerful because you can edit a topic at the same time you are editing the topic it is included in. The plugin has other features that minimize typing and clicking. It works very well if you use TWiki to take notes, as you can take notes in a continuous matter in one page while at the same time creating a structure.

Syntax (summary)

The tags are not case-sensitive. There are two ways of embedding a topic into another:

%EmbedTopic{MyTopic}%

%BeginTopic{MyTopic}%
.. content of MyTopic ..
%End{MyTopic}%

With available shorthands:

%T{MyTopic}

%B{MyTopic}
.. content of MyTopic ..
%E{MyTopic}

Syntax (with examples)

There are two ways to embed a topic, say, MyTopic.

There is first %EmbedTopic{MyTopic}% (or %T{MyTopic}, for short).

If you write %EmbedTopic{MyTopic}% in topic X, the next time you view X, MyTopic will be embedded in it. You will see something like:

MyTopic
Content of MyTopic

The next time you edit X, you will see something like this in the textarea:

.. content of X ..

%BeginTopic{MyTopic}%
  .. content of MyTopic ..
%End{MyTopic}%

If you change the content between the two tags, this will change the content of MyTopic.

You can also insert the Begin/End tags directly in a topic (or use the shorthands %B{MyTopic} and %E{MyTopic}. If the embeded topic doesn't exist, it will be created with the content you write. If you enter %EmbedTopic{MyTopic}% and MyTopic does not exist, it will not be created upon saving. It will be created only if you open the embeding topic another time, in which case you will get:

.. content of embeding topic
%BeginTopic{MyTopic}%%End{MyTopic}%

If you save this, an empty MyTopic will be created.

There is also a handy shortcut. If, while using the second way, you write an embedded topic name like this:

%BeginTopic{AnotherTopic::MyTopic}%
.. content of MyTopic ..
%End{AnotherTopic::MyTopic}%

Then the same as above will happen, but in addition MyTopic will be embedded in AnotherTopic. If AnotherTopoc does not exist, it will be created with MyTopic embedded in it. If it already exists, MyTopic will be embedded at the end.

This is useful if you come across a new subtopic which you would like to write about as part of a larger topic, and also to have a link to it somewhere else. Say for instance you are writing something on water. You open a subtopic H2O in your water topic, and you want at the same time to have this H2O subtopic to appear in a topic in which you write down all yours notes in chemistry. Whatever. I use this mainly to insert definitions I create in a list of definitions at the same time I write them down in the topics in which I first use them.

Nested embeds

You can nest embedded topics. See the demo.

Demo

See EmbedTopicPluginDemo.

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %EMBEDTOPICPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = View & edit embedded topics combined into one page

  • Background of the headings:
    • Set BGCOLOR = #EEEEEE

  • Color of the headings' text:
    • Set HDCOLOR = #000000

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip EmbedTopicPlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/EmbedTopicPlugin.txt Plugin topic
    data/Sandbox/EmbedTopicPluginDemo.txt Demo topic
    data/Sandbox/WaterDef.txt Part of the demo
    data/Sandbox/H2ODef.txt Part of the demo
    lib/TWiki/Plugins/EmbedTopicPlugin.pm Plugin Perl module
    pub/TWiki/EmbedTopicPlugin/spacer.gif Spacer image
  • Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
  • Test if the installation was successful:

Plugin Info

Plugin Author: TWiki:Main.DavidBourget
Copyright: © 2004 TWiki:Main.DavidBourget
© 2004-2010 TWiki:TWiki.TWikiContributor
Plugin Version: 2010-12-12 (V1.6)
Change History:  
2010-12-12: TWikibug:Item6530: Doc improvements, changing TWIKIWEB to SYSTEMWEB -- TWiki:Main.PeterThoeny
09 Dec 2005: Moved EmbedTopicPluginDemo to the Sandbox web (TWiki:Main.WillNorris)
24 Dec 2004: Initial version
26 Dec 2004: Added auto-insert feature and infinite regress check
27 Dec 2004: Code clean-up. Minor changes to documentation.
TWiki Dependency: $TWiki::Plugins::VERSION 1.024
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
TWiki:Plugins/Benchmark: GoodStyle nn%, FormattedSearch nn%, EmbedTopicPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/EmbedTopicPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/EmbedTopicPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/EmbedTopicPluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 EmbedTopicPlugin.md5 r3 r2 r1 manage 0.2 K 2010-12-13 - 05:12 PeterThoeny  
Compressed Zip archivetgz EmbedTopicPlugin.tgz r3 r2 r1 manage 7.6 K 2010-12-13 - 05:12 PeterThoeny  
Compressed Zip archivezip EmbedTopicPlugin.zip r8 r7 r6 r5 r4 manage 10.5 K 2010-12-13 - 05:12 PeterThoeny  
Unknown file formatEXT EmbedTopicPlugin_installer r2 r1 manage 3.5 K 2010-12-13 - 05:12 PeterThoeny  
Edit | Attach | Watch | Print version | History: r13 < r12 < r11 < r10 < r9 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r13 - 2013-10-16 - PeterThoeny
 
  • 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-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.