Does Tiddlywiki support hierarchy or namespacing? - tiddlywiki

I'd like to arrange tiddlers in an outline style of hierarchy with an arbitrary nesting depth and with "clean" tiddler titles.
If I have top-level tiddlers A and B, I'd like to have both A:foo and B:foo (or A/foo and B/foo)
It would be nice to have the titles for both be just Foo, but if the title has to be A:foo or A/foo that's probably fine, though a bit heavy when you get several levels deep and need to add lots of tiddlers:
A/content/objects/users/Sally
A/content/objects/users/Bill
...
If I have to type all that out and keep it straight manually, it's a bit cumbersome. I'd really just like to open the A/content/objects/users tiddler and create a Sally or Bill tiddler from there.
Is there a way to do this (either with or without plugins)?

One way... create a tiddler that will display a "Create New Node" button while you are editing a given node. In my example, let's call it "NewNodeTemplate". Add this tag to it: "$:/tags/EditTemplate". This will force the template to be used while editing any tiddler.
Then place this in the body of the tiddler:
\define Concatenate()
$(first)$$(divider)$$(second)$
\end
<$set name=first value={{!!namespace}}>
<$set name="divider" filter="[all[current]has:field[namespace]]" value="/" emptyValue="">
<$set name=second value={{!!caption}}>
<$reveal type="nomatch" state="!!caption" text="">
<$button>
<$action-createtiddler $basetitle="New node" namespace=<<Concatenate>>/>
Create New Node
</$button>
</$reveal>
For this to work, you have to manually create the root tiddler/node of the namespace. So, create the "A" root tiddler. In that node create a "caption" field and put "A" in it (or whatever you want to appear in the namespace for A). Once you add the caption field the "Create New Node" button will appear. Click it to create the child node of the namespace. Warning: The node does not automatically appear in the Story River--look on the More/Recent tab in the sidebar. You should have a "New node" tiddler. Open it. It should have a namespace field pre-populated. Next, change the title and add the caption "Foo"---the "Create New Node" button should appear. Repeat.
Customize the EditTemplate tiddler for your own button text and default tiddler title. Plus if you want to automatically open the newly created tiddler in the Story River, I think there are few ways to do that. I'm not a fan of this... but you can add $savetitle="!!tiddler-title" to createtiddler widget, and add the navigate widget to display the new tiddler in the River:
\define Concatenate()
$(first)$$(divider)$$(second)$
\end
<$set name=first value={{!!namespace}}>
<$set name="divider" filter="[all[current]has:field[namespace]]" value="/" emptyValue="">
<$set name=second value={{!!caption}}>
<$reveal type="nomatch" state="!!caption" text="">
<$button>
<$action-createtiddler $basetitle="New node" $savetitle="!!tiddler-title" namespace=<<Concatenate>>/>
Create New Node
<$action-navigate $to={{!!tiddler-title}}/>
</$button>
</$reveal>
The only thing now is to create a Tiddler that shows the outline that you are looking for.
Does this work for you?

Related

Trouble auto-generating list of links

I have a page in my Wiki (v5.1.17) that is supposed to auto-generate a list of links to tiddlers that need some sort of follow up. What shows up is whatever fulfils one of two criteria: tagged "needs_followup", or title begins with "/followup/".
Here is my code:
<$list filter="[prefix[/followup/]] [tag[followup_needed]] +[sort[title]]" variable=entry>
<$link><<entry>></$link><br/>
</$list>
The list of items works fine actually, except that they're not clickable links. They look like links -- blue and underlined -- but clicking on one doesn't actually do anything. Can anyone please tell me what I'm doing wrong?
The list of items works fine actually, except that they're not clickable links.
The problem arises because you have changed the variable in which the list widget stores titles. Usually the list widget stores the current title in a variable named <<currentTiddler>>:
This variable name is well known by other widgets, e.g. the link widget will look for this variable when no to attribute is specified.
However, your list widget instance stores the current title in a variable named entry, which is not understood by the <$link> widget.
They look like links -- blue and underlined -- but clicking on one doesn't actually do anything.
Actually, they are "real" links and also navigate once clicked: The link widget will resolve the tiddler where your code is in as <<currentTiddler>> and try to link to this tiddler (which looks like it is not linking at all because you probably have no scroll effect).
Can anyone please tell me what I'm doing wrong?
Solution 1) Hence the solution is to add the to-attribute and set it to <<entry>>:
<$list filter="[prefix[/followup/]] [tag[followup_needed]] +[sort[title]]" variable=entry>
<$link to=<<entry>>><<entry>></$link><br/>
</$list>
Solution 2) Instead of setting to you could also do the following:
<$list filter="[prefix[/followup/]] [tag[followup_needed]] +[sort[title]]" variable=entry>
<$set name="currentTiddler" value=<<entry>>>
<$link><<entry>></$link><br/>
</$set>
</$list>
Solution 3) Or you could remove the variable=entry altogether
<$list filter="[prefix[/followup/]] [tag[followup_needed]] +[sort[title]]">
<$link><<currentTiddler>></$link><br/>
</$list>
Offtopic: you may also want to use the $view widget to render the title to avoid auto wikification of PascalCase titles as links: <$link to=<<entry>>><$view field="title" /></$link>

Dynamically change caption field (or just title in tabs macro) in TiddlyWiki

I'm putting together some TiddlyWiki templates, and I've run into something that would be nice to have, but I'm not sure whether it's actually possible.
I have some tiddlers that I'm including in another tiddler using the tabs macro. Each tiddler has one of two tags associated with it. I'd like to append a snippet of text to the caption in the tab view, based on which tag is associated.
I don't have a strong preference for whether this is done by adding some kind of callback to edit the caption on save, something that somehow calculates the desired caption on the fly, altering the invocation of the tabs macro to recalculate the caption on render, or somehow causing the templates to calculate the caption field.
I haven't found anything promising going through the documentation, but maybe I just haven't figured out what's relevant to my issue. I find that happens a lot.
Like, I'm sure I can write conditionals based on whether the tags exist, but I can't see any way to interpolate text into the caption field based on any kind of computation whatsoever.
For reference, here are my current macro invocations:
<<tabs [list[]] state:$:/state/tabPeriod template:PeriodTemplate>>
<<tabs [list[$(currentTab)$]] state:$:/state/tabEvent class:"tc-vertical" template:"EventTemplate">>
<<tabs [list[$(currentTab)$]] state:$:/state/tabScene template:"SceneTemplate">>
All of these lines are from different templates, that just pull a list of tiddlers and template-transclude them into tabs using the provided template. Currently, the tabs are captioned with the tiddler caption, if defined, and fall back to the title. I'd like to alter the caption, ideally without inserting too much boilerplate into the tiddlers.
I figured out what I need to do differently: I defined a custom macro based on the tabs macro, added the logic, and now it works fine. I basically just changed the current contents of the caption logic to:
<$set name="tv-wikilinks" value="no">
<$transclude tiddler=<<currentTab>> field="caption">
<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
</$transclude>
<$list filter='[<currentTab>tag[light]]'>
○
</$list>
<$list filter='[<currentTab>tag[dark]]'>
●
</$list>
</$set>
I'm not sure if I'm using the list widget correctly, but it works.

How to setup Table of Content in TiddlyWiki

If I go TiddlyWiki site I can see tab Content. How can I create my own table of content for my tiddlywiki file?
I found the documentation for this really confusing, but here's what I did that works best:
<div class="tc-table-of-contents">
<<toc-selective-expandable 'TableOfContents' sort[ind]>>
</div>
Then, tag each tiddler with TableofContents.
Lastly, when editing each tiddler, add a new field named "ind" (for index - you can change this to whatever you like, so long as it's not being used elsewhere, of course). Assign a value to "ind" starting with 0 to tell it what order you want the tiddlers to go in. I incremented by 10 instead of 1 in case I want to rearrange a few things or insert more in the middle.
Create a new tiddler and give the title Contents
Under tags, give the value $:/tags/SideBar
Under type the text for this tiddler, give
<$list filter={{$:/core/Filters/AllTiddlers!!filter}} template="$:/core/ui/ListItemTemplate"/>
This is explained in the documentation.
The short version: Add some tag (e.g. Content) to the pages you want to appear in the TOC; then in the place where you want it to appear, use one of the macros with that tag name (e.g. <<toc Content>>). To make a nested TOC, tag pages with the names of tags that appeared at the top level. So for example if you have a tiddler named First that is tagged with Content, then you can tag more tiddlers with First, and they will appear indented below First in the TOC.

How to change the title bar height of spark.components.Panel?

I'm creating a log-in box for my Flex application. However, I'm required to apply a specific design to this box that I have to change the title bar height.
The component I'm using is spark.components.Panel. I just can't find the property of this 'Panel' component to change the feature.
Any suggestions?
You cannot do this through styling; you'll have to create a custom skin. In order to do this in Flash-Builder: right-click in the project tree on the package where you want to create your skin. Select 'New', then select 'MXML Skin'. Fill out the wizard and choose to make a copy of the spark PanelSkin. This will copy the entire code of the default spark Panel skin into your custom skin class and you can now start adjusting it to your will.
Look for the group called 'topGroup': it contains all the elements of the top part of the Panel component. You can play around with this as you wish, but the easiest answer to your question is to locate the Label called 'titleDisplay'.
<s:Group id="topGroup" mask="{topGroupMask}">
<!-- some other elements -->
<s:Label id="titleDisplay" maxDisplayedLines="1"
left="9" right="3" top="1" bottom="0" minHeight="30"
verticalAlign="middle" textAlign="start" fontWeight="bold">
</s:Label>
...
Do you see that 'minHeight' property? That's the one that is defining the height of the title bar. Just give it some more and you're ready to go.
You can apply the custom skin like so:
<s:Panel skinClass="path.to.my.CustomPanelSkin" />

How to show a module in Joomla when it's not a Menu item

I am trying to show a module, but the article I want to show the module on is not linked to a menu item. Is this possible? Seems like a module can only show when it is a menu item. But I have a ton of articles that are not menu items - so what is easiest way to show the module? Any help would be greatly appreciated.
The way to do this is as follows.
Let's suppose you have a group of articles that you wish to all display the same modules on.
Create a new category using the "category manager" option from the content menu
Ensure all the articles are published into this same category.
Create a new menu which you won't actually ever display anywhere (I like to publish the menu into a module position which is not present in the template)
Add a category blog layout option to this new menu
Now go through each of the modules that you wish to display for the group and add them to the new menu item you have created.
Hope this helps!
This will be my first answer after getting so many help through stackoverflow without being a member.
I will just add something to buzzki's answer. Because i was almost loosing my mind until i figure out how to solve.
If you used an article in a module with an extension like mod_articleasmodule; it adds the aliases of articles on URL of Read More.
Simply change the line;
$link = "index.php?option=com_content&view=article&id=".$item->id.":".$item->alias."&catid=".$item->catid.":".$item->catalias;
to
$link = "index.php?option=com_content&view=article&id=".$item->id."&catid=".$item->catid;
to get the pure URL Link and your menu assigned by MetaMod will work. Also great thanks to buzzki for help.
While the {loadposition xxx} technique is very handy, what it won't do is to put the module into any of the "standard" module positions (e.g. left, right, banner, or whatever your template has).
If you want your module in one of those positions, a great method is to use MetaMod. MetaMod is a placeholder module, that includes other modules inside of itself according to rules that you set up.
So you can set it up with a rule that says, in effect, "if we are on article A, B, C, D or E, display the module".
if ($content_genius->check("article_id = 50, 51, 52, 53, 54")) return XXX;
// replace XXX with the module id to show on those articles
Now, if the number of articles is going to change regularly, you don't want to have to edit the MetaMod to change the list of ids. So another way is to use the Meta Keywords field in the articles to determine whether the module will appear. Then all you have to do is include that keyword on any article you want the module to appear on. Let's say the keyword will be "SHOWMOD".
So in MetaMod you can simply use this:
if ($content_genius->check("article_metakeywords contains SHOWMOD")) return XXX;
// replace XXX with the module id to show on those articles
In that way, the module will appear on every article page where the article contains that meta keyword. And the module position can be any position on the page (wherever the MetaMod is assigned).
Step 1: On the front end of your website, click to the specific article that you want, highlight and copy the URL.
Step 2: Create a menu item, item type is URL and paste your article URL in there. (You can have the menu item be in an unpublished menu i think)
Step 3: Select it from the Menu Items list in the module.
You simply name your module position whatever you want, say 'monkey' where your module offers a 'select position'. You actually type it in. Then in the article you want to place it in, you add
{loadposition monkey}
to any location of your article you want the mod to work in the html editor.
Follow these steps in your joomla site Admin panel:
Go to the module manager, open the desired module and give a unique name in the position field. If you want to use it also at other common position such as left or right, then first create a copy of this module and then for the new copy, create a unique position name. Example: custom1.
Create a new article preferably uncategorized. Give it the name of your module.
In the body area of the article type {loadposition custom1} and save your article.
Create a Menu link to this article in the desired menu. You should select 'Article layout.'
Thats all, your module will now load from the menu link directly.
This has an added advantage of giving you SEO prominance based on the meta info you give for this article.

Resources