TW5 Permalink to plain webpage

155 views
Skip to first unread message

Patrick Detzner

unread,
Feb 24, 2015, 9:03:06 AM2/24/15
to tiddl...@googlegroups.com
So what I would like to be able to do is have a link or a button that opens a tiddler in its own tab. But instead of being displayed like a tiddler, the text field would just be displayed on a plain white background with no tiddler borders, buttons, etc.

This would be sort of like a "print" function, where the body of a tiddler could be displayed in a way that could be printed directly without the tw ui. Currently, I am copying and pasting into a word document and it would be awesome if I could skip this step.

Thanks,
Patrick

Jeremy Ruston

unread,
Feb 24, 2015, 11:00:21 AM2/24/15
to TiddlyWiki
Hi Patrick

The easiest way to print an individual tiddler in plain text, without any TW user interface elements, is to use the built-in browser print function. The use of "print stylesheets" makes it possible to precisely control which elements are printed. The default TW theme includes a print stylesheet that hides the sidebar and toolbar buttons (see the illustration attached). Does that match your needs?

We could add support for opening individual tiddlers as static text in a separate tab, but I'd like to understand the use cases beyond printing,

Best wishes

Jeremy




--
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 tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com
Screenshot 2015-02-24 16.57.44.png

Andreas Hahn

unread,
Feb 24, 2015, 11:58:22 AM2/24/15
to tiddl...@googlegroups.com
Hi,

wow.. I totally misunderstood the question. I thought he wanted to open
a rendered version of a tiddler in another tab. Well I will just share
my solution here.
Note that you can also open the source wikitext of a tiddler in a new
tab with the <<makedatauri>> macro. Copy this into a tiddler to see how
it works, note that
you will need to import the macro I attached first in order to make the
rendered preview work.

\define makeURI()
data:text/html;base64,$(renderResult)$
\end

\define embedPreview(tiddler)
<$set name="renderResult" value=<<getwikified "$tiddler$">> >
<a target="blank" href=<<makeURI>> >Preview</a>
</$set>
\end

\define download-inner()
<a target="blank" href=<<makedatauri "$(text)$" "text/plain">> >Source</a>
\end

Get a rendered preview of a tiddler in a new tab:
<<embedPreview "$:/Acknowledgements">>


Get the source code of a tiddler in a new tab:
<$set name="text" value={{$:/Acknowledgements!!text}}>
<<download-inner>>
</$set>

Since I am actually interested in the rendered preview myself, is it
possible to do it in an easier ? I couldn't seem to figure out if the
wikitext possibilites are enough already, so I made the macro.

/Andreas
getwikified.js

Jeremy Ruston

unread,
Feb 24, 2015, 12:04:08 PM2/24/15
to TiddlyWiki
Hi Andreas

You'll have probably spotted that getwikified.js is frustratingly close to the existing <$view format="wikified"/>; of course, the latter can't be used to specify an attribute as you need to do here.

I've been wondering about another approach: adding a new "tm-open-file" message that would function just like "tm-download-file" except that it would open the file in a new tab (using document.write, perhaps?), rather than downloading it.

Best wishes

Jeremy.


--
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+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Patrick Detzner

unread,
Feb 24, 2015, 3:59:39 PM2/24/15
to tiddl...@googlegroups.com
Hi Jeremy,

Thanks for your response. I will have to play around with print stylesheets.

I think that your solution could meet my needs but I'm not 100%. My use case is that I built a program to help enter and store lesson plan information and then facilitate/automate some of the tedious work involved in creating the actual lesson plan document. I think it's still up on pespot.tiddlyspot.com if you need a better description.

The program involves a lot of editor tiddlers and an important tool on the sidebar. It would be ideal if I did not have to close all the editors, if I could print a single tiddler out of the story. That's why I originally thought of a separate tab. I imagine that could be accomplished through tags and stylesheets though.

Thanks,
Patrick

Patrick Detzner

unread,
Feb 25, 2015, 12:22:37 AM2/25/15
to tiddl...@googlegroups.com
So I looked into the Vanilla theme and found the @media print lines that hide certain segments of the TW interface. This is almost perfect for my usecase, but would it be possible to selectively show content rather than selectively hide it?

In my usecase, I would really only have 1 print-ready tiddler open at a time. I do not want to print the title of the tiddler. I might have 3-5 other tiddlers open that I was working on that I would also want to exclude. Furthermore, the print tiddler itself has some tabs in the body that I use for navigating between different lesson plans within a unit. I don't want these to print either, just the text of the lesson plan itself.

Here's what I tried. I went into the $:/core/ui/ViewTemplate and wrapped it in a <div class="exclude-from-print">

\define frame-classes()
tc-tiddler-frame tc-tiddler-view-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$ $(tiddlerTagClasses)$
\end
<div class="exclude-from-print">
<$set name="storyTiddler" value=<<currentTiddler>>><$set name="tiddlerInfoState" value=<<qualify "$:/state/popup/tiddler-info">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
</div>
</$tiddler></$set></$set>
</div>

Then I went into the vanilla-base stylesheet and added .exclude-from-print to the @media print section that hides the sidebar and the topbar. Boom, now when I went hit print in Firefox, the page was blank.

Then I added the following lines right below that:
.print-document {display: block   !important;}

I wrapped up my desired print content in a <div class="print-document">, however this failed to override the exclude-from-print class and when I go to print, I still see a blank page. Any suggestions?

Thanks,
Patrick

Tobias Beer

unread,
Mar 2, 2015, 7:13:07 AM3/2/15
to tiddl...@googlegroups.com
In my usecase, I would really only have 1 print-ready tiddler open at a time. I do not want to print the title of the tiddler. I might have 3-5 other tiddlers open that I was working on that I would also want to exclude.

The easiest would be to open that specific tiddler in a new tab (view its permalink) and print it.

Best wishes, Tobias.

Patrick Detzner

unread,
Mar 3, 2015, 10:16:41 PM3/3/15
to tiddl...@googlegroups.com
I was able to put the exclude-from-print div class in the Story tiddler, wrapping it around all the normal tiddlers. I have a separate tiddler for the stuff I want to print, it is added to the story list separately and is not wrapped by that class.

I added a print button with a <$print/> widget, very bare bones with a window.print(); in the invoke action part of it, so if I hit the button, the brower's print dialog automatically comes up with just the content I want. From there I can print a paper copy or make a PDF of my content.

It was definitely more work than your solution, Tobias, but I have since grown rather attached to my Print button.
Reply all
Reply to author
Forward
0 new messages