Stéphane,

Some-one on GitHub in the bug report (link) mentioned that you can "view" 
the raw text of a field with the View Widget.

So, where as {{foo!!bar}} is a shortcut for 

<$tiddler tiddler="foo"><$translcude tiddler=<<currentTiddler>> 
field="bar"/></$tiddler>

You can create a macro that uses the View Widget like so:

```
\define viewField(tiddler,field)
<$tiddler tiddler=$tiddler$><$view field=$field format="text"/></$tiddler>
\end

<<viewField "tiddler a" "foo">> <<viewField "tiddler a" "bar">>
```
You could even use the View Widget directly if the defaults would do fine:

```
<$tiddler  tiddler="tiddler a">
<$view  field="foo"/><$view field="bar"/>
</$tiddler>
```

If you had wikitext in the field that needed to be proccessed, you could 
use a different "format" value: https://tiddlywiki.com/#ViewWidget

Best,
Joshua Fontany

On Wednesday, August 18, 2021 at 2:20:51 PM UTC-7 Misterel85 wrote:

> Thank you for your very interesting and useful examples, Tones. I didn't 
> know about `sentencecase`! I'll keep that post as a reference. 
> And thank you very much for proposing your help.
>
> Sorry for not replying sooner. I've spent the last two days thinking those 
> field connexion rules over for my project and I can say they are not that 
> obvious to define. Anyway, here is something that would correspond to my 
> needs, but it needs 'conditional transclusion'. So I gladly accept your 
> offer.
>
> So, in order to manage my sources, I have a 'reference' field for general 
> information and a 'details' field for any additional information, that I 
> must transclude in that order: `reference` + `details`.
>
> Here's how I see things:
>
> * the value in 'details' may start with `p. ` (for page) or `pp. ` (for 
> pages).
> Then I would connect 'reference' and 'details' with `, ` (comma + 
> whitespace).
> For instance:
>     Doe, John. //My Great Exercise Book// (2019), pp. 28-32.
>
> * the value in 'details' may start with a word in lowercase: `exercise 2`, 
> `chapter 4`, etc.
> Then I would connect 'reference' and 'details' with ` — ` (whitespace + 
> dash + whitespace).
> For instance:
>     Doe, John. //My Great Exercise Book// (2019) — chapter 6 exercise 5 p. 
> 61.
>     
> * the value in details may start with the first word having a capital 
> letter (uppercase), to start a short sentence.
> Then I would connect 'reference' and 'details' with `. ` (period + 
> whitespace).
> For instance:
>     August 2018 training session with John Doe. See short video for this 
> exercise on YouTube.
>
> * if the `details` field is empty, then I would need to end the 
> transclusion of `reference` with `.` (period).
>
> I'm not too sure what I should do if the value in `details` field starts 
> with a character that is not a letter, which may happen in very rare cases. 
> And I can still alter the value accordingly:
> For instance:
>     [[Comprehensive Exercise Website|www.to.the.link.com]] — "Exercises" 
> tab, bottom of page.
> might be replaced with:
>     [[Comprehensive Exercise Website|www.to.the.link.com]]. See 
> "Exercises" tab, bottom of page.
>
> I hope the goals I have set are clearly explained and above all doable.
>
> I suppose that making liberal use of list filters and operators such as 
> 'split', 'join', 'append', 'match', it could be possible to build those 
> 'conditional field transclusions', but I don't think I could do that alone!
>
> Regards,
>
> -Stéphane
>
> Le lundi 16 août 2021 à 14:45:29 UTC+2, TW Tones a écrit :
>
>> Misterel,
>>
>> Perhaps my writing is not so helpful, but my advice is intended to make 
>> it simpler for you. I would be happy to write the code to resolve the 
>> concatenation of various text snippets into sentence like text. All I would 
>> need is samples of the text you whish to join (without presentation related 
>> hacks eg leading spaces etc...
>>
>> The first examples would be foo="This is foo"  bar="and this is bar." 
>> please join as a sentence.
>>
>> Feel free to be pragmatic and decline my offer but also feel free to ask.
>>
>> Here are some examples to look at, paste into a tiddler on tiddlywiki.com, 
>> add the foo and bar fields as before. 
>> See how alice and bob values are independent of the order in which they 
>> will be presented, used?
>>
>> \define full() {{!!foo}} {{!!bar}}
>> \define full2() $(foo)$ $(bar)$
>> \define full3() $(alice)$ and $(bob)$.
>>
>> ```
>> \define full() {{!!foo}} {{!!bar}}
>> \define full2() $(foo)$ $(bar)$
>> \define full3() $(alice)$ and $(bob)$.
>> ```
>>
>> <$vars
>> foo="This is foo"  
>> bar="and this is bar."
>> alice="this is Alice"
>> bob="this is Bob"
>> cat="this is cat"
>> >
>>
>> # `<<foo>> <<bar>>` <<foo>> <<bar>>
>> # `{{!!foo}} {{!!bar}}`  {{!!foo}} {{!!bar}}
>> # `{{{ [<foo>] [<bar>] +[join[ ]] }}}` {{{ [<foo>] [<bar>] +[join[ ]] }}}
>> # `<$text text={{{ [<foo>] [<bar>] +[join[ ]] }}}/>` <$text text={{{ 
>> [<foo>] [<bar>] +[join[ ]] }}}/>
>> # `<$text text={{{ [{!!foo}] [{!!bar}] +[join[ ]] }}}/>` <$text text={{{ 
>> [{!!foo}] [{!!bar}] +[join[ ]] }}}/>
>> #`<<full>>` <<full>>
>> #`<<full2>>` <<full2>>
>> #`<<full3>>` <<full3>> | {{{ [<full3>sentencecase[]] }}}
>> #`{{{ [<alice>] [<bob>] +[join[ and ]addsuffix[.]sentencecase[]] }}}` {{{ 
>> [<alice>] [<bob>] +[join[ and ]addsuffix[.]sentencecase[]] }}}
>> #`{{{ [<bob>] [<alice>] +[join[ and ]addsuffix[.]sentencecase[]] }}}` {{{ 
>> [<bob>] [<alice>] +[join[ and ]addsuffix[.]sentencecase[]] }}}
>>
>>
>> </$vars>
>>
>>
>>
>> Regards
>> Tones 
>>
>> On Monday, 16 August 2021 at 19:54:36 UTC+10 Misterel85 wrote:
>>
>>> Tones,
>>>
>>> Oh, now I better see what you mean by 'separating the data from its 
>>> presentation'.
>>> It kind of reminds me of my attempts at concatenating genealogical data 
>>> in LaTeX with AppleScript years ago. What you advise is something I more or 
>>> less tried to do at the time.
>>>
>>> I fully agree with what you wrote, but your precious advice stumble over 
>>> a huge impediment: my poor skills at programming in general, and Wikitext 
>>> in particular! I have absolutely no programming or STEM background, 
>>> unfortunately, and I am only a tinkerer.
>>>
>>> When I manage to copy-paste and adapt existing code snippets to meet my 
>>> needs, I am very happy.
>>> What a seasoned programmer would conceive and write in half an hour will 
>>> take hours --if not days-- for me to think about and assemble, and I am 
>>> overwhelmed with joy if it works, even if the resulting code would be 
>>> scoffed at by students, let alone their teachers, after a few months in a 
>>> 101 Programming class.
>>>
>>> Being both a perfectionist and a dabbler, one should never been given 
>>> such good advice as yours! They will  keep what you suggest in mind and 
>>> want to implement it without ever knowing how to get started! How terrible! 
>>> ;-)
>>> My project is certainly not well-thought-out, and if it was, I would 
>>> probably need more code examples like the solution Eric Shulman kindly 
>>> provided me with. And TW v. 5.2.0 being in prerelease, I haven't looked 
>>> into it yet.
>>>
>>> I am aware that that TW project of mine is personal and is not designed 
>>> to be published. Unless I get struck with Alzheimer's disease soon --in 
>>> which case I won't need that project anymore--, for the moment I should be 
>>> able to remember its quirks when I use it. And there's room for improvement 
>>> in several other priority aspects of it. I am already spending way too much 
>>> time trying to achieve a project that probably wouldn't need all those 
>>> bells and whistles to work properly, to the detriment of other --as / 
>>> more-- meaningful projects. 
>>>
>>> Best,
>>>
>>> Stéphane
>>>
>>> Le lundi 16 août 2021 à 02:34:48 UTC+2, [email protected] a écrit :
>>>
>>>> We've found a bug!
>>>>
>>>> The wikitext parser object always tries to read Pragmas from the 
>>>> beginning to parse a text, and this _always_ trims whitespace from the 
>>>> text 
>>>> (moves the parser position past any leading whitespace).
>>>>
>>>> The $:/core/modules/parsers/wikiparser/wikiparser.js module needs to 
>>>> updated.
>>>>
>>>> The Parser's `this.skipWhiteSpace =` method needs to check the 
>>>> `this.configTrimWhiteSpace` value before moving the parser position, or 
>>>> reset the parser position if no pragmas are read, etc.
>>>>
>>>> This type of change should definitely have Jeremy's eye on it.
>>>>
>>>> I am terribly busy at work, so I will come back and file a Bug/Issue on 
>>>> GitHub if no-one else can.
>>>>
>>>> Best,
>>>> Joshua Fontany
>>>>
>>>> On Sunday, August 15, 2021 at 10:34:41 AM UTC-7 Misterel85 wrote:
>>>>
>>>>> Yay, it works!!! Thank you very much for your quick reply and your 
>>>>> simple and straightforward solution, Eric!
>>>>> After a bit of trial and error, I could adapt it to my TiddlyWiki.
>>>>> No need for an &nbsp; anymore indeed.
>>>>> Thanks again to all of you for your help, solutions, explanations and 
>>>>> suggestions.
>>>>>
>>>>> Best,
>>>>> -Stéphane
>>>>>
>>>>> Le dimanche 15 août 2021 à 18:01:55 UTC+2, Eric Shulman a écrit :
>>>>>
>>>>>> On Sunday, August 15, 2021 at 7:10:39 AM UTC-7 Misterel85 wrote:
>>>>>>
>>>>>>> I first thought there would have been a more straightforward 
>>>>>>> solution to that issue, but actually I come to think that it should be 
>>>>>>> possible to inspect the first character in the contents of field 2:
>>>>>>> If value of field2 starts with space, then insert `&nbsp;` between 
>>>>>>> the transclusions, else just proceed with both transclusions.
>>>>>>>
>>>>>>
>>>>>> Try this:
>>>>>> <$transclude field="field1"/><$text text={{{ 
>>>>>> [{!!field2}split[]first[]match[ ]] }}}/><$transclude field="field2"/>
>>>>>>
>>>>>> Notes:
>>>>>> * The {{{ [...] }}} is a "filtered transclusion"
>>>>>> * The filter starts by getting the value of the desired field, using 
>>>>>> {!!field2}
>>>>>> * It then splits that value into separate characters, using split[]
>>>>>> * Next, it gets just the first character, using first[]
>>>>>> * and compares it with a space, using match[ ]
>>>>>> * The result of the filter is either nothing, or an actual space 
>>>>>> character (not an &nbsp;)
>>>>>> * The <$text> widget then converts the output to plain text (instead 
>>>>>> of displaying a link to a space!)
>>>>>>
>>>>>> enjoy,
>>>>>> -e
>>>>>>
>>>>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4d25b803-e009-4496-b673-a9c00c668503n%40googlegroups.com.

Reply via email to