> Note that, because attachment tiddlers use ***TW-native section
> syntax***, you can easily edit it as needed by employing the standard
> TW editor, without needing any custom fields at all. It also makes it
> easy to embed the content of individual sections into other tiddlers
> by using TW standard <<tiddler TiddlerName##sectionname>> syntax.
While this is good for TiddlyWiki, especially those which are file:///
based, it is less good for server-side storage systems that store
individual tiddlers (rather than whole wikis). TiddlyWeb being the
example that I know about.
In TiddlyWeb a tiddler is stored a combination of headers (attributes
and fields) and a body. That body is usually wikitext, but if the
'type' attribute is set, you can put pretty much anything in the body.
How it is stored depends on the storage system, the default text store
encodes MIME types that start with something other that 'text/' in
base64 encoded form.
When such a tiddler is retrieved from the server it is packaged up
according to its mime-type and the mime-type of the Accept header
provided in the HTTP request. If you ask for JSON you get a JSON
dictionary with the text attribute as the base64 encoded binary
content. This can then be injected into a TiddlyWiki as required.
What I would prefer to see for binary tiddlers is:
* tiddler.text is either a data uri containing encoded binary stuff or
remote URI which has the stuff
* tiddler.fields[something] contains metadata about the binary stuff
including amongst other thing an indicator that this is a binary tiddler
* Core or CoreTweaked support for binary tiddler awareness in
TiddlyWiki, such that refresh or edit of a binary tiddler enters a
binary tiddler code path.
-=-=-
The above is not necessary, though, if a structured binary tiddler
with sections is preferred. For TiddlyWeb, if the format is specced
out, we could include support for it in the tiddlywiki serializaiton
in TiddlyWebWiki.
--
Chris Dent http://burningchrome.com/~cdent/
[...]
>> While this is good for TiddlyWiki, especially those which are file:///
>> based, it is less good for server-side storage systems that store
>> individual tiddlers (rather than whole wikis).
>
> I don't agree. The design that I have *already implemented* and which
> is *widely used* in the community does NOT rely on any file-level
> granularity. Just as with any other tiddler, each attachment tiddler
> can be independently stored (e.g., TiddlyWeb), or stored as part of a
> complete file-save action (e.g., TiddlySpot).
What I meant was not an attachment system that relies on file-level
granularity, but rather that using your style of storing "binary"
tiddlers is fundamentally better for TiddlyWiki's which store to
local disk (i.e are using in the browser at file:/// URIs) but
fundamentally complexifying for server-sides which store (and
provide in multiple serializations) tiddlers as single units.
There's more to respond to in the rest of the thread, but I'm hoping
other's will get involved before I say more. I just wanted to clear
up the above.
I understand where you're coming from, and coming from a TiddlyWiki
background myself I can relate to and agree with much you've said.
However, the problem I see here is being tied to the TiddlyWiki
universe. Your approach - leveraging sections and slices - requires
parsing of the tiddler body, and thus a certain awareness of its
structure. This is problematic for a generic system like TiddlyWeb,
which is designed to be content-agnostic.
I'll have to do more pondering on how we might reconcile these
requirements before making up my mind...
-- F.
In the hope of helping the requirements discussion, I've started to
put together a small space demonstrating using SVG, and other "binary"
tiddlers using a simple image "chili":
It very possibly contains errors, and misunderstandings and I'm happy
to add others as members to help explore this "space".
--
Paul (psd)
http://blog.whatfettle.com
On Wed, 14 Jul 2010, rakugo wrote:
> In the case of an image, I would therefore expect the content of that
> tiddler to be the data representing that image.
> A data uri, as in the example contains the mime-type, so the type
> field seems a bit redundant as a result (as you can extract it from
> the data).
In the latest release of TiddlyWebWiki, the above is effectively what
we have done. The choice to do it that way basically comes down to one
thing: it's simple and predictable.
Tiddlers are packaged in the generated tiddlywiki file in one of three
ways:
* they are a "normal" tiddler, meaning they have no special
content-type and are packaged as you would expect: wikitext
inside the div.
* they are a pseudo-binary tiddler: The text inside the div is a
textual representation of some non wikitext format, such as
image/svg+xml. There is a server.content-type attribute which has
the relevant mime type of the content.
* they are a binary tiddler: The text inside the div is a base64
encoded representation of a non-textual thing, such as image/png.
There is a server.content-type attribute which has the relevant mime
type of the content.
server.content-type is being used for the time being until there is
some consensus on where the type information should go.
FND created a plugin called BinaryTiddlersPlugin which does the bare
minimum basics of properly rendering base64 stuff into either img or
anchor tags with data uris. Beyond the basics is the realm of
additional plugins.
You'll note some caveats with all this:
* _Any_ binary content is sent out with the TiddlyWiki. This means
that if for some reason there is a 1GB movie tiddler on the server,
and you ask for it in a TiddlyWiki, you'll get a giant tiddler in
your TiddlyWiki.
* For the time being data:uris are being used. Some browsers don't
support them. Some browsers limit the amount of data that can be in
them.
* Because of changes in TiddlyWeb with how "binary" and
"pseudo-binary" are distinguished on the server, some tiddlers may
be base64 when they should be text.
We'll let this stuff ride for a while and adjust as feedback happens.
I can predict one thing that might need to happen is that sending the
binary content may be a configuration option. If it is not set, then
do links as before.
BinaryTiddlersPlugin does not override any formatters, but rather hooks
into config.macros.view.views.wikified - plus it is only activated if
the respective tiddler has a "server.content-type" custom field.
So both plugins should be able to co-exist just fine - is this not
actually the case?
-- F.
I'm glad you're being vigilant!
> When I'm not quite as busy (when is that? :-), I'll definitely take a
> closer look at how you've implemented things... it sounds intriguing.
I just realized we haven't posted the URL yet, so here goes:
http://svn.tiddlywiki.org/Trunk/association/plugins/BinaryTiddlersPlugin.js
As Chris has said, it's tiny and intentionally basic.
-- F.