abc2svg
Check-in [a21bb157e1]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:util: abcweb: fix: accept <script with class="abc"
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1: a21bb157e13c7d299c20c0c9a8489fd5f33f6f01
User & Date: jef 2021-08-04 14:03:38
Context
2021-08-04
14:03
util: abcweb: fix: accept <script with class="abc" ... (Leaf check-in: a21bb157e1 user: jef tags: trunk)
2021-08-03
18:07
core: fix: bug in the last commit ... (check-in: f24de046bf user: jef tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to util/abcweb.js.

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
		k = page.indexOf("</mei>") + 6
		abc.mei2mus(page.slice(j, k))
		document.body.innerHTML = new_page
		return
	}

	// get the ABC insertion mode
	if (page.indexOf('<script type="text/vnd.abc"') >= 0)
		re = /<script type="text\/vnd.abc"/g
	else if (/<[^>]* class="[^"]*abc[^"]*/.test(page))
		re = /<[^>]* class="[^"]*abc[^"]*/g
	else
		re = /%abc-\d|X:\s*\d/g

	src = '%%beginml\n'
	for (;;) {

		// get the start of a ABC sequence
		res = re.exec(page)
		if (!res
		 || (res[0].indexOf('class=') > 0
		  && !/[" ]abc[" ]/.exec(res[0]))) {
			src += page.slice(i).replace(/\n%%/g,"\n%%%%") +
					"\n%%endml\n"
			break
		}
		j = re.lastIndex - res[0].length;

		// (the core removes '%%' at start of line)







|
|










|
<
<







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245


246
247
248
249
250
251
252
		k = page.indexOf("</mei>") + 6
		abc.mei2mus(page.slice(j, k))
		document.body.innerHTML = new_page
		return
	}

	// get the ABC insertion mode
	if (/<script[^t>]*type="text\/vnd.abc"/.test(page))
		re = /<script[^t>]*type="text\/vnd.abc"/g
	else if (/<[^>]* class="[^"]*abc[^"]*/.test(page))
		re = /<[^>]* class="[^"]*abc[^"]*/g
	else
		re = /%abc-\d|X:\s*\d/g

	src = '%%beginml\n'
	for (;;) {

		// get the start of a ABC sequence
		res = re.exec(page)
		if (!res) {


			src += page.slice(i).replace(/\n%%/g,"\n%%%%") +
					"\n%%endml\n"
			break
		}
		j = re.lastIndex - res[0].length;

		// (the core removes '%%' at start of line)