Hi Evan

I worked up the technique I mentioned, and it may be suitable for you.

Working in Node.js, create a file called “patchcore.js" in a test wiki with the 
following content:

title: $:/PatchCore.js
type: application/javascript
library: yes

Demo of patching the core plugin


/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

var preCore = document.querySelector("div[title='$:/core'] > pre"),
        pluginText = preCore.textContent;

pluginText = pluginText.replace(/a non-linear personal web notebook/mg,"this is 
a patch");
preCore.textContent = pluginText;

window.$tw = window.$tw || {};
$tw.preloadTiddlers = $tw.preloadTiddlers || [];
$tw.preloadTiddlers.push({title: "HelloJeremy",text: "Hello there Jeremy"});


What I was suggesting would take a little bit more code: instead of writing the 
modified plugin text back to the DOM, you could instead neutralise the DOM 
element (by targetting the DIV and removing the title attribute) and insert the 
tiddler via $tw.preloadTiddlers.

Best wishes


> On 12 Feb 2018, at 19:08, Evan Balster <balster.e...@gmail.com> wrote:
> Addendum:  If startup modules aren't collectively preloaded before they are 
> run, boot modules may be unnecessary.  However, this would force a change in 
> the prioritization mechanism (using tiddler fields rather than export 
> variables).
> I think there might also be a meaningful difference in scope between 
> bootloader functionality (modifying the tiddler store) and startup 
> functionality (preparing functionality), but that's a loose opinion.
> On Monday, 12 February 2018 13:05:06 UTC-6, Evan Balster wrote:
> Hey, all —
> (I had a Twitter discussion 
> <https://twitter.com/EvanBalster/status/962823006128164864> with Jeremy 
> yesterday about this topic which quickly overflowed the boundaries of that 
> medium.)
> To facilitate development of my Mod-Loader plugin 
> <https://groups.google.com/forum/#!topic/tiddlywikidev/EoynoWzdXAs>, I'm 
> requesting a new module-type that runs during boot with maximal priority.  
> This module-type would be used for modules that need to add, remove or modify 
> items in the tiddler store which become "permanent" during the boot process 
> (IE, other JavaScript modules).
> While the modloader is my main concern, I've given some thought to other 
> use-cases for boot-time modification of the tiddler store.  The obvious one 
> is "loader extensions":  That is, any plugin that loads tiddlers from a 
> non-default source.  A boot module could load some content from a network or 
> file source at boot-time, from the client-side.
> Boot modules could work in a fashion similar to startup modules, running 
> first.  I suspect it might be preferable for boot modules to be loaded and 
> run one-by-one and prioritized by field values rather than JavaScript-defined 
> properties, though.  This would allow them to modify one another or inject 
> other boot modules into the sequence (potentially by adding or modifying 
> plugins).
> Jeremy suggested yesterday that high-priority code like this could be 
> installed as raw markup tiddlers, but I'm a bit skeptical of this approach.  
> I think it's important that modules like this have access to tiddler store 
> functionality, and remain portable across the many different formats 
> TiddlyWiki can be packaged into.  I also think it should remain possible to 
> package these boot modules into plugins.
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to tiddlywikidev+unsubscr...@googlegroups.com 
> <mailto:tiddlywikidev+unsubscr...@googlegroups.com>.
> To post to this group, send email to tiddlywikidev@googlegroups.com 
> <mailto:tiddlywikidev@googlegroups.com>.
> Visit this group at https://groups.google.com/group/tiddlywikidev 
> <https://groups.google.com/group/tiddlywikidev>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywikidev/2a76bfeb-b709-46a9-9797-ab4acb82c9a8%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywikidev/2a76bfeb-b709-46a9-9797-ab4acb82c9a8%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to