Exporting to HTML, Pushing through Javascript / JQuery

I've had success exporting small snippets of javascript through MP3tag to this point, and I'm hoping to push quite a bit more through. I don't need Mp3tag to process any of it, just send it through as plain text. It is a large block of text that does include lots of special characters ... most of them, if not all of them, in any case.

$()[]{}/;:.,!?*&^><+_=|" are the ones I see jumping out at me.

In my prior experience, the only things needing to be changed in my HTML were converting single "%" to "%%" and single " ' " to " '' " (apostrophes). Everything else seemed to push though fine.

I'm kinda fuzzy on how Apostrophes around your plain text are supposed to make it go through un-parsed. Is that only on a single character basis or is it on a line by line basis? Does it stop at the next apostrophe? If so, and you make apostrophes that are part of the string you want pushed through into double apostrophes, will they be output as one and will the plain text keep flowing?

I'm trying to avoid putting a link to an external .js file in my export HTML, as a self-contained solution just seems cleaner to me.

Hope I made some sense,

Best Regards.

[]$%' are the characters that must be escaped (see help file)

It can be convenient to enclose the whole text in ' chars. But if you use '...' it only lasts until the the next '

Example:

a'b written completely escaped:
'a''''b'

read
'a' + '' + 'b'

Thanks for the reply!

In my experience $ and % don't need to be escaped when I export to HTML. In fact, escaping them causes errors in the web page. $ contained in javascript go through untouched (yeah, I don't know why) and % just disappears unless I change it to %% (at least in the CSS style tags).

I did have to change ' to '' (double apostrophe) in the body, while " (quote) goes through just fine.

I've attached an example of my latest export .mte, which works perfectly fine (referencing JQuery externally on the web). I'd like to include JQueary (also attached), or the necessary parts of it, in the exported file so the new scripts will function without an internet connection or the need to download the .js file locally.

I didn't know if anyone had ever tried to put the whole JQuery Javascript through the exporter before (I couldn't find any mentions of "JQueary" via the forum search), but it seems to me if it could be done it could allow for all sorts of neat possibilities. Eventually, I'd like to figure out a way to do what I'm trying to do without JQueary, but I'm not there yet.

In the meantime, I will continue trying to escape the characters as you suggested via notepad ++. I might have messed up and forgotten to escape the ' before the [] and wound up with way too many ' ... lol.

Thanks again...

Lyrics_to_One_Big_Formatted_HTML_File__v.8beta__Light.zip (17.5 KB)

Hi 'Flskydiver', first of all I have to say:
I do respect your personal effort in learning and writing export scripts for the Mp3tag community.

I've tried to understand your last code work from the 'Lyrics_to_One_Big_Formatted_HTML_File__v.8beta__Light.zip'.
The script seems to be a conglomeration of professional and beginner ideas and code work.

It is not easy work to combine Mp3tag Scripting Language with HTML and CSS and Javascript language into one useful product.
The script offers many occasions to make the code 'cleaner and better and more elegant'.

I've read about your problems how to escape special characters in the different languages in the right way.

You have to take into account, when writing a Mp3tag export script, that the Mp3tag Scripting Language is the master language, which is used to invoke Mp3tag Scripting functions and to create text data output of tag-field content and additionally other free text, which for example can be designed like a HTML script, which further on carries embedded CSS and Javascript code.

It has turned out to be convenient (see many other forum posts), to 'literalize' all those text output, which is not a Mp3tag Scripting Function or a Mp3tag tag-field placeholder.
'Literalizing' means to enclose all output text with the Mp3tag string delimiter (single apostroph).
Only leave tag-field placeholders and Mp3tag functions 'visible'.

When writing HTML code using the Mp3tag Scripting Language, then take into account, that HTML has its own rules to be respected. There is also the need to escape some special characters.

When writing embedded CSS code using the Mp3tag Scripting Language, then take into account, that CSS embedded into HTML has its own rules to be respected.

When writing embedded Javasricpt code using the Mp3tag Scripting Language, then take into account, that Javasript embedded into HTML has its own rules to be respected.

Because you are using the Notepad++ editor, I recommend to use the Mp3tag syntax highlighting feature:
http://notepad-plus.sourceforge.net/commun..._Mp3tag_mte.zip

This morning I have revised your last code work.
You have delivered the 'jquery.min.js' library along with your code.
Note, there might be a license requirement, which do not allow to split the JS library into smaller parts!
There is no need to load the JS library from the Internet everytime.
You can copy the JS file into your local Mp3tag APPDATA folder and reference it from there.
I've added some $replace functions for HTML escaping.
I've tried not to change your code too much, to give you the chance to comprehend the proposals.

See attached zip file.
Lyrics_to_One_Big_Formatted_HTML_File__v.8beta__Light.revised.zip (19.6 KB)

DD.20110522.1335.CEST

Lyrics_to_One_Big_Formatted_HTML_File__v.8beta__Light.revised.zip (19.6 KB)

Lol! Well, I am totally a beginner so I'll take that as a compliment. I've been scouring the internet for a way to implement my ideas, and this is the result of what I've learned so far. I am curious, though ... regarding the conglomeration of professional and beginner ideas ... which parts are which? :slight_smile:

...
Please let me thank you for your time, and in advance, for your reading and possibly responding to this one too. Thank you.

The attachment you provided is awesome. I actually wrote all my .mte's in plain old windows notepad but when I learned about JQuery I realized I was going to need something that could do some heavier lifting.

The Mp3tag specific highlighting settings for Notepad ++ are awesome! Very, very clever. I didn't even know I could do that. Thanks!

Should make what I want to do VERY easy now that I can see what is escaped and what isn't so plainly (not to mention all the other highlighting features). Genius!

I can't get the environmental variables to come through, for some reason, so I had to change them to absolute links. This is a problem I previously encountered on my own. Since it isn't exactly relevant to this, I replied on this issue to a post you wrote in a thread about $getEnv and the test.mte you created to display them.

Otherwise your version seems to work fine as mine did, and I will take what I've learned about escaping things to simplify the code for the exporter.

...
I noticed you changed the names of my counter strings. Was that because mp3tag could be confused if my string had the same name as a tag, or what that just for the benefit of users viewing the code?

...
I also noticed you changed my links to the audio files from:

file:///%_folderpath%%_filename_ext%

which outputs my example file

M:\Music\Mp3 Files\MP3's 01 1-B\Bob Marley (& the Wailers) - Buffalo Soldier.mp3

as

file:///M:%5CMusic%5CMp3%20Files%5CMP3%27s%2001%201-B%5CBob%20Marley%20%28&%20the%20Wailers%29%20-%20Buffalo%20Soldier.mp3

to

file:///'$replace(%_path%,'','/','&','&','"','"','<','<','>','>')'

which outputs my example file as

file:///M:/Music/Mp3%20Files/MP3%27s%2001%201-B/Bob%20Marley%20%28&%20the%20Wailers%29%20-%20Buffalo%20Soldier.mp3

Both versions work in my browsers; is there a problem with Mp3tag using %5 instead of a slash? And is it even possible to have < and > in file names or folder paths?

Ahh!

On closer inspection, I realize you added $Replace functions whenever I used mp3tag variables to generate html. Are there still browsers that get tripped up by ampersands and quotes?

As for inserting

and

and replacing single space characters in my HTML with non-braking space tags, I assume you did this, too, for improving the backwards compatibility of my output HTML, so thanks. If there is more to it than that ... well, still thanks, but please elaborate if you will.

Finally. thanks again for your time and skills.

The clever little script you included for copying the JQuery .js to an Mp3tag users AppData folder is excellent and will sure to be included in any future version of my .mte and I feel it is quite likely I will make much use out of it elsewhere in the future.

Did I say thanks?

In case anyone ever is interested, I've attached a properly escaped copy of jQuery that you can run through Mp3Tag's export scripts and imbed inside an exported HTML as I did here:

/t/12115/1

Note: This won't work if you DON'T run it through Mp3Tag first.

jquery.min.FOR_INSERTION.mte (89.4 KB)