Hi Tony,

On Sunday, June 28, 2020 at 9:20:13 PM UTC-7, TW Tones wrote:
>
> I have being trying to replicate your buttons to take snapshots of other 
> tiddlers as html, wikitext to clipboard and tiddler. I am however 
> foundering.
>
> If you ever feel so inclined I would love toolbar icons to do this for any 
> tiddler, this is a most impressive feature and it could be used in many 
> places including streams. No pressure, and yes I am saying it again, in 
> different words.
>
>
Below is a modified
   $:/core/macros/export 
tiddler. Now when you click on the "export tiddler" option, you get two 
more choices. One copies the rendered tiddler to HTML, and the other copies 
to plain text.

I don't think copying the all-up wikitext would be easy. There are no tools 
for collecting the *rendered output* of a tiddler as wikitext. You can get 
the parsetree(s), but then you'd have to turn them back into wikitext, 
which is likely to be non-trivial. You could capture the exact wikitext for 
the single tiddler, but that wouldn't be very useful.

If you hurry, the modifications here may be at 
https://marxsal.github.io/various/notowritey.html. While playing with the 
text, I accidentally posted it there. But I don't intend to have a change 
to the core as part of the NotoWritey distribution, so the next update will 
erase the changes. 

HTH!

\define compile-h2()
<$transclude mode=block/>
\end
\define compile-w2()
<$view field="text"/>
\end
\define exportButtonFilename(baseFilename)
$baseFilename$$(extension)$
\end

\define exportButton(exportFilter:"[!is[system]sort[title]]",lingoBase,
baseFilename:"tiddlers")
<span class="tc-popup-keep"><$button popup=<<qualify "$:/state/popup/export"
>> tooltip={{$lingoBase$Hint}} aria-label={{$lingoBase$Caption}} class=<<tv-
config-toolbar-class>> selectedClass="tc-selected">
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
{{$:/core/images/export-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>match[yes]]">
<span class="tc-btn-text"><$text text={{$lingoBase$Caption}}/></span>
</$list>
</$button></span><$reveal state=<<qualify "$:/state/popup/export">> type=
"popup" position="below" animate="yes">
<div class="tc-drop-down">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Exporter]]">
<$set name="extension" value={{!!extension}}>
<$button class="tc-btn-invisible">
<$action-sendmessage $message="tm-download-file" $param=<<currentTiddler>> 
exportFilter="""$exportFilter$""" filename=<<exportButtonFilename 
"""$baseFilename$""">>/>
<$action-deletetiddler $tiddler=<<qualify "$:/state/popup/export">>/>
<$transclude field="description"/>
</$button>
</$set>
</$list>
<hr/>
<$wikify text="""<<compile-h2>>""" name="compiled" output="html">
<$button class="tc-btn-invisible" message="tm-copy-to-clipboard" 
param=<<compiled>> >
HTML -> clip
</$button>
</$wikify>
<$wikify text={{!!text}} name="compiled">
<$vars regexp="\n{2,}"  regexp2="\s{1,}\n" lf="""
"""
lf2="""

"""
>
<$vars 
compressed={{{[<compiled>splitregexp<regexp2>join<lf>splitregexp<regexp>join<lf>splitregexp[\n]join<lf2>]}}}
 
>
<$button class="tc-btn-invisible" message="tm-copy-to-clipboard" 
param=<<compressed>> >
Text -> clipboard
</$button>
</$vars>
</$vars>
</$wikify>
</div>
</$reveal>
\end



-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f1256624-ee99-4b44-918a-1c0eb6de2e3co%40googlegroups.com.

Reply via email to