【问题标题】:Does Tiddlywiki support hierarchy or namespacing?Tiddlywiki 是否支持层次结构或命名空间?
【发布时间】:2021-01-24 04:01:26
【问题描述】:

我想以具有任意嵌套深度和“干净”的提琴手标题的层次结构大纲样式排列提琴手。

如果我有顶级提琴手 A 和 B,我希望同时拥有 A:foo 和 B:foo(或 A/foo 和 B/foo)

如果两者的标题都只是 Foo 会很好,但如果标题必须是 A:foo 或 A/foo 这可能没问题,虽然当你深入几个级别并需要添加很多时有点重提琴手:

A/content/objects/users/Sally

A/content/objects/users/Bill

...

如果我必须将所有内容都输入并手动保持正确,那就有点麻烦了。我真的很想打开 A/content/objects/users 提琴手并从那里创建一个 SallyBill 提琴手。

有没有办法做到这一点(有或没有插件)?

【问题讨论】:

    标签: tiddlywiki


    【解决方案1】:

    一种方法...创建一个在编辑给定节点时将显示“创建新节点”按钮的提琴手。在我的示例中,我们称它为“NewNodeTemplate”。向其中添加此标签:“$:/tags/EditTemplate”。这将强制在编辑任何 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>
    

    为此,您必须手动创建命名空间的根 tiddler/节点。因此,创建“A”根提琴手。在该节点中创建一个“标题”字段并将“A”放入其中(或您希望在 A 的命名空间中出现的任何内容)。添加标题字段后,将出现“创建新节点”按钮。单击它以创建命名空间的子节点。警告:该节点不会自动出现在 Story River 中——请查看侧边栏中的“更多/最近”选项卡。你应该有一个“新节点”提琴手。打开它。它应该有一个预先填充的命名空间字段。接下来,更改标题并添加标题“Foo”——应该会出现“创建新节点”按钮。重复。

    为您自己的按钮文本和默认 tiddler 标题自定义 EditTemplate tiddler。另外,如果您想在 Story River 中自动打开新创建的 tiddler,我认为可以做到这一点的方法很少。我不喜欢这个...但是您可以将 $savetitle="!!tiddler-title" 添加到 createtiddler 小部件,并添加导航小部件以在 River 中显示新的 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" $savetitle="!!tiddler-title" namespace=<<Concatenate>>/>
    Create New Node
    <$action-navigate $to={{!!tiddler-title}}/>
    </$button>
    </$reveal>
    

    现在唯一要做的就是创建一个显示您正在寻找的大纲的 Tiddler。

    这对你有用吗?

    【讨论】:

      猜你喜欢
      • 2012-09-26
      • 1970-01-01
      • 1970-01-01
      • 2017-12-24
      • 2016-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多