Extracting a specific row of text from a tiddler?

188 vues
Accéder directement au premier message non lu

DemoniWaari

non lue,
2 nov. 2018, 10:14:4002/11/2018
à TiddlyWiki

I would like to have a list of tiddlers where I have mentioned the current tiddler (i.e. like in the references) but I would also want to see the entire row of text where I have mentioned it. Something like this:

Tiddler1
  • Some text
  • Here I mention another tiddler [Tiddler3]
  • Here maybe some other tiddler is mentioned [Tiddler4]
Tiddler2
  • Another tiddler with [Tiddler3]
  • Some other stuff
Tiddler3
  • Tiddler1
    • Here I mention another tiddler [Tiddler3]
  • Tiddler2
    • Another tiddler with [Tiddler3]
I know I could just excise the row I want to another tiddler and then transclude the entire new tiddler but it seems... counter productive. I do not want to have each tiddler consisting of multiple tiny tiddlers each having one row of text. Also it would get annoying to name the excised tiddler, it would need to have the title of the original tiddler + something. I get that the point would be to split the tiddlers to as small parts as possible but I feel this is excessive. Moreover if I can just make one macro/script/whatever to do it all for me why would I not!

I was thinking that maybe I could use a tiddler template for this, but there is not much info about how to do this. In fact, there is very little info on what one can do with tiddler templates. Then I was thinking of using regexp but afaik it only returns the tiddler title and nothing else. Maybe if I can pass the transcluded tiddler to a filter which then parses it to a smaller piece... but I really have no clue how to do this or even if it is feasible.

Thanks!

PS: I noticed that this was asked a few days ago https://groups.google.com/forum/#!topic/tiddlywiki/O50brE2vCkM perhaps I could get some more info!

Mark S.

non lue,
2 nov. 2018, 10:44:0502/11/2018
à TiddlyWiki


On Friday, November 2, 2018 at 7:14:40 AM UTC-7, DemoniWaari wrote:
I know I could just excise the row I want to another tiddler and then transclude the entire new tiddler but it seems... counter productive. I do not want to have each tiddler consisting of multiple tiny tiddlers each having one row of text. Also it would get annoying to name the excised tiddler, it would need to have the title of the original tiddler + something. I get that the point would be to split the tiddlers to as small parts as possible but I feel this is excessive.


Yes. It's just not the way most people would want to do things. Can't help but miss slices.

Instead of excising to a separate tiddler, you could put the row into a field in your tiddler. Then other tiddlers could easily access that row/field ( {{Tiddler3!!importantstuff}} )

-- Mark

Thomas Elmiger

non lue,
2 nov. 2018, 12:46:2102/11/2018
à TiddlyWiki
Not exactly what you want, but a hack to extract snippets from other tiddlers:

https://tid.li/tw5/hacks.html#Extract%20Macro

You would have to mark the sections somehow, e.g. using HTML comments.

Have fun!
Thomas

BurningTreeC

non lue,
2 nov. 2018, 13:28:2102/11/2018
à TiddlyWiki
Hi @DemoniWaari ,

this thread could be interesting for you


I believe that the filter would still need finetuning, but it returns a tiddler line by line if I remember correctly

DemoniWaari

non lue,
2 nov. 2018, 14:26:2702/11/2018
à tiddl...@googlegroups.com
Mark S.,
Instead of excising to a separate tiddler, you could put the row into a field in your tiddler. Then other tiddlers could easily access that row/field ( {{Tiddler3!!importantstuff}} )

True. The problem is that I'd still have to give the field a name, which means that I have to manually go to Tiddler3 and transclude the field. If I need to each time go back to Tiddler3 I might as well just copy/paste the entire row there! Though yes the editing would be a nightmare. In the end I'd like to have a macro/whatever that I put once to Tiddler3, which automatically gathers every row that has Tiddler3 mentioned. So I do not have to touch Tiddler3 at all. I want to make everything as easy to use as possible.

Thomas Elmiger,
 Not exactly what you want, but a hack to extract snippets from other tiddlers
 
Thanks, not sure if I could modify this to suit my needs better.

BurningTreeC,
his thread could be interesting for you


I believe that the filter would still need finetuning, but it returns a tiddler line by line if I remember correctly

This might work, but I'm now more interested in the regexps plugin at the very end! That might suit my needs! Thanks.
 

Ste Wilson

non lue,
3 nov. 2018, 13:53:0703/11/2018
à TiddlyWiki
I have a template set up for equations where a variable automatically shows equations it's used it.
Might be a start point.

Filter code:


Ste Wilson

non lue,
3 nov. 2018, 13:54:4403/11/2018
à TiddlyWiki
Sorry. Wrong button. Try again.
<br>

<center>
{{!!equation}}
</center>

<table>
<tr><th>Variable</th><th>Description</th><th>Unit</th></tr>
<$list filter="[list[!!vars]sort[title]]" >
<tr><th>
<$transclude field="variablelatex"/>
</th><th><$link><$transclude field="title"/></$link></th><th><$transclude field="unitlatex"/></th></tr>
</$list>
</table>

See stephenteacher.tiddlyspot.com/#Angular%20Acceleration to see an example.

Mark S.

non lue,
3 nov. 2018, 14:20:5603/11/2018
à TiddlyWiki


On Friday, November 2, 2018 at 11:26:27 AM UTC-7, DemoniWaari wrote:
Mark S.,
Instead of excising to a separate tiddler, you could put the row into a field in your tiddler. Then other tiddlers could easily access that row/field ( {{Tiddler3!!importantstuff}} )

True. The problem is that I'd still have to give the field a name, which means that I have to manually go to Tiddler3 and transclude the field. If I need to each time go back to Tiddler3 I might as well just copy/paste the entire row there! Though yes the editing would be a nightmare. In the end I'd like to have a macro/whatever that I put once to Tiddler3, which automatically gathers every row that has Tiddler3 mentioned. So I do not have to touch Tiddler3 at all. I want to make everything as easy to use as possible.


Not sure I follow you.

If you have a row in Tiddler3, called row1, then in Tiddler3 you can refer to it by {{!!row1}} and in some other tiddler by {{Tiddler3!!row3}}. If you ever need to change the contents of row3, you only need to do it in one location.

-- Mark

TonyM

non lue,
3 nov. 2018, 19:30:0703/11/2018
à TiddlyWiki
I would like to build and edit toolbar button to wrap a line with or without a link/reference to a tiddler that can be referenced from elsewhere.

I see no problem excising the text into a field of any name into that tiddler and leaving a text reference behind. A default fieldname ending in a number could be generated. We may also maintain a link in the text to ensure reference are generated back to the tiddler.

Basicaly we would then have a feature that allows subtext of a tiddler to be called on. With a little smarts we could have a search that finds all tiddlers that reference a tiddler, then searches excerpts in filds that contain that tiddler title.

These excerpts can be transcluded elsewhere by reference to the tiddler/field, even edited.

Any thoughts?

DemoniWaari

non lue,
5 nov. 2018, 03:02:1205/11/2018
à TiddlyWiki
Mark S.
Not sure I follow you.

If you have a row in Tiddler3, called row1, then in Tiddler3 you can refer to it by {{!!row1}} and in some other tiddler by {{Tiddler3!!row3}}. If you ever need to change the contents of row3, you only need to do it in one location.

Ah yes but that is not what I mean. What I need is that Tiddler3 is static and I do not touch that, it just gathers information about Tiddler3 and presents those neatly. In essence I have a Journal to which I write every day. Each row (usually) has a reference to another tiddler, such as Linux or AFM or whatever. Then those Linux and AFM have their own tiddlers and if I want to quickly see what I have been doing with AFM I can just go to AFM tiddler and immediately see "oh on 5.11.2018 I analyzed this sample, no need to do that again". Using the references technique for this all I see is that I did something with AFM on 5.11.2018 and I still need to click and open up that tiddler and look into more closely what I did. I do not want to open up dozens of tiddlers just to see what I have actually done lately. Thus, I would like to see the referenced tiddler (5.11.2018) and right below it just the row where it is mentioned. Hopefully this clears things up!


TonyM
So if I understand this correctly. You would have a button which would excise the selected text to a field, then provide a direct link to said field, hence it would still be visible in the tiddler's body while being transcludable to separate tiddlers? That could work. Would it be possible to get the field name from the excised text? For instance, if I have text "plaaplaa with [Linux]" could then the field name just be Linux? Also is it possible to gather fields with specific names from all tiddlers? This might be a nice feature!

Ste Wilson
I have a template set up for equations where a variable automatically shows equations it's used it.
Might be a start point.

 This looks interesting, I need to look into this a little bit more. Thanks!

TonyM

non lue,
5 nov. 2018, 04:52:1205/11/2018
à TiddlyWiki
As with the excise tool you could provide a field name or allow a default to be generated.

Tony

Mark S.

non lue,
5 nov. 2018, 12:27:1805/11/2018
à TiddlyWiki
So, your journal tiddler could have a field with a standard name (afm, linux) where you note activities (e.g. afm: recalibrated the influx manifold). Then you could have a tiddler "afm" with a view template that lists all tiddler names and row contents for those actions. e.g.

2018-10-08 recalibrated the influx manifold
2018-11-05 Looked up definition of AFM.
...

-- Mark

TonyM

non lue,
5 nov. 2018, 17:59:1205/11/2018
à TiddlyWiki
Mark,

You could use my Log method in addition to the excise Idea.

I have a solution better than that. From my Journal tiddler or any other tiddler, I click on a Show log checkbox, you can then enter a log entry single line or full editor and "Log Here" or "Log" .

Every entry is another line in a datatiddler prefixed with the date time and includes the current tiddler if I use the "Log here". I attached a snap shot to illustrate.

loghere.jpg


You can see I can view the tiddlers relating to the current tiddler, or all tiddlers.

On the current thread. I will try and do a Quick demo of the excise to field button idea.

Regards
Tony

Mark S.

non lue,
5 nov. 2018, 18:17:2105/11/2018
à TiddlyWiki
That's an attractive approach. I like the presentation (what I can see of it -- more below) But I have a feeling that using data tiddlers ends up being too limiting because there are so few filter operators relating to tiddlers.

I'm wondering if anyone else has the problem with GG and screen shots that I do. Your screen shot shows up as something only a little bigger than a thumbnail. I have to squint and put my nose up to the screen ;-)

-- Mark

TonyM

non lue,
5 nov. 2018, 18:48:1605/11/2018
à TiddlyWiki
Mark,

Using the data tiddler you can actually iterate every line. I have not done it yet but it would be quite easy to search each line and display only those meeting the criteria, they are stored in chronological order already, then the line itself contains references to related tiddlers you can open.

Try r-click open in new tab, on the image.

I have attached a bundle of tiddlers relating to my showlog but I have not tested if this package will work out of the box.

In relation to excising to a field I have started work, and although it seems achievable, to make it really functional will need a snazy option filled interface, that test for existing fields or generates new names. Especially if we want to ensure a link to another tiddler in the snippit in the OT (Orignal Topic) we retain the reference.

I wonder if there is another way?

What would be nice is a way to include a link to a tiddler eg [[other tiddler]] such that, that [[other tiddler]] will see this as a reference, while not actually displaying [[other tiddler]] 
Actually If we can excise text including a reference to another tiddler to (lets call it) a snippit, but not only replace it with a transclusion but leave the snippit in the text (only make it hidden/consume no space when viewing the tiddler) then search, references and more will continue to work despite the the "excising of the snipit". 

This needs more thought to meet the initial requirements. I am convinced there is an easy way.


Tony
Show-Log-Macro.bundle.json

DemoniWaari

non lue,
6 nov. 2018, 03:03:0706/11/2018
à tiddl...@googlegroups.com

Mark S.
So, your journal tiddler could have a field with a standard name (afm, linux) where you note activities (e.g. afm: recalibrated the influx manifold). Then you could have a tiddler "afm" with a view template that lists all tiddler names and row contents for those actions. e.g.

Yeah this could work. All it would need is a neat way of actually doing that field, as in, I'd rather not type out everything twice (text and field). The downside is though that there will be no formatting, so I can't have e.g. two bullet points under "afm", I'd just have to put everything in one line. A small sacrifice I suppose.

TonyM
I have a solution better than that. From my Journal tiddler or any other tiddler, I click on a Show log checkbox, you can then enter a log entry single line or full editor and "Log Here" or "Log" .
Every entry is another line in a datatiddler prefixed with the date time and includes the current tiddler if I use the "Log here". I attached a snap shot to illustrate.
 
This is an interesting approach. Perhaps I could have data tiddlers for each tiddler (e.g. "afm") and then use some keybind to append data neatly from any tiddler to this data tiddler. Then just gather all that info up in the actual "afm" tiddler and show it nicely. Then if I change the content of the data I could just use the same keybind and it would automatically find and update the corresponding row in the data tiddler (JSON or whatever). This would be quite close to what I want. I would guess this is a better approach than the field approach? I have virtually no experience with either, but I would think that JSON is easier to manipulate and updating the correct rows etc would be a piece of cake.

The more I think about this the more I like it. A "database" would be amazing. I could do this to all sorts of data and then later if I want to show them nicely in a tiddler I can just gather it all up from data tiddlers. Are there any downsides to using data tiddlers instead of fields?

TonyM
What would be nice is a way to include a link to a tiddler eg [[other tiddler]] such that, that [[other tiddler]] will see this as a reference, while not actually displaying [[other tiddler]] 
Actually If we can excise text including a reference to another tiddler to (lets call it) a snippit, but not only replace it with a transclusion but leave the snippit in the text (only make it hidden/consume no space when viewing the tiddler) then search, references and more will continue to work despite the the "excising of the snipit".

Would it not be easier not to use transclusion in this case? Just copy the snippit and be done with it. Then the original text stays the same, references and all that work fine and it looks exactly the same. The same data is just also present in the snippit. Then if you change the initial text, you would just do the snippit again and it would be updated with the new data.

TonyM

non lue,
6 nov. 2018, 04:04:2406/11/2018
à TiddlyWiki
Fyi

A quick test suggested if you transclude, the references do not get recognised. Thus I wanted to maintain that.

I will build something, but not imediatly, my current line of thinking is a macro that wraps the snipit using an editor toolbar button eg

<<Snipit """the snipit or lines and [[tiddler link]]""">>

Then in view mode you see an icon or two next to the displayed snipit which on clicking creates a field in the current tiddler or a data tiddler containing the snipit, another click to copy the reference to the snipit into the clipboard.

Regards
Tony

Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message