Giter VIP home page Giter VIP logo

tw5-uglify's People

Contributors

flibbles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tw5-uglify's Issues

Problems creating uglified tiddlywikicore.js file with TiddlyWiki version 5.3.0

Summary

Producing an uglified version of tiddlywikicore.js is buggy for the newly released TiddlyWiki 5.3.0.

Details

Here's how I'm creating an external core empty and uglified tiddlywikicore.js. The commands are run in the TiddlyWiki5 git repo with tw5-uglify checked out in an adjacent directory:

export TIDDLYWIKI_PLUGIN_PATH=../tw5-uglify

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

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

ls -l output/external-core

If you open the generated empty.html file you can see the problem. There is <<>> showing up in many places instead of the expected content.

Looking at the core js file, there is text like Update <<>> plugins inside the $:/core plugin, instead of Update <<update-count>> plugins which I think is causing the problem. If you search for <<>> you can find many other examples. I guess somehow the uglify code is stripping out the text incorrectly.

Producing a non-uglified core js file like this is useful to compare the uglified and non-uglified output:

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

uglify breaks Editor toolbar button in 5.3.0

I uglified my Wiki and the Editor toolbar broke.

Error uglify

I can reproduce this with 5.3.0 empty.html on Firefox 115.0.1 and Chrome 114.0.5735.199 on Windows 11 Home 22H2. Just uglify any of my TiddlyWiki files or an empty.html and open a Tiddler.

Uglify brakes the transclude editortoolbarbutton

I used uglify 1.7.0 on an empty.html. In the uglified.html pressing the transclude editortoolbarbutton gives a red screen with internal JavaScript Error:

Internal JavaScript Error
Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser
TypeError: t.paramObject.suffix is undefined

Typing the brackets and transcluding works. Only the button seams to be broken. This happens in all my uglified Wikis.

Importing $:/core/ui/EditorToolbar/transcludify from empty.html to an uglified wiki fixes the button

Undesired Removal of Double Square Brackets

Uglify convert the below macro

\define toc-list(here,exclude)
<$list filter="""[tag[$here$]] $exclude$ -[[$here$]]""">
   <$text text="[["/><<currentTiddler>><$text text="]]"/>
   <$macrocall $name="toc-list" here=<<currentTiddler>> exclude="""$exclude$ -[[$here$]]"""/>
</$list>
\end

To this one

\define toc-list(here exclude)
<$list filter="""[tag[$here$]]$exclude$ -$here$""">
   <$text text=[[/><<currentTiddler>><$text text=]]/>
   <$macrocall here={{!!title}}exclude="""$exclude$ -[[$here$]]"""$name=toc-list/>

\end

The uglified version does not work. Look at the filter of first line:

  • original <$list filter="""[tag[$here$]] $exclude$ -[[$here$]]""">
  • uglified <$list filter="""[tag[$here$]]$exclude$ -$here$""">

When $here$ is a title with space the uglified macro fails.

I use this in a TOC macro developed by @ericshulman. Of course, this is an old syntax and text substitution is not recommended anymore. From TW 5.2.x I can use format:titlelist[], so I resolved the issue.

This is just to inform you about the way uglifier works with such macro arguments.

Compressing TW-Vote returns an error

Compressing TW-Vote using Uglify returns an error on one of tiddler.

This is the tiddler Uglify complains

/*\
keyvals.js
type: application/javascript
module-type: filteroperator

Filter operator for returning the key_°_values of a data tiddler
Note the _°_ is a separator used here for sorting purpose

\*/
(function(){
"use strict";

/*
Export our filter function
*/
exports.keyvals = function(source,operator,options) {
	var results = [];
	var sep="_°_";

	source(function(tiddler,title) {
		var data = options.wiki.getTiddlerDataCached(title);
		if(data) {
			for (var [key, value] of Object.entries(data)) {
				results.push(key+sep+value);
			}
		}

	});

	return results;
};

})();

Uglify complains, it cannot compress the keyval.js for line for (var [key, value] of Object.entries(data)) { as below

image

Would you please have a look and let me what is the issue?

Unglify 1.5.2 Breaks TW 5.2.3

  1. I download the latest empty.html from https://tiddlywiki.com/
  2. I installed the below plugins
    image
  3. I installed Uglify 1.5.2
  4. Save and reload
  5. Delete Uglify
  6. Save and Relaod
  7. Add a new Tiddler and encounter this error:
    image

The same procedure works with Uglify 1.5.1

Extra P Tag in Drop Down Menu of Editor in TW 5.2.6

I used uglify to compress the empty Tiddlywiki 5.2.6. everything works fine. But I noticed the drop-down menu for selecting type of preview has an extra p tag.

After uglifying
img_234_msedge

Using inspect in Chrome shows:

<p>✓</p>

Removing Quotes Case Different Results for Some Macros

I use uglify 1.5.1 for compressing my TW, recently I noticed I get different results in a code uses now macro. See

<$let note-time=<<now 0hh:0mm>>
note-time2=<<now "0hh:0mm">>
>

* <<note-time>>
* <<note-time2>>

</$let>

This results in:

  • 08:29, 25th September 2022
  • 08:29

The original code is <<now "0hh:0mm">> after uglifying it is <<now 0hh:0mm>> note to disappeared "

Uglify modifies $:/boot/boot.css diregarding setting

  1. I modified $:/boot/boot.css to change the password entry dialogue.
  2. Go to https://flibbles.github.io/tw5-uglify/uglified.html
  3. Drag the TiddlyWiki in the browser / the wizard
  4. Click Confirm
  5. Click Customize
  6. uncheck text/css
  7. $:/boot/boot.css disappearse from the list of compressed Tidlers.
  8. Click Compress TiddlyWiki file

The uglified.html has a changed $:/boot/boot.css and the password entry dialogue looks "normal". After a re-import it works, but it is unexpected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.