Hi Tony The issue here is some arcane details of how HTML and CSS work, and how they interact with TiddlyWiki.
HTML documents contain text and tags. The text can contain any kind of whitespace. Browsers ship with default stylesheets that assign styling to tags and combinations of tags. In particular, the standard CSS for ordinary text collapses runs of whitespace into a single space, regardless of whether it is made up of spaces, newlines or tabs. That means that the whitespace in an HTML document generally doesn't matter, and an author can use whatever whitespace conventions work well in their authoring environment. Now, browsers support a method "textContent()" on tags which retrieves the text of the tag and any descendent tags. The text will faithfully contain the whitespace in the original HTML. So the fundamental problem is that the display of your tiddler is governed by CSS, and not by the whitespace within it. But, when the wikify widget is used with "text" output, it uses that same textContent() method to retrieve the text portion of the HTML. That means that you get the whitespace contained in the original HTML, and not the whitespace "generated" by CSS for display. The dichotomy between rendering to dynamic HTML and rendering to plain text is embodied in the details of how we use TiddlyWiki in the browser to generate an interactive document while also using it on the server or the browser to generate an HTML file for a browser. The nub is that when you're extracting text content then whitespace matters. Best wishes Jeremy -- Jeremy Ruston [email protected] https://jermolene.com > On 25 Aug 2019, at 04:09, TonyM <[email protected]> wrote: > > > Jeremy, > > Thanks for your help, This solves the problem but does not answer the > question. Of course I can change the source "the template" to produce > something different, in this case the tiddler only exists to provide a csv > and I doubt anyone would like to view it. So I can copy to clipboard the > contents of a "special" tiddler (with breaks removed). What if however I want > to copy to clipboard other tiddlers that look great on screen? will I have to > clone them and remove `<br>` from every line? > > My Original thread asked "Copy result of wikitext and macros to clipboard" it > did not ask how do I change my tiddlers so when they are copied to clipboard > they look as if they were as rendered. > > Because I provided a minimal test case it's easy to change the > "source/template" so it behaves, but beyond this minimal test case, it does > not help. I want to change the way to capture the result, not change the > result, so it captures correctly. > > Is there a way to get the wikify to behave and not insert breaks and leading > spaces that are NOT in the source tiddler after rendering? > > Why does it do this? The thing is I want a way to faithfully capture what > would be rendered into a variable, another tiddler or the clipboard, not some > other result! > > Perhaps wikify can't be used for this, but can you see the gap I am pointing > out? It is I believe something a lot of us do incorrectly because we expect > wikify to render or evaluate the wiki text and return the result. It does not > as It returns something else, perhaps something it needs to return, but not > something users expect it to return. > > Here is an example someone may want to do, capture the top level list of the > TableOfContent > \define actions() > <$wikify name="content" text={{TableOfContents}} output=text mode=block> > <$action-sendmessage $message="tm-copy-to-clipboard" $param=<<content>>/> > </$wikify> > \end > <$button actions=<<actions>>> > Copy to clipboard > </$button> > Try it and look at the result > > Its useless. > > I hope I have finally managed to demonstrate this perceived issue. > > Regards > Tony > > > > > > > >> On Saturday, August 24, 2019 at 6:26:02 PM UTC+10, Jeremy Ruston wrote: >> Hi Tony >> >> Apologies for my earlier brief reply. >> >> The key here is that line breaks in the original wikitext will appear in the >> output of the wikify widget. Here we only want a single line break at the >> end of each line. Try changing the template to: >> >> <$list filter="[is[system]prefix[$:/plugin]]"><$text >> text=<<currentTiddler>>/>,{{!!plugin-type}} >> </$list> >> >> Best wishes >> >> Jeremy >> >> >>> On 22 Aug 2019, at 23:39, TonyM <[email protected]> wrote: >>> >>> Jeremy et al.. >>> >>> I still can't resolve this and here is a minimal case that works on >>> Tiddlywiki.com >>> >>> Tiddler that generates a CSV format output (on screen) >>> <$list filter="[is[system]prefix[$:/plugin]]"> >>> <$text text=<<currentTiddler>>/>,{{!!plugin-type}}<br> >>> </$list> >>> >>> Screen Looks like this >>> $:/plugins/tiddlywiki/browser-sniff,plugin >>> $:/plugins/tiddlywiki/evernote,plugin >>> $:/plugins/tiddlywiki/nodewebkitsaver,plugin >>> $:/plugins/tiddlywiki/railroad,plugin >>> >>> A tiddler containing the copy to clipboard code >>> \define actions() >>> <$wikify name="content" text={{CSV output}} output=text> >>> <$action-sendmessage $message="tm-copy-to-clipboard" $param=<<content>>/> >>> </$wikify> >>> \end >>> <$button actions=<<actions>>> >>> Copy to clipboard >>> </$button> >>> >>> After copying to clipboard a paste returns this exactly >>> >>> $:/plugins/tiddlywiki/browser-sniff,plugin >>> >>> $:/plugins/tiddlywiki/evernote,plugin >>> >>> $:/plugins/tiddlywiki/nodewebkitsaver,plugin >>> >>> $:/plugins/tiddlywiki/railroad,plugin >>> >>> >>> Yes - full of unwanted line breaks and leading spaces and more in other >>> exampls >>> >>> Yes I tried using output=formatedtext >>> and I get exactly this >>> >>> >>> $:/plugins/tiddlywiki/browser-sniff,plugin >>> $:/plugins/tiddlywiki/evernote,plugin >>> $:/plugins/tiddlywiki/nodewebkitsaver,plugin >>> $:/plugins/tiddlywiki/railroad,plugin >>> >>> >>> Also I tried all 4 combinations of output= text/formatedtext and >>> mode=block/linline >>> >>> I just never get close to getting what I am after, something looking like >>> it is displayed. >>> >>> Even if I get an answer for this use case it never seems very robust. How >>> can I go on to use this to do the same for more sophisticated tiddlers? >>> with more complex macros or JSON, html tiddlers etc... >>> >>> Your continuously perplexed fan. >>> Tony >>> >>>> On Thursday, August 22, 2019 at 6:32:19 PM UTC+10, Jeremy Ruston wrote: >>>> Hi Tony >>>> >>>> A more minimal test case would be helpful. >>>> >>>> You may want to explore the "output" attribute of the wikify widget. >>>> >>>> Best wishes >>>> >>>> Jeremy >>>> >>>> >>>> -- >>>> Jeremy Ruston >>>> [email protected] >>>> https://jermolene.com >>>> >>>>>> On 22 Aug 2019, at 00:52, TonyM <[email protected]> wrote: >>>>>> >>>>> >>>>> Jeremy, >>>>> >>>>> Thanks this method does copy a version of the rendered tiddler. However >>>>> the result does not behave the same as if I were to copy the result of >>>>> viewing the rendered tiddler. >>>>> >>>>> I have tried changing the output but there is a fundamental difference - >>>>> the clipboard always contains numerous extra Characters, resulting in >>>>> multiple line feeds. >>>>> >>>>> The following is an example of the macros in the tiddler I am trying to >>>>> copy, basically it generates a CSV formatted output >>>>> <$list filter={{CMI Consultants list!!consultants-list}} variable=person> >>>>> <$tiddler tiddler=<<person>> > >>>>> <$text text=<<person>>/>, >>>>> <<field discipline>>, >>>>> Here: <<display-valid-services>>, >>>>> <$list filter={{CMI office-list!!office-list}} variable=office> >>>>> <$list filter="[<person-in-office-flag>limit[1]]" >>>>> emptyMessage="" variable=result><<result>>,</$list> >>>>> </$list> >>>>> </$tiddler><br> >>>>> </$list><!-- people --> >>>>> >>>>> Its output on screen looks like this >>>>> Prue Tannner, Occupational Therapist , Here: , ✔ , ✔ , ✔ , ✔ , , , , , , >>>>> Renae Alarm, Occupational Therapist , Here: , ✔ , ✔ , ✔ , , , , , , , >>>>> Manda Bell, Occupational Therapist , Here: , , , , , , , ✔ , , , >>>>> Ant Cuttler, Rehabilitation Counsellor , Here: , ✔ , ✔ , , , , , , , , >>>>> Linda Paxter, Rehabilitation Counsellor , Here: , ✔ , ✔ , ✔ , , , , , , , >>>>> Linda Wooden, Occupational Therapist , Here: , , , , , , , , ✔ , , >>>>> >>>>> But the clipboard content separates every text element above with >>>>> multiple line feeds >>>>> >>>>> It can only seem to me that wikify is not doing as advertised. Because of >>>>> this I have sought other methods to resolve this without results. >>>>> >>>>> Regards >>>>> Tony >>>>> >>>>> >>>>> >>>>>> On Wednesday, August 21, 2019 at 2:00:51 AM UTC+10, Jeremy Ruston wrote: >>>>>> Hi Tony >>>>>> >>>>>> Here's one way to do it. It's a classic application of the wikify >>>>>> widget: we need access to the wikified text of a tiddler, rather than >>>>>> its raw text. >>>>>> >>>>>> Note how the actions are placed in a separate action string to avoid >>>>>> having to do the wikification until it is required (if it was within the >>>>>> button widget then the wikify widget would be re-evaluated each time the >>>>>> store changes). >>>>>> >>>>>> Best wishes >>>>>> >>>>>> Jeremy >>>>>> >>>>>> >>>>>> \define actions() >>>>>> <$wikify name="content" text={{HelloThere}}> >>>>>> <$action-sendmessage $message="tm-copy-to-clipboard" $param=<<content>>/> >>>>>> </$wikify> >>>>>> \end >>>>>> <$button actions=<<actions>>> >>>>>> Copy to clipboard >>>>>> </$button> >>>>>> >>>>>> >>>>>> -- >>>>>> Jeremy Ruston >>>>>> [email protected] >>>>>> https://jermolene.com >>>>>> >>>>>>>> On 19 Aug 2019, at 11:58, TonyM <[email protected]> wrote: >>>>>>>> >>>>>>> >>>>>>> Folks, >>>>>>> >>>>>>> I believe I should know this, but I have a tiddler name "tiddlername" >>>>>>> which contains wikitext, list macros and more. Its a beautiful >>>>>>> representation of a csv file from my tiddler data and fields. >>>>>>> >>>>>>> In any tiddler I can place {{tiddlername}} and see the wonderful result. >>>>>>> >>>>>>> However I want to be able to copy the result as text >>>>>>> >>>>>>> <$button message="tm-copy-to-clipboard" param= > >>>>>>> Copy to clipboard >>>>>>> </$button> >>>>>>> >>>>>>> How do I provide this with the appropriate parameter ? >>>>>>> >>>>>>> I have another tiddler called "realcutetiddler" which renders a really >>>>>>> nice HTML output. Rather than save this as a static html tiddler I >>>>>>> would like to copy the HTML result to the clipboard >>>>>>> >>>>>>> Again How do I provide the above with the appropriate parameter ? >>>>>>> >>>>>>> At the moment, with everything I try I just get in the clipboard the >>>>>>> raw unprocessed wiki text in my tiddlers. >>>>>>> >>>>>>> Yours, very lost. >>>>>>> >>>>>>> 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 [email protected]. >>>>>>> To view this discussion on the web visit >>>>>>> https://groups.google.com/d/msgid/tiddlywiki/08094092-20d2-43fc-b8d6-422eb07937f2%40googlegroups.com. >>>>> >>>>> >>>>> -- >>>>> 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/d5e28304-3270-4f25-b057-5c1ea1ff8616%40googlegroups.com. >>> >>> >>> -- >>> 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/2f5de178-0705-4e6a-a535-93ca178e6aaf%40googlegroups.com. >> > > -- > 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/e3aeef7b-10d1-484a-a8b6-dd15f665e7b6%40googlegroups.com. -- 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/F205B955-AE02-4E87-81F7-41AA719D0A29%40gmail.com.

