The sanity check is a python script and the gathering one can be written in python as well. Am I right that it has to collect contents from all .js files and join them (maybe adding comments to note where did a fragment come from)? Prepend :: StoryJS [script]? Anything else?
You could add comments, but since it would be taking everything from the JS files and would (hopefully) be run often, they shouldn't be needed.
:: StoryJS [script] and the like need to be removed completely from the .js files themselves.
If you are doing a touch of cleaning, in extendedFamilyModeJS, there are a pair of multi-line comments that break twine for no reason. If you could change them from using * to % it should fix the problem, but this is a low priority.
bash seems to be able to run shell commands just fine if sanityCheck is one.
The particular code block that allows that is lines 22-25 of compile_debug+sanityCheck.bat.
The sanity check is a python script
It is a bash script (which I prefer as a format) rather than python. embed_favicon.py seems to be the only python file in the repo.
If you neeed any help ezsh, just ask. I am thinking of attempting my own bash solution at some point, mainly as a thought exercise for now.
As I find bash scripting to be an enjoyable hobby, here is a quick prototype.Converter.sh. The core is working when cd'd into the src/js directory. The next few goal(s), in on particular order are to: expand it to target the other JS files, remove comments, consistently remove the initial white space (removing the new lines in files might be overkill) and hook it into a bat script.
Pregmodder does the file name absolutely have to be twine JS.txt? My impression is that it does not.
Opened !3385 (merged) for the task.
So far I renamed the files and added a simple script to join the JS code into a Twine passage. Don't know where should the script be hooked in.
#!/bin/sh#converts files in the current dir# collect files with [script] tagFILES=`grep'\[script\]'-H-R* | cut-f 1 -d':'`for f in$FILES;do# create a new name. Old names can have any of the following suffixes:# _JS.tw JS.tw .twnf="${f%_JS.tw}"nf="${nf%JS.tw}"nf="${nf%.tw}"# we might end up with an empty name, then set dir name as the file name[-z"$(basename$nf)"-o"${nf: -1}"="/"]&&nf="${nf}$(basename${nf})"# append the new suffixnf="${nf}.js"echo"renaming ${f} -> ${nf}"# rename the file git mv"${f}""${nf}"||echo"renaming ${f} failed"# strip Twee header from itsed-i 1d "${nf}"||echo"stripping Twee header failed for ${nf}"# strip leading empty line '/./,$!d'sed-i'/./,$!d'"${nf}"||echo"Stripping leading empty blank lines failed for ${nf}"done