Skip to content
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

tiddlywikicore-5.3.2.js contains wrong tiddlers #324

Closed
buggyj opened this issue Dec 20, 2023 · 17 comments
Closed

tiddlywikicore-5.3.2.js contains wrong tiddlers #324

buggyj opened this issue Dec 20, 2023 · 17 comments

Comments

@buggyj
Copy link

buggyj commented Dec 20, 2023

I create a new external core wiki on tiddlyhost and dragged $:/core/ui/SideBar/Open from tiddlywiki.com on to https://testincludecore.tiddlyhost.com/ - imported it then compared - they are different -

@simonbaird
Copy link
Collaborator

simonbaird commented Dec 20, 2023

My first thought is that might related to the use of the uglify plugin on the external core js file used by Tiddlyhost, but there are some substantial looking changes in that diff, so I'm not sure.

Will take a closer look soon.

@flibbles @pmario any suggestions?

@simonbaird
Copy link
Collaborator

simonbaird commented Dec 20, 2023

I'm building the external core edition like this:

git checkout v5.3.2                                                                                             

node tiddlywiki.js editions/empty \                                          
    --output ./output/external-core \                             
    --rendertiddler '$:/core/save/offline-external-js' 'empty.html' 'text/plain'

node tiddlywiki.js  editions/empty \                                         
    --output ./output/external-core \                                                                                                            
    --render '$:/core/templates/tiddlywiki5.js' '[[tiddlywikicore-]addsuffix<version>addsuffix[.min.js]]' 'text/plain'

Or with uglify on the js file:

  export TIDDLYWIKI_PLUGIN_PATH=../tw5-uglify                                             
  node tiddlywiki.js +plugins/plugins/uglify editions/empty \                                  
    --output ./output/external-core \                                             
    --render '$:/core/templates/tiddlywiki5.js' '[[tiddlywikicore-]addsuffix<version>addsuffix[.min.js]]' 'text/plain'

@simonbaird
Copy link
Collaborator

Re the uglify theory, I got the same result with or without the uglify plugin, so I don't think that is the cause.

Perhaps the \whitespace trim causes some whitespace to be stripped out when the render happens...?

@pmario
Copy link

pmario commented Dec 20, 2023

IMO they are not wrong. They are uglified. It looks OK to me.

@flibbles
Copy link

Bear in mind that there is a slight known issue using Uglify with 5.3.2. It should be resolved after the TiddlyWiki core PR TiddlyWiki/TiddlyWiki5#7895 is merged.

@flibbles
Copy link

To elaborate here, there were changes to the way whitespace after pragma is handled by the wikiparser. It's now preserved except in cases when \whitespace trim is present. So when Uglify removes whitespace trim and manually removes the whitespace instead, there's now a newline introduced preceding the body. This is causing some very subtle problems, and looking at the diff above, that tiddler would get that introduced newline.

@buggyj
Copy link
Author

buggyj commented Dec 21, 2023

when I do the build I do not see this error:

git clone https://github.com/Jermolene/TiddlyWiki5 .
git checkout v5.3.2
node tiddlywiki.js editions/empty --output ./output/external-core --rendertiddler '$:/core/save/offline-external-js' 'empty.html' 'text/plain'
node tiddlywiki.js editions/empty --output ./output/external-core --render '$:/core/templates/tiddlywiki5.js' '[[tiddlywikicore-]addsuffixaddsuffix[.min.js]]' 'text/plain'

I had to rename 'tiddlywikicore-5.3.2.min.js' to 'tiddlywikicore-5.3.2.js'

@pmario
Copy link

pmario commented Dec 21, 2023

Just to be sure you've seen this one: TiddlyWiki/TiddlyWiki5#7904

@simonbaird
Copy link
Collaborator

I got the same result with or without the uglify plugin

I think I was mistaken. Now it looks like the problem goes away if the uglify plugin is not used, as @buggyj found.

@flibbles
Copy link

The problem will go away with v5.3.3, but I'll also be pushing a new Uglify version soon which will make an exception for v5.3.2 anyway.

@simonbaird
Copy link
Collaborator

In case anyone is wondering what the plan is: I'm going to assume this is not causing any major problems on Tiddlyhost currently, and just wait for the upcoming fixes to land.

If you are seeing any problem with the external core TW 5.3.2 on Tiddlyhost let me know - I could build and push a non-uglified core js if needed.

@flibbles
Copy link

I've released Uglify v1.8.0 which has full support for Tiddlywiki 5.3.2, including support for the anomalous behavior that Tiddlywiki introduced.

I recommend migrating to Tiddlywiki 5.3.3 as soon as it releases because the workaround for the core bug means Uglify has to forgo some compression it'd ordinarily want to do.

@simonbaird
Copy link
Collaborator

Thanks - Pushing a release to Tiddlyhost now.

@simonbaird
Copy link
Collaborator

Ps, it is perhaps surprising for Tiddlyhost users to notice that tiddler content is different when using an external core TiddlyWiki on Tiddlyhost (due to the uglify). Is there an option for uglify so it compresses the javascript but leaves the content of the shadow tiddlers uncompressed?

@buggyj
Copy link
Author

buggyj commented Dec 23, 2023

seems to be fixed in v5.3.3

@buggyj buggyj closed this as completed Dec 23, 2023
@flibbles
Copy link

Is there an option for uglify so it compresses the javascript but leaves the content of the shadow tiddlers uncompressed?

Yes. The documentation on how to do that through a NodeJS compile is here. It's the last one described.

If you're using the wizard (which I don't think you are), it's just a matter of unchecking the text/vnd.tiddlywiki box.

@flibbles
Copy link

But actually, now that I think about it, you probably just want to use the "--uglify", "text/vnd.tiddlywiki", "no" build options.

simonbaird added a commit that referenced this issue Dec 24, 2023
I want to do some debugging on #324 and this will be useful.
simonbaird added a commit that referenced this issue Dec 24, 2023
There are some fixes related to whitespace IIUC. It was suggested
that this would fix #324, but actually I'm not sure if that is
accurate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants