Discussion:
[tw] How to cite part of texts in a tiddler from another?
Asimov Isaac
2017-10-07 08:53:30 UTC
Permalink
Dear all,

If I want to cite some texts in one tiddler from another, what should I do?

Here is an example. If I want to translate some English to French, and the
tiddler may look like this:

(Paragraph 1) Some English sentences...

(Paragraph 2) The French translations of Para 1 ...

(Paragraph 3) Some other English sentences ...

(Paragraph 4) The French translations of Para 3 ...

...

...


And now I want to display all the French translations (without the English
parts) in a new tiddler, which is the para 2, para 4 and so on in the
example above. Like this:

Some other words ...

The French translations of Para 1 (above)...
The French translations of Para 3 (above)...
...



I have tried some methods, but they all do not work well:

1. Transclusion. But its capability is limited:
- Transclusion can only transclude the whole tiddler.
2. Macros (with importvariables). This also has some disadvantages:
- You must define them all at the start of the tiddler.
- For each paragraph you need to give it a new macro name.
3. HTML syntax.
- I can use <div> or <p> to customise the paragraph, but I do not
know how to transclude them in another tiddler.


Here is an extended requirement:

- Since the French texts are structurely-similar in the example above,
I am wondering whether I could just use one identifier and list them in
the new tiddler in order of the sequence in the original tiddler.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d005b944-bd43-4f75-9f28-6fbe2a6615a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jed Carty
2017-10-07 09:02:32 UTC
Permalink
There has been a lot of discussion about this and then general consensus is
the solution is to make different tiddlers for each paragraph and then
transclude only the french or english tiddlers.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/758be331-ac6b-43c8-9447-2a08d4b525e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Asimov Isaac
2017-10-07 09:30:26 UTC
Permalink
@Jed Carty,

Oh, really thanks for your reply and apologize for my repeating this topic.
:P

Maybe I myself could develop a plugin for this functionality ...
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/1d1cebf7-61b6-4940-89db-cd3902a4a0fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jed Carty
2017-10-07 09:51:49 UTC
Permalink
I just realised that there is a simple way to do this. You can use the
reveal widget. If you have a tiddler where you select the language and have
each paragraph wrapped in a reveal widget for that language.

Here is a quick demo:

<$radio tiddler='$:/state/Language' field='text'
value=English>English</$radio>
<$radio tiddler='$:/state/Language' field='text'
value=Français>Français</$radio>



<$reveal type='match' state='$:/state/Language' text='English'>
This is the English text.
</$reveal>
<$reveal type='match' state='$:/state/Language' text='Français'>
Voici le texte français.
</$reveal>
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/549e269c-0c9f-4fed-985a-b01e908fe23a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Asimov Isaac
2017-10-07 10:59:47 UTC
Permalink
Wow, this method provides a new way of presenting the translations.

Although it could not solve the problem of partly reference indeed, it
really broadens my horizons and makes me think about some clean methods to
solve the problem.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/21a1de42-3957-4fa8-a5c7-6b1e21d434b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thomas Elmiger
2017-10-07 20:50:24 UTC
Permalink
Hi,

There is one other method you could use: my extract macro hack published on
http://tid.li/tw5/hacks.html#Extract%20Macro

If you have this installed, you can mark your french paragraphs using
visible or invisible markers for the start and the end. To use your
example, you could use italic text for french like this:

(Paragraph 1) Some English sentences...

(Paragraph 2) //The French translations of Para 1 ...//

(Paragraph 3) Some other English sentences ...

(Paragraph 4) //The French translations of Para 3 ...//


This macro, placed in your second tiddler, would find all italic text:

<<extract "Original Tiddler" start:"//" end:"//" limit:"no">>

As invisible markers I used HTML comments successfully. E.g.

(Paragraph 2) <!-- FR -->The French translations of Para 1 ...<!-- /FR -->

This macro would find all french text:

<<extract "Original Tiddler" start:"<!-- FR -->" end:"<!-- /FR -->"
limit:"no">>

Happy extracting!
Thomas
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/df4c4653-d799-4278-bbca-6873f41ba41b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Asimov Isaac
2017-10-08 07:56:25 UTC
Permalink
Hi, Thomas,

I spend two hours playing your macro and it's really amazing!
Your method is nearly what I seek! And with some modifications, the Extract
Macro could be useful in more cases.
It seems like using macros is the most ideal solution to this kind of
problems now.

The only slight "flaw" is that if you use the same identifier to include
several snippets in one tiddler (e.g. " , //, or <!-- FR --> here), you
can only extract the first snippet and others will be ignored.
Maybe this flaw can be easily bypassed by using different identifiers (like
<FR 1>, <FR 2>,<FR3>...) and extracting them in another tiddler one by one.
(Though "ugly", it works.)
Or this can be solved with some improvements to the Extract Macro itself so
that it can recognize all the snippets included by the same identifier.
(And this may take me some time ...)

A little suggestion:
I think that the tiddler "SummaryTest" and "SummaryResults" is more
appropriate to be displayed in your page as the example for beginners of
your macro.
(http://tid.li/tw5/hacks.html#SummaryTest)
The tiddler "Extract Macro" may contain too much information and a beginner
could feel confused. (Just my personal feeling, no offence. :P)

Thanks again for your awesome solution!
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/bbc86677-6516-4bb3-8058-1ec6dcb56a3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thomas Elmiger
2017-10-08 08:32:56 UTC
Permalink
Hi Isaac,

The parameter limit:"no" (as included in my examples) should give you *all*
results. When it is missing, the macro returns only the first occurrence.
Did you realise that?

Concerning the documentation you are absolutely right, I should revise
that. Great you found my testing examples yourself.

Good luck!
Thomas
Post by Asimov Isaac
I think that the tiddler "SummaryTest" and "SummaryResults" is more
appropriate to be displayed in your page as the example for beginners of
your macro.
(http://tid.li/tw5/hacks.html#SummaryTest)
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/4dea3cfb-3cad-4169-9d27-003af56d0269%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Asimov Isaac
2017-10-08 12:49:04 UTC
Permalink
Hi Thomas,

Yes, you're right. When the parameter limit:"no" is added, everything works
perfectly. Sorry for my carelessness. XD
And I find that your example even supports adding prefix and suffix, it is
far more flexible than I imaged. That means there must be more features I
have not noticed in your macro.

Your macro is a great help to me, and I think there must be other people
who also need this.

Thanks again!

Isaac
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/79ae464c-5ab0-403a-8679-7e64000ed3e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TonyM
2017-10-08 11:46:25 UTC
Permalink
Issac,

A creative approach?

on reading through the discussion again, i was thinking about the excise tiddler feature in the editor. you can hightlight and cut text into a tiddler and a transclusion of that remains in the source tiddler.

what if you chose one language as primary and excised all the translations with a keyboard shortcut. you would then have translations or extracts in their own tiddlers, tagged with the source tiddler and the extracts tiddler title acts like a place holder in the source tiddler.

Despite extracting the translations from the source tiddler it will display both languages, use the subtiddlers for one language and the transclusion text as deliniators in the primary tiddle.

you may even be able to make custom excise button for each language and tag an excise with its language. you can then reuse them, tag them and show whatever you want whenever you want.

just an idea.

tony
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/7234a0bc-3e00-441e-9bfa-ddf35338706a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Asimov Isaac
2017-10-08 12:52:54 UTC
Permalink
Hi Tony,
Good suggestion!
We can combine the methods through our discussions together, and customize
them according our own needs. It must be powerful to do most things we want.

Isaac
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/9e5337db-2196-49c5-aa54-1f7a344701a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TonyM
2017-10-08 00:10:56 UTC
Permalink
Isaac (not really you full name?),

You may have more than enough do go on here but I was recently
experimenting with what I call note taking shorthand, for taking notes in
class, on tiddly wiki,

In a Tiddler tagged $:/tags/Stylesheet I placed some custom css

eg

.q { color: orange;
}

.a { color: blue;
}

In this case if I use colon, semi-colon, *, # and a few other characters s the first character in a line of wiki texts yo can apply the "css as follows;

;.q My Question
:.a The Answer

*.q A Question in bullets

Perhaps one way would be to create a .f For french, and a .e for english and annotate your text accordingly,
you could then use this to display or hide the text by altering the css. Perhaps even borders,
backgrounds or colours could emphasis one while keeping the other. You may still use the .f and .e in some kind or text filter as well.

Regards
Tony
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a08ed99e-3baf-4a46-b9a7-622048f0d837%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Asimov Isaac
2017-10-08 07:20:25 UTC
Permalink
Hi, Tony,

Thank you for your reminding.
CSS and HTML are really good alternitives if someone is not familiar with
WikiText at the beginning.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/cd53654e-aa93-4a35-be5d-54d079e28ba1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...