[TW2] "external files" / "external tiddles" plugin needs development/upgrade/patching

158 views
Skip to first unread message

carlos duarte

unread,
Sep 18, 2013, 4:01:46 PM9/18/13
to tiddl...@googlegroups.com
i'm looking to get a tiddlywiki2 plugin developed/upgraded/patched.

i have tried getting the original developers to help me out. but, in once case the guy helped me out *a lot*, but eventually lost interest. in the other case i just couldn't reach him via email.

thanks in advance. before i lay my case, i'd like to ask you not to asume that my relative lack of javascript skills represents an ignorance of options. the advocacy of a *favorite* solution without adequate consideration to the way my circumstances shape my methods and workflow is very non-productive. said circumstances are way beyond the scope of this request, but i'll elaborate on them at length if you feel it will help you help me. i'm not too interested in this request becoming a starting point for inbred bikeshedding discourses.

**here's the scenario:

-i need to get some external files into tiddlywiki.
-the external files in question are source files, so i need them syntax highlighted.
-i need the external files to display both locally and when hosted on a website.
-
i'm uploading the website (tiddlywiki and external files) using lftp and it's rsync-like "mirror" option. i *do not* plan on using tiddlywiki itself to edit/upload/refresh/upkeep the external files. the original source files will be edited using emacs/vim/gedit, and then automatically copied with a cron job to the tiddlywiki directory, and then finally pushed through ftp each time i get a chance to refresh the website (i will be working in remote, no-connectivity locations for months on end).

**what works:

syntax highlighting is working excellently thanks to
mario pietsch's "SyntaxHighlighterPlugin3" http://syntaxhighlighter.tiddlyspace.com/#SyntaxHighlighterPlugin3

**what semi-works:

1.-e
ric shulman's "external tiddlers" plugin http://www.tiddlytools.com/#ExternalTiddlersPlugin
2.-mario pietsch's "load external files" plugin https://github.com/pmario/tw2.plugin-dev-template-node/tree/master/tests

eric shulman's "external tiddlers" plugin loads the external files on demand, so it doesn't work with mario pietsch's "SyntaxHighlighterPlugin3", which ignores highlight-able content that isn't loaded from the start.

mario pietsch's "load external files" plugin works well, because it loads the files as shadow tiddlers straight from the get-go.

**the problem:

as far as i understand, mario pietsch's "load external files" plugin uses the "local file api", or something to that effect. this prevents it from working when tiddlywiki (and the related external files) are hosted remotely in a web server.

**the probable solution(s):
a)make a hybrid plugin that loads external files as shadow tiddlers
----using local file api when tiddlywiki is "running" locally, and
----using erich shulman's method when tiddlywiki is being hosted/served
b)modify "SyntaxHighlighterPlugin3" to work with external files loaded "on demand" (such as with eric shulman's "external tiddlers" plugin)

again, much thanks in advance.

-carlos

Tobias Beer

unread,
Sep 19, 2013, 6:04:53 AM9/19/13
to tiddl...@googlegroups.com
Hi Carlos,

I think what's actually needed is not something new for TiddlyWiki but rather a batch / console script that gathers all your source files and outputs one big tiddler file with the required tags or fields which is subsequently loaded by any of the known methods (preferably SharedTiddlersPlugin [1]) on TiddlyWiki startup, local or remote alike for as long as that generated SourceCodeTiddlers.html is in the same relative directory.

Not sure if anyone working with tw2 can provide you with a codebase to start from when it comes to generating that includable html file.

Tobias. 

PMario

unread,
Nov 3, 2013, 6:31:28 AM11/3/13
to tiddl...@googlegroups.com
Hi Carlos,

I did an update for the loadExternalFiles plugin it is ajaxLoadExternalFiles.js [1] now. I did some tests with a "vanilla" apache server installation. So all files need to be sent to the client as plain/text files. The plugin converts them into tiddlers without any refactoring.

The client creates a single request for every file. So if you have many files, it may take some time to transfer them. Depending on your server response time and the internet connection. ...

The plugin no creates "real tiddlers" because shadow tiddlers have limited possibilities. ... eg: Real tiddlers can have tags.

There is also a new config file [2] that lets you adjust the host url setting and specify a server side file that contains a file list.

ExternalFilesConfig tiddler needs to be adjusted to your needs:

! Config
host: http://yourDomainName.com/dir/
list: ServerFileList
log: verbose

The tiddler contains a lot of additional info, but these 3 lines are the important one's.
host: the last slash  /  is important!

With the "list:ServerFileList"  setting, the ExternalFiles tiddler is not needed anymore. It will only be used, if there is no ServerFileList file on the server

With this configuration, it should be possible to
 - upload "anyFile.sh"
 - upload "ServerFileList"

 - reload the browser -> done

So index.html is only needed if you change it.

------------

The file structure cna look like this:

yourRootDir
 index.html
 ServerFileList
 anyFile.sh
 anyFile.txt
 ...
 +--shadow (dir)
   i-will-be-a-shadow-tiddler
   ...
 +--test (dir)
   i-will-be-tagged-test
   ...
   
ServerFileList should look like this

anyFile.sh
anyFile.txt
shadow/i-will-be-a-shadow-tiddler
test/i-will-be-tagged-test

Feedback very welcome!

have fun!
mario

[1] https://github.com/pmario/tw2.plugin-dev-template-node/tree/master/tests
[2] https://github.com/pmario/tw2.plugin-dev-template-node/blob/master/tests/content/ExternalFilesConfig.tid

PMario

unread,
Nov 3, 2013, 6:35:58 AM11/3/13
to tiddl...@googlegroups.com
uups,
I forgot: you have to disable loadExternalFile.js if you use the ajax version. The new version handles both: online - offline file handling.
-m

carlos duarte

unread,
Nov 15, 2013, 4:47:57 PM11/15/13
to tiddl...@googlegroups.com
wow, mario.

sorry i haven't replied sooner. i have been going through a lot of
very heavy personal ordeals of all kinds. i'll spare you the details.

anyway. i have just finished trying out the plugin, and i'm happy to
report that it works beautifully. fantastic. thanks!

i just wish the "none" log level worked, as i'm not too keen on seeing
those lines of text in the corner popup, now that i know that it
works.

thanks a million. i'll buy you another beer/coffee as soon as i'm able to.

saludos & abrazos from méxico

-carlos
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "TiddlyWiki" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/tiddlywiki/QknrXN4FqB0/unsubscribe.
> To unsubscribe from this group and all its topics, 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/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages