-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make domtext work with static pages #1
Comments
Hi @tobibeer as we've discussed it elsewhere, I guess you know that the macro doesn't comply with the rules for a macro because its output isn't purely a function of its parameters. Anyhow, macros shouldn't reference the global It's not a foolproof check for static site generation, but you can check whether the document is TW's fakedom implementation, which would normally be sufficient:
|
Thanks, @Jermolene, I imagined it involved fakedom, although I expected it would ship with its own getElementById() and then saw that it doesn't.
Assuming that states and temporary tiddlers keep representation in sync with the store, it is very much so, at least for the very purpose for which it was created: to read (and only read) the inner contents of the calc widget, being some calculated output. Should the widget output change, then precisely due to a change of tiddlers in the store that affect the computation, hence the very need to also update this macro's output... which works when used as an element attribute, but not standalone, which is ok.
Thanks, I have modified the code accordingly, and added basic getElementById() support to fakedom. @Jermolene: Shall I make a PR with respect to getElementById() for fakedom? |
No, it is not. The output of the macro depends on the DOM which, in the examples you are talking about, depends on the tiddler store. So, the output of the macro is dependent upon the state of the tiddler store (as well as it's parameters). That means that it conflicts with the refresh mechanism.
The way that you've copied the code makes it very hard to use GitHub to see what changes have been made to the underlying core file. I wouldn't be keen to accept |
This statement appears true for every single macro. (How) Is it not?
I know, hence my question for a PR. I'll make one just to show the diff.
That I'll leave for you to decide. I would not know what could be dangerous about indexing ids.
You mean by overwriting it the way I do or via some other means of "extending" it? (Would you have a few lines of (pseudo-)code on how to do that?) |
I made a PR to show the diff for a basic getElementById() support in fakedom: |
@Jermolene, I am trying to build a static documentation for this little plugin that ships with a js macro.
(Where / How ) Can I adjust the domtext macro so that — upon static site generation — it knows how to handle
document.getElementById()
? Can this be done at all?Are there some general instructions on how to make macros / widgets "static site proof"?
The text was updated successfully, but these errors were encountered: