tiddly-gittly / intention-tower-knowledge-graph

ITKG is a knowledge and task management framework for tiddlywiki.
https://tiddly-gittly.github.io/intention-tower-knowledge-graph/
MIT License
4 stars 1 forks source link

补充aggregation内容,说明需要手动处理 #22

Closed dongrentianyu closed 1 year ago

dongrentianyu commented 1 year ago

目前来说是需要手动处理的。本来应该可以控制主题样式是什么的,想改成默认的主题,但好像实现不了,就放弃了。另一个是我直接把aggregation文件放进去了,但我感觉放得不是很规范,我没有写meta文件,因为不知道要怎么写。只能先这样了,再研究下去也研究不出什么来了。

netlify[bot] commented 1 year ago

Deploy Preview for itkg ready!

Name Link
Latest commit c7e3710f56194936691557fd6236675352644d28
Latest deploy log https://app.netlify.com/sites/itkg/deploys/648596c728603a00083908f7
Deploy Preview https://deploy-preview-22--itkg.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

dongrentianyu commented 1 year ago

我只能走到这一步了。

linonetwo commented 1 year ago

我来试试

dongrentianyu commented 1 year ago

代码在另一边贴了。我也说不上来是为什么。感觉像是插件打包的问题,但又不像。

dongrentianyu commented 1 year ago

忽然想到,应该有可以把json格式化的网站或者工具。那确实可以对比出问题来。

linonetwo commented 1 year ago

我刚刚看了一下,知道了,这就是插件优先级的问题,这三个文件是 aggregation 里就有的对吧。那 aggregation 优先级不知为什么比我们的高,所以它插件里的原版,会覆盖我们插件里的这三个条目。

那应该等 aggregation 发新版,然后我们依赖他才对,为啥他建议先手动粘这三个文件?让他赶紧发新版不就好了

linonetwo commented 1 year ago

这其实就是影子条目机制,但是有优先级问题

linonetwo commented 1 year ago

能只用这三个条目吗,只用他们,而不装 "$:/plugins/xp/aggregation" 插件,就没问题了,但是也没按照优先级排序呀

dongrentianyu commented 1 year ago

不能只用这三个条目吧。而且我也没看到aggregation插件里有类似的语法或者功能。也就是说只依赖aggreagtion插件,不能实现我们想要的功能。

当然实质上是应该催xp作者更新aggregation插件,但他一直没上线更新,我们总不能一直等待啊。

当然有可能已经有类似语法了。我再找找看。

linonetwo commented 1 year ago

那应该是改一下条目名,不能和他插件里的一样,不然会被他的覆盖,然后也尽量减少重复,有些没改到的地方就先不复制过来

dongrentianyu commented 1 year ago

但改条目名我之前试过了。不起作用。

dongrentianyu commented 1 year ago

我现在还是没找到他现有的插件里怎么调用他的动态表格。

dongrentianyu commented 1 year ago

image

image

改名了,但没有效果。

linonetwo commented 1 year ago

作者是这个 @keatonlao 吗,怎么好像不怎么用github的样子,最好还是催催他发个版。是他帮你手改了这三个条目,然后qq发给你的吗,其实直接发个新版不就好了嘛

linonetwo commented 1 year ago

可能虽然改了条目名,但是宏名还是一样,然后他的优先级高就还是覆盖了同名的宏

dongrentianyu commented 1 year ago

是他当时发给我的。后面他说会更新,但好像没更新。

有可能更新了,但换了其他表示方式,不过我没找到,不确定。主要是代码太复杂了,完全看不懂,不知道怎么处理。

dongrentianyu commented 1 year ago

那我们可以改宏名来实现想要的功能吗?

我今天还是昨天在github上给他发消息了,但没回。

dongrentianyu commented 1 year ago

image

他应该是更新了的,只是新的语法他没写内容介绍,我才把语法内容找出来。等下我再提个pr,应该就可以了。

说来也怪我,做之前没先认真研究一下这个插件,浪费了这么多时间。

dongrentianyu commented 1 year ago

不过感觉少了一些功能,我再仔细研究一下。

dongrentianyu commented 1 year ago

这个有亿点点复杂。关键是代码里面没有留筛选器的选项。

<$vars aggregationTag="""English""" uiTitle="""$:/config/xp/aggregation/ui/english""" config-base="""$:/config/xp/aggregation-english/TableFields/Visibility/""">
<$wikify name="dtableFields" text="""<$list filter="[list[$:/config/xp/aggregation-english/TableFields]]" variable="listField"><$reveal type="match" state=<<field-config-title>> text="show"> <$text text={{{ [<listField>format:titlelist[]] }}}/> </$reveal></$list>""">
<$macrocall
  $name="aggregation-filtersearch"
  fields=<<dtableFields>>
  state="aggregation-english"
/>
</$wikify>
</$vars>
\define aggregation-filtersearch(fields:"tbl-expand title", class:"w-100", state:"aggregation-general", paginationButton:"yes", rowsButton:"no", viewButton:"yes", searchClass:"xp-search-aggregation", cardTemplate:"$:/aggregation-card-template", tocTemplate, promptTiddler:"$:/aggregation/prompt")

从上面两段代码中,可以看到定义中没有筛选器的选项。而筛选器是如何实现的呢?则是依赖其中的wikify定义的变量里的list来实现的。

好复杂,但我试着去实现特定筛选器来展示内容,没有成功。现在已经在qq群里问了他,看明天会不会有回复吧。如果他回复的话,应该就简单了。

linonetwo commented 1 year ago

是的,太复杂了还没有注释,还是让他加文档和答疑吧,不适合自己琢磨。不过ChatGPT4应该懂

dongrentianyu commented 1 year ago
<$wikify name="dtableFields" text="""<$list filter="[list[新手入门指南]]" variable="listField"><$reveal type="match" state=<<field-config-title>> text="show"> <$text text={{{ [<listField>format:titlelist[]] }}}/> </$reveal></$list>""">
<$macrocall
  $name="aggregation-filtersearch"
  fields=<<dtableFields>>
  state="aggregation-mathx"
  class=""
  cardTemplate=""
  searchClass="xp-search-mathx"
  promptTiddler=""
/>
</$wikify>

这是我刚才仿照写的,但没有显示内容。

dongrentianyu commented 1 year ago

当然如果我们不要搜索框,只搞一个排序的话,上面图片基本上已经实现了。

<$macrocall $name=quick-table caption="项目列表" filter="[tag[新手入门指南]]" fields="title tags" class="w-100"/>

代码如上。基本上也能用。不过我还是想等明天他答疑了再提交pr。要是他好几天甚至一个星期都没回复,那我们就采用这种方案吧。就是少了搜索框什么的。

dongrentianyu commented 1 year ago

嗯,认真看了文档,确定应该没有其他可供参考的提示信息。只好等他来了。明天我不一定有时间,可能得晚上才过来看代码。如果他白天就给出解决方案了,可以提前尝试修改。

dongrentianyu commented 1 year ago

image

问题解决了。现在就是需要切换一下主题插件就可以了。回头我再改一改itonnote主题吧。话说这个名字有什么来历吗?不是很好记的样子。

dongrentianyu commented 1 year ago

我打算把原来的aggregation改为ITKG-aggregation,这样就不容易重复了宏名称。不过我觉得应该把这些个做成插件。因为其他调用方式时,也可以这样来使用。但我看aggregation插件好像只定义了标签的方式。


\define aggr-has-tids()
[tag<aggregationTag>!has[draft.of]limit[1]]
\end

其中$:/aggregation/macros/general条目里有上面代码。

\define aggregation-filtersearch(fields:"tbl-expand title", class:"w-100", state:"aggregation-general", paginationButton:"yes", rowsButton:"no", viewButton:"yes", searchClass:"xp-search-aggregation", cardTemplate:"$:/aggregation-card-template", tocTemplate, promptTiddler:"$:/aggregation/prompt")
\import $:/aggregation/macros/general
\whitespace trim
<$list filter=<<aggr-has-tids>> emptyMessage="{{$promptTiddler$}}" variable="ignore">

然后在$:/aggregation/macros里就调用了上面的筛选器。这就是为什么没有留筛选器的位置。我觉得这个设计不太好。不能方便其他插件调用。但这个插件也没有仓库,也不好去提pr。催的话,感觉也不是很好。

linonetwo commented 1 year ago

是来自 https://github.com/linonetwo/itonnote

反正 aggregation 那个问题最好还是它的作者来优化,这样你调用的时候只要写一两行字就好了,而不需要折腾很久

linonetwo commented 1 year ago

刚看代码发现 plugin-priority 字段可以用,其实文档里也有。或许 GPT 也知道这个,不过当时我忘了,也没去查