I just ran across a painful "gotcha."

I have a tiddlywiki with some external images, created by running a command 
like this -- https://tiddlywiki.com/static/ExternalImages.html

I added a few more images by dragging and dropping, and then decided I 
wanted to externalize them again.  So I ran the script again.  Copied the 
contents of output/images to my existing images/ directory, and thought I 
was good.

Unfortunately all of my existing externalized images just got destroyed  -- 
replaced by zero-length files.

When you run that image-externalizer command, it tries to make external 
copies *even of the images that are already external*.  Those tiddlers have 
no content, so files are created with the name of the image, and filled 
with that "nothing".  When I copied them back out of the output directory 
to the image directory, the empty files overwrote the regular ones.

Luckily I had backups!  But yikes.  Externalizing already-externalized 
images is bad news!

This seems to do the job right:

tiddlywiki --load $tiddlyfile --savetiddlers 
'[is[image]!has[_canonical_uri]]' images --setfield 
'[is[image]!has[_canonical_uri]]' _canonical_uri $:/core/templates/canonical
-uri-external-image text/plain --setfield '[is[image]!has[_canonical_uri]]' 
text "" text/plain --rendertiddler $:/core/save/all $tiddlyfile text/plain



-- 
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/85ad8ddb-f1b2-447f-b7cd-0a59be618b6e%40googlegroups.com.

Reply via email to