1local info = {
2 version = 1.002,
3 comment = "prototype textadept runner for context/metafun",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files",
7}
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31local match, gsub, find, format, gmatch, rep = string.match, string.gsub, string.find, string.format, string.gmatch, string.rep
32local char, lower, upper, sub = string.char, string.lower, string.upper, string.sub
33local concat, sort = table.concat, table.sort
34local assert, type = assert, type
35
36local original = textadept.run
37local runner = { }
38
39runner.MARK_WARNING = original.MARK_WARNING
40runner.MARK_ERROR = original.MARK_ERROR
41
42local specifications = { }
43runner.specifications = specifications
44
45
46local OUTPUT_BUFFER = '[Message Buffer]'
47
48
49
50local currentprocess = nil
51local xbuffer = nil
52
53local function find_buffer(buffer_type)
54 for i=1,#_BUFFERS do
55 local buffer = _BUFFERS[i]
56 if buffer._type == buffer_type then
57 return buffer
58 end
59 end
60end
61
62local function print_output(str)
63 local print_buffer = find_buffer(OUTPUT_BUFFER)
64
65 if not print_buffer then
66 if not ui.tabs then
67 view:split()
68 end
69 print_buffer = buffer.new()
70 print_buffer._type = OUTPUT_BUFFER
71 events.emit(events.FILE_OPENED)
72 else
73 for i=1,#_VIEWS do
74 local view = _VIEWS[i]
75 if view.buffer._type == OUTPUT_BUFFER then
76 ui.goto_view(view)
77 break
78 end
79 end
80 if view.buffer._type ~= OUTPUT_BUFFER then
81 view:goto_buffer(print_buffer)
82 end
83 end
84 print_buffer:append_text(str)
85 print_buffer:goto_pos(buffer.length)
86 print_buffer:set_save_point()
87 return true
88end
89
90local function trace_output(str)
91 xbuffer = buffer
92 print_output(str)
93 if xbuffer then
94 view:goto_buffer(xbuffer)
95 end
96end
97
98local function clear_output()
99 xbuffer = buffer
100 local print_buffer = find_buffer(OUTPUT_BUFFER)
101 if print_buffer then
102 print_buffer:clear_all()
103 end
104end
105
106local function is_output(buffer)
107 return buffer._type == OUTPUT_BUFFER
108end
109
110
111
112
113
114
115
116
117
118
119
120
121
122local function process(buffer,filename,action)
123 if not filename then
124 filename = buffer.filename
125 end
126 if not filename then
127 return
128 end
129 if filename == buffer.filename then
130 buffer:annotation_clear_all()
131 io.save_file()
132 end
133 if filename == "" then
134 return
135 end
136 local suffix = match(filename,'[^/\\.]+$')
137 local specification = specifications[suffix]
138 if not specification then
139 return
140 end
141 local action = specification[action]
142 local quitter = nil
143 if type(action) == "table" then
144 action = action.command
145 quitter = action.quitter
146 end
147 if type(action) ~= "string" then
148 return
149 end
150 clear_output()
151 local pathpart = ''
152 local basename = filename
153 if find(filename,'[/\\]') then
154 pathpart, basename = match(filename,'^(.+[/\\])([^/\\]+)$')
155 end
156
157 local nameonly = match(basename,'^(.+)%.')
158
159 local command = gsub(action,'%%(.-)%%', {
160 filename = filename,
161 pathname = dirname,
162 dirname = dirname,
163 pathpart = dirname,
164 basename = basename,
165 nameonly = nameonly,
166 suffix = suffix,
167 selection = function() return match(buffer.get_sel_text(),"%s*([A-Za-z]+)") end,
168 })
169
170 local function emit_output(output)
171 print_output(output)
172
173 if quitter then
174 local quit, message = quitter(interceptor)
175 if quit then
176 if message then
177 print_output(format("\n\n> quit: %s\n",message))
178 end
179 runner.quit()
180 end
181 end
182 end
183 local function exit_output(status)
184 print_output(format("\n\n> exit: %s, press esc to return to source\n",status))
185 end
186 print_output(format("> command: %s\n",command))
187 currentprocess = assert(os.spawn(command, pathpart, emit_output, emit_output, exit_output))
188end
189
190function runner.install(name)
191 return function(filename)
192 process(buffer,filename,name)
193 end
194end
195
196runner.check = runner.install("check")
197runner.process = runner.install("process")
198runner.preview = runner.install("preview")
199
200function runner.resultof(command)
201 local handle = io.popen(command,"r")
202 if handle then
203 local result = handle:read("*all") or ""
204 handle:close()
205 return result
206 else
207 return ""
208 end
209end
210
211function runner.quit()
212 if currentprocess then
213 assert(currentprocess:kill())
214 end
215end
216
217local function char_added(code)
218 if code == 10 and currentprocess and currentprocess:status() == 'running' and buffer._type == OUTPUT_BUFFER then
219 local line_num = buffer:line_from_position(buffer.current_pos) - 1
220 currentprocess:write((buffer:get_line(line_num)))
221 end
222 return true
223end
224
225function runner.goto_error(line, next)
226
227end
228
229local function key_press(code)
230 if xbuffer and keys.KEYSYMS[code] == 'esc' then
231 view:goto_buffer(xbuffer)
232 return true
233 end
234end
235
236local function double_click()
237 if xbuffer and is_output(buffer) then
238 view:goto_buffer(xbuffer)
239 return true
240 end
241end
242
243
244
245local l2 = char(0xC0)
246local l3 = char(0xE0)
247local l4 = char(0xF0)
248
249local function utflen(str)
250 local n = 0
251 local l = 0
252 for s in gmatch(str,".") do
253 if l > 0 then
254 l = l - 1
255 else
256 n = n + 1
257 if s >= l4 then
258 l = 3
259 elseif s >= l3 then
260 l = 2
261 elseif s >= l2 then
262 l = 1
263 end
264 end
265 end
266 return n
267end
268
269local function prepare()
270 local startposition = buffer.selection_start
271 local endposition = buffer.selection_end
272
273 if startposition == endposition then return end
274
275 buffer.current_pos = startposition
276 buffer:home()
277
278 buffer.current_pos = endposition
279 buffer:line_end_extend()
280
281 local firstposition = buffer.selection_start
282 local lastposition = buffer.selection_end
283
284 local firstline = buffer:line_from_position(startposition)
285 local lastline = buffer:line_from_position(endposition)
286
287 local startcolumn = startposition - firstposition
288 local endcolumn = lastposition - endposition + 1
289 local selection = buffer:get_sel_text()
290
291
292
293
294 return startposition, endposition, firstposition, lastposition, startcolumn, endcolumn, firstline, lastline, selection
295end
296
297local function replace(startposition,lastposition,replacement)
298 if type(replacement) == "table" then
299 replacement = concat(replacement,"\n")
300 end
301
302
303 buffer.current_pos = startposition
304
305 buffer:begin_undo_action()
306 buffer:set_target_range(startposition,lastposition)
307 buffer:replace_target(replacement)
308 buffer:end_undo_action()
309
310 buffer.selection_start = startposition
311 buffer.selection_end = startposition
312end
313
314
315
316
317local magicstring = rep("<ctx-crlf/>", 2)
318
319function runner.wrap()
320
321 local startposition, endposition, firstposition, lastposition, startcolumn, endcolumn, firstline, lastline, selection = prepare()
322
323 if not startposition then
324 return
325 end
326
327 local wraplength = buffer.wrap_length
328 local length = tonumber(wraplength) or 80
329 local replacement = { }
330 local templine = ""
331 local tempsize = 0
332 local indentation = rep(' ',startcolumn)
333
334 selection = gsub(selection,"[\n\r][\n\r]","\n")
335 selection = gsub(selection,"\n\n+"," " .. magicstring .. " ")
336 selection = gsub(selection,"^%s",'')
337
338 for snippet in gmatch(selection,"%S+") do
339 if snippet == magicstring then
340 replacement[#replacement+1] = templine
341 replacement[#replacement+1] = ""
342 templine = ""
343 tempsize = 0
344 else
345 local snipsize = utflen(snippet)
346 if tempsize + snipsize > length then
347 replacement[#replacement+1] = templine
348 templine = indentation .. snippet
349 tempsize = startcolumn + snipsize
350 elseif tempsize == 0 then
351 templine = indentation .. snippet
352 tempsize = tempsize + startcolumn + snipsize
353 else
354 templine = templine .. " " .. snippet
355 tempsize = tempsize + 1 + snipsize
356 end
357 end
358 end
359
360 replacement[#replacement+1] = templine
361 replacement[1] = gsub(replacement[1],"^%s+","")
362
363 if endcolumn == 0 then
364 replacement[#replacement+1] = ""
365 end
366
367 replace(startposition,lastposition,replacement)
368
369end
370
371local magicstring = rep("<multiplelines/>", 2)
372
373function runner.unwrap()
374
375 local startposition, endposition, firstposition, lastposition, startcolumn, endcolumn, selection, firstline, lastline = prepare()
376
377 if not startposition then
378 return
379 end
380
381 startposition = firstposition
382 endposition = lastposition
383
384 local selection = gsub(selection,"[\n\r][\n\r]+", " " .. magicstring .. " ")
385 local replacement = { }
386
387 for snippet in gmatch(selection,"%S+") do
388 replacement[#replacement+1] = snippet == magicstring and "" or snippet
389 end
390
391 if endcolumn == 0 then
392 replacement[#replacement+1] = ""
393 end
394
395 replace(startposition,lastposition,replacement)
396
397end
398
399
400
401
402local function grab(str,delimiter)
403 local list = { }
404 for snippet in gmatch(str,delimiter) do
405 list[#list+1] = snippet
406 end
407 return list
408end
409
410local function alphacmp_yes(a,b)
411 return lower(gsub(sub(a,i),"0"," ")) < lower(gsub(sub(b,i),"0"," "))
412end
413
414local function alphacmp_nop(a,b)
415 return lower(a) < lower(b)
416end
417
418local function alphasort(list,i)
419 sort(list,i and i > 0 and alphacmp_yes or alphacmp_nop)
420end
421
422function runner.sort()
423
424 local startposition, endposition, firstposition, lastposition, startcolumn, endcolumn, firstline, lastline, selection = prepare()
425
426 if not startposition then
427 return
428 end
429
430 startposition = firstposition
431 endposition = lastposition
432
433 local list = grab(selection,"[^\n\r]+")
434
435 alphasort(list,startcolumn)
436
437 if endcolumn == 0 then
438 list[#list+1] = ""
439 end
440
441 replace(startposition,lastposition,list)
442
443end
444
445
446
447
448
449
450
451
452
453events.connect(events.CHAR_ADDED, char_added, 1)
454events.connect(events.KEYPRESS, key_press, 1)
455events.connect(events.DOUBLE_CLICK, double_click, 1)
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482function runner.blockcomment()
483 local buffer = buffer
484 local comment = textadept.editing.comment_string[buffer:get_lexer(true)]
485
486 if not comment or comment == "" then
487 return
488 end
489
490 local prefix = comment:match('^([^|]+)|?([^|]*)$')
491 local usedprefix = prefix
492
493 if not prefix then
494 return
495 end
496
497 if not find(prefix,"%s$") then
498 usedprefix = prefix .. " "
499 end
500
501 local n_prefix = #prefix
502 local n_usedprefix = #usedprefix
503
504 local startposition = buffer.selection_start
505 local endposition = buffer.selection_end
506 local firstline = buffer:line_from_position(startposition)
507 local lastline = buffer:line_from_position(endposition)
508
509 if firstline ~= lastline and endposition == buffer:position_from_line(lastline) then
510 lastline = lastline - 1
511 end
512
513 startposition = buffer.line_end_position[startposition] - startposition
514 endposition = buffer.length - endposition
515
516 buffer:begin_undo_action()
517
518 for line=firstline,lastline do
519 local p = buffer:position_from_line(line)
520 if buffer:text_range(p, p + n_usedprefix) == usedprefix then
521 buffer:delete_range(p, n_usedprefix)
522 elseif buffer:text_range(p, p + n_prefix) == prefix then
523 buffer:delete_range(p, n_prefix)
524 else
525 buffer:insert_text(p, usedprefix)
526 end
527 end
528
529 buffer:end_undo_action()
530
531 startposition = buffer.line_end_position[firstline] - startposition
532 endposition = buffer.length - endposition
533
534
535
536 local start_pos = buffer:position_from_line(firstline)
537
538 if start_pos > startposition then
539 startposition = start_pos
540 end
541 if start_pos > endposition then
542 endposition = start_pos
543 end
544
545 if firstline ~= lastline then
546 buffer:set_sel(startposition, endposition)
547 else
548 buffer:goto_pos(endposition)
549 end
550end
551
552
553
554
555local textlists = {
556 en = {
557 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
558 "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
559 "u", "v", "w", "x", "y", "z",
560
561 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
562 "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
563 "U", "V", "W", "X", "Y", "Z",
564 },
565 nl = {
566 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
567 "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
568 "u", "v", "w", "x", "y", "z",
569
570 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
571 "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
572 "U", "V", "W", "X", "Y", "Z",
573 },
574 fr = {
575 "a", "ĂŠ", "b", "c", "ç", "d", "e", "Ăš", "Ă©", "ĂȘ",
576 "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
577 "p", "q", "r", "s", "t", "u", "v", "w", "x", "y",
578 "z",
579
580 "A", "Ă", "B", "C", "Ă", "D", "E", "Ă", "Ă", "Ă",
581 "F", "G", "H", "I", "J", "K", "L", "M", "N", "O",
582 "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y",
583 "Z",
584
585 },
586 de = {
587 "a", "Ă€", "b", "c", "d", "e", "f", "g", "h", "i",
588 "j", "k", "l", "m", "n", "o", "ö", "p", "q", "r",
589 "s", "Ă", "t", "u", "ĂŒ", "v", "w", "x", "y", "z",
590
591 "A", "Ă", "B", "C", "D", "E", "F", "G", "H", "I",
592 "J", "K", "L", "M", "N", "O", "Ă", "P", "Q", "R",
593 "S", "SS", "T", "U", "Ă", "V", "W", "X", "Y", "Z",
594 },
595 fi = {
596 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
597 "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
598 "u", "v", "w", "x", "y", "z", "Ä", "À", "ö",
599
600 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
601 "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
602 "U", "V", "W", "X", "Y", "Z", "Ă
", "Ă", "Ă",
603 },
604 sl = {
605 "a", "b", "c", "Ä", "Ä", "d", "Ä", "e", "f", "g", "h", "i",
606 "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "ĆĄ", "t",
607 "u", "v", "w", "x", "y", "z", "ĆŸ",
608
609 "A", "B", "C", "Ä", "Ä", "D", "Ä", "E", "F", "G", "H", "I",
610 "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "Ć ", "T",
611 "U", "V", "W", "X", "Y", "Z", "Ćœ",
612 },
613 ru = {
614 "Đ°", "б", "ĐČ", "Đł", "ĐŽ", "Đ”", "Ń", "ж", "Đ·", "Đž",
615 "Ń", "Đč", "Đș", "Đ»", "ĐŒ", "Đœ", "ĐŸ", "Đż", "Ń", "Ń",
616 "Ń", "Ń", "Ń", "Ń
", "Ń", "Ń", "Ń", "Ń", "Ń", "Ń",
617 "Ń", "ŃŁ", "Ń", "Ń", "Ń", "Ńł", "Ń”",
618
619 "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ",
620 "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ ", "ĐĄ",
621 "Đą", "ĐŁ", "Đ€", "Đ„", "ĐŠ", "Ч", "Đš", "Đ©", "ĐȘ", "Đ«",
622 "ĐŹ", "Ńą", "Đ", "Đź", "ĐŻ", "ŃČ", "ŃŽ",
623 },
624 uk = {
625 "Đ°", "б", "ĐČ", "Đł", "Ò", "ĐŽ", "Đ”", "Ń", "ж", "Đ·", "Đž", "Ń",
626 "Ń", "Đč", "Đș", "Đ»", "ĐŒ", "Đœ", "ĐŸ", "Đż", "Ń", "Ń", "Ń", "Ń",
627 "Ń", "Ń
", "Ń", "Ń", "Ń", "Ń", "Ń", "Ń", "Ń",
628
629 "Đ", "Đ", "Đ", "Đ", "Ò", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ",
630 "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ ", "ĐĄ", "Đą", "ĐŁ",
631 "Ѐ", "Є", "Њ", "Ч", "К", "Щ", "Џ", "П", "Я",
632 },
633 be = {
634 "Đ°", "б", "ĐČ", "Đł", "ĐŽ", "Đ”", "Ń", "ж", "Đ·", "Ń",
635 "Đč", "Đș", "Đ»", "ĐŒ", "Đœ", "ĐŸ", "Đż", "Ń", "Ń", "Ń",
636 "Ń", "Ń", "Ń", "Ń
", "Ń", "Ń", "Ń", "Ń", "Ń", "Ń",
637 "Ń", "Ń",
638
639 "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ",
640 "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ ", "ĐĄ", "Đą",
641 "ĐŁ", "Đ", "Đ€", "Đ„", "ĐŠ", "Ч", "Đš", "Đ«", "ĐŹ", "Đ",
642 "Đź", "ĐŻ",
643 },
644 bg = {
645 "Đ°", "б", "ĐČ", "Đł", "ĐŽ", "Đ”", "ж", "Đ·","Đž", "Đč",
646 "Đș", "a", "Đ»", "a", "ĐŒ", "Đœ", "ĐŸ", "Đż", "Ń", "Ń",
647 "Ń", "Ń", "Ń", "Ń
", "Ń", "Ń", "Ń", "Ń", "Ń", "Ń",
648 "Ń", "Ń",
649
650 "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ","Đ", "Đ",
651 "Đ", "A", "Đ", "A", "Đ", "Đ", "Đ", "Đ", "Đ ", "ĐĄ",
652 "Đą", "ĐŁ", "Đ€", "Đ„", "ĐŠ", "Ч", "Đš", "Đ©", "ĐȘ", "ĐŹ",
653 "Đź", "ĐŻ",
654 },
655 pl = {
656 "a", "Ä
", "b", "c", "Ä", "d", "e", "Ä", "f", "g",
657 "h", "i", "j", "k", "l", "Ć", "m", "n", "Ć", "o",
658 "Ăł", "p", "q", "r", "s", "Ć", "t", "u", "v", "w",
659 "x", "y", "z", "Ćș", "ĆŒ",
660
661 "A", "Ä", "B", "C", "Ä", "D", "E", "Ä", "F", "G",
662 "H", "I", "J", "K", "L", "Ć", "M", "N", "Ć", "O",
663 "Ă", "P", "Q", "R", "S", "Ć", "T", "U", "V", "W",
664 "X", "Y", "Z", "Ćč", "Ć»",
665 },
666 cz = {
667 "a", "ĂĄ", "b", "c", "Ä", "d", "Ä", "e", "Ă©", "Ä",
668 "f", "g", "h", "i", "Ă", "j", "k", "l", "m",
669 "n", "Ć", "o", "Ăł", "p", "q", "r", "Ć", "s", "ĆĄ",
670 "t", "Ć„", "u", "Ăș", "ĆŻ", "v", "w", "x", "y", "Ăœ",
671 "z", "ĆŸ",
672
673 "A", "Ă", "B", "C", "Ä", "D", "Ä", "E", "Ă", "Ä",
674 "F", "G", "H", "I", "Ă", "J", "K", "L", "M",
675 "N", "Ć", "O", "Ă", "P", "Q", "R", "Ć", "S", "Ć ",
676 "T", "Ć€", "U", "Ă", "Ćź", "V", "W", "X", "Y", "Ă",
677 "Z", "Ćœ",
678 },
679 sk = {
680 "a", "ĂĄ", "Ă€", "b", "c", "Ä", "d", "Ä",
681 "e", "Ă©", "f", "g", "h", ch, "i", "Ă", "j", "k",
682 "l", "Äș", "ÄŸ", "m", "n", "Ć", "o", "Ăł", "ĂŽ", "p",
683 "q", "r", "Ć", "s", "ĆĄ", "t", "Ć„", "u", "Ăș", "v",
684 "w", "x", "y", "Ăœ", "z", "ĆŸ",
685
686 "A", "Ă", "Ă", "B", "C", "Ä", "D", "Ä",
687 "E", "Ă", "F", "G", "H", "I", "Ă", "J", "K",
688 "L", "Äč", "Äœ", "M", "N", "Ć", "O", "Ă", "Ă", "P",
689 "Q", "R", "Ć", "S", "Ć ", "T", "Ć€", "U", "Ă", "V",
690 "W", "X", "Y", "Ă", "Z", "Ćœ",
691 },
692 hr = {
693 "a", "b", "c", "Ä", "Ä", "d", "Ä", "e", "f",
694 "g", "h", "i", "j", "k", "l", "m", "n",
695 "o", "p", "r", "s", "ĆĄ", "t", "u", "v", "z", "ĆŸ",
696
697 "A", "B", "C", "Ä", "Ä", "D", "Ä", "E", "F",
698 "G", "H", "I", "J", "K", "L", "M", "N",
699 "O", "P", "R", "S", "Ć ", "T", "U", "V", "Z", "Ćœ",
700 },
701 sr = {
702 "Đ°", "б", "ĐČ", "Đł", "ĐŽ", "Ń", "Đ”", "ж", "Đ·", "Đž",
703 "Ń", "Đș", "Đ»", "Ń", "ĐŒ", "Đœ", "Ń", "ĐŸ", "Đż", "Ń",
704 "Ń", "Ń", "Ń", "Ń", "Ń", "Ń
", "Ń", "Ń", "Ń", "Ń",
705
706 "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ",
707 "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ", "Đ ",
708 "ĐĄ", "Đą", "Đ", "ĐŁ", "Đ€", "Đ„", "ĐŠ", "Ч", "Đ", "Đš",
709 },
710 no = {
711 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
712 "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
713 "u", "v", "w", "x", "y", "z", "ĂŠ", "Ăž", "Ă„",
714
715 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
716 "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
717 "U", "V", "W", "X", "Y", "Z", "Ă", "Ă", "Ă
",
718 },
719 da = {
720 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
721 "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
722 "u", "v", "w", "x", "y", "z", "ĂŠ", "Ăž", "Ă„",
723
724 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
725 "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
726 "U", "V", "W", "X", "Y", "Z", "Ă", "Ă", "Ă
",
727 },
728 sv = {
729 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
730 "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
731 "u", "v", "w", "x", "y", "z", "Ä", "À", "ö",
732
733 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
734 "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
735 "U", "V", "W", "X", "Y", "Z", "Ă
", "Ă", "Ă",
736 },
737 is = {
738 "a", "ĂĄ", "b", "d", "Ă°", "e", "Ă©", "f", "g", "h",
739 "i", "Ă", "j", "k", "l", "m", "n", "o", "Ăł", "p",
740 "r", "s", "t", "u", "Ăș", "v", "x", "y", "Ăœ", "ĂŸ",
741 "Ê", "ö",
742
743 "A", "Ă", "B", "D", "Ă", "E", "Ă", "F", "G", "H",
744 "I", "Ă", "J", "K", "L", "M", "N", "O", "Ă", "P",
745 "R", "S", "T", "U", "Ă", "V", "X", "Y", "Ă", "Ă",
746 "Ă", "Ă",
747 },
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780 gr = {
781 "α", "ÎČ", "Îł", "ÎŽ", "Δ", "ζ", "η", "Ξ", "Îč", "Îș",
782 "λ", "ÎŒ", "Îœ", "Ο", "Îż", "Ï", "Ï", "Ï", "Ï", "Ï
",
783 "Ï", "Ï", "Ï", "Ï",
784
785 "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î",
786 "Î", "Î", "Î", "Î", "Î", "Î ", "ÎĄ", "ÎŁ", "΀", "΄",
787 "Χ", "Κ", "Ω",
788 },
789 la = {
790 "a", "Ä", "Ä", "b", "c", "d", "e", "Ä", "Ä", "f",
791 "g", "h", "i", "Ä«", "Ä", "j", "k", "l", "m", "n",
792 "o", "Ć", "Ć", "p", "q", "r", "s", "t", "u", "Ć«",
793 "Ć", "v", "w", "x", "y", "Èł", "yÌ", "z", "ĂŠ",
794
795 "A", "Ä", "Ä", "B", "C", "D", "E", "Ä", "Ä", "F",
796 "G", "H", "I", "ÄȘ", "ÄŹ", "J", "K", "L", "M", "N",
797 "O", "Ć", "Ć", "P", "Q", "R", "S", "T", "U", "ĆȘ",
798 "ĆŹ", "V", "W", "X", "Y", "ÈČ", "YÌ", "Z", "Ă",
799 },
800 it = {
801 "a", "ĂĄ", "b", "c", "d", "e", "Ă©", "Ăš", "f", "g",
802 "h", "i", "Ă", "ĂŹ", "j", "k", "l", "m", "n", "o",
803 "Ăł", "ĂČ", "p", "q", "r", "s", "t", "u", "Ăș", "Ăč",
804 "v", "w", "x", "y", "z",
805
806 "A", "Ă", "B", "C", "D", "E", "Ă", "Ă", "F", "G",
807 "H", "I", "Ă", "Ă", "J", "K", "L", "M", "N", "O",
808 "Ă", "Ă", "P", "Q", "R", "S", "T", "U", "Ă", "Ă",
809 "V", "W", "X", "Y", "Z",
810 },
811 ro = {
812 "a", "Ä", "Ăą", "b", "c", "d", "e", "f", "g", "h",
813 "i", "Ăź", "j", "k", "l", "m", "n", "o", "p", "q",
814 "r", "s", "È", "t", "È", "u", "v", "w", "x", "y",
815 "z",
816
817 "A", "Ä", "Ă", "B", "C", "D", "E", "F", "G", "H",
818 "I", "Ă", "J", "K", "L", "M", "N", "O", "P", "Q",
819 "R", "S", "È", "T", "È", "U", "V", "W", "X", "Y",
820 "Z",
821 },
822 es = {
823 "a", "ĂĄ", "b", "c", "d", "e", "Ă©", "f", "g", "h",
824 "i", "Ă", "j", "k", "l", "m", "n", "ñ", "o", "Ăł",
825 "p", "q", "r", "s", "t", "u", "Ăș", "ĂŒ", "v", "w",
826 "x", "y", "z",
827
828 "A", "Ă", "B", "C", "D", "E", "Ă", "F", "G", "H",
829 "I", "Ă", "J", "K", "L", "M", "N", "Ă", "O", "Ă",
830 "P", "Q", "R", "S", "T", "U", "Ă", "Ă", "V", "W",
831 "X", "Y", "Z",
832 },
833 pt = {
834 "a", "å", "ù", "ã", "à ", "b", "c", "ç", "d", "e",
835 "Ă©", "ĂȘ", "f", "g", "h", "i", "Ă", "j", "k", "l",
836 "m", "n", "o", "Ăł", "ĂŽ", "Ă”", "p", "q", "r", "s",
837 "t", "u", "Ăș", "ĂŒ", "v", "w", "x", "y", "z",
838
839 "A", "Ă", "Ă", "Ă", "Ă", "B", "C", "Ă", "D", "E",
840 "Ă", "Ă", "F", "G", "H", "I", "Ă", "J", "K", "L",
841 "M", "N", "O", "Ă", "Ă", "Ă", "P", "Q", "R", "S",
842 "T", "U", "Ă", "Ă", "V", "W", "X", "Y", "Z",
843 },
844 lt = {
845 "a", "Ä
", "b", "c", "ch", "Ä", "d", "e", "Ä", "Ä",
846 "f", "g", "h", "i", "ÄŻ", "y", "j", "k", "l", "m",
847 "n", "o", "p", "r", "s", "ĆĄ", "t", "u", "Ćł", "Ć«",
848 "v", "z", "ĆŸ",
849
850 "A", "Ä", "B", "C", "CH", "Ä", "D", "E", "Ä", "Ä",
851 "F", "G", "H", "I", "Äź", "Y", "J", "K", "L", "M",
852 "N", "O", "P", "R", "S", "Ć ", "T", "U", "ĆČ", "ĆȘ",
853 "V", "Z", "Ćœ",
854 },
855 lv = {
856 "a", "Ä", "b", "c", "Ä", "d", "e", "Ä", "f", "g",
857 "ÄŁ", "h", "i", "Ä«", "j", "k", "Ä·", "l", "ÄŒ", "m",
858 "n", "Ć", "o", "Ć", "p", "r", "Ć", "s", "ĆĄ", "t",
859 "u", "Ć«", "v", "z", "ĆŸ",
860
861 "A", "Ä", "B", "C", "Ä", "D", "E", "Ä", "F", "G",
862 "Äą", "H", "I", "ÄȘ", "J", "K", "Ķ", "L", "Ä»", "M",
863 "N", "Ć
", "O", "Ć", "P", "R", "Ć", "S", "Ć ", "T",
864 "U", "ĆȘ", "V", "Z", "Ćœ",
865 },
866 hu = {
867 "a", "ĂĄ", "b", "c", "d", "e", "Ă©",
868 "f", "g", "h", "i", "Ă", "j", "k", "l",
869 "m", "n", "o", "Ăł", "ö", "Ć", "p", "q", "r",
870 "s", "t", "u", "Ăș", "ĂŒ", "Ʊ", "v", "w",
871 "x", "y", "z",
872
873 "A", "Ă", "B", "C", "D", "E", "Ă",
874 "F", "G", "H", "I", "Ă", "J", "K", "L",
875 "M", "N", "O", "Ă", "Ă", "Ć", "P", "Q", "R",
876 "S", "T", "U", "Ă", "Ă", "Ć°", "V", "W",
877 "X", "Y", "Z",
878 },
879 et = {
880 "a", "b", "d", "e", "f", "g", "h", "i", "j", "k",
881 "l", "m", "n", "o", "p", "r", "s", "ĆĄ", "z", "ĆŸ",
882 "t", "u", "v", "w", "Ă”", "Ă€", "ö", "ĂŒ", "x", "y",
883
884 "A", "B", "D", "E", "F", "G", "H", "I", "J", "K",
885 "L", "M", "N", "O", "P", "R", "S", "Ć ", "Z", "Ćœ",
886 "T", "U", "V", "W", "Ă", "Ă", "Ă", "Ă", "X", "Y",
887 },
888
889
890
891
892
893
894
895}
896
897local textselector = { }
898for k, v in next, textlists do
899 textselector[#textselector+1] = k
900end
901sort(textselector)
902
903local mathsets = {
904 { "tf", {
905 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
906 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
907 "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
908 }, },
909 { "bf", {
910 "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł",
911 "đ", "đ", "đ", "đ", "đ", "đ
", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ",
912 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ"
913 }, },
914 { "it", {
915 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "â", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§",
916 "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ", "đ", "đ
", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ",
917 }, },
918 { "bi", {
919 "đ", "đ", "đ", "đ
", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ",
920 "đš", "đ©", "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ", "đ",
921 }, },
922 { "sc", {
923 "đ”", "đ¶", "đ·", "đž", "đč", "âŻ", "đ»", "â", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ", "âŽ", "đ
", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ",
924 "đ", "âŹ", "đ", "đ", "â°", "â±", "đą", "â", "â", "đ„", "đŠ", "â", "âł", "đ©", "đȘ", "đ«", "đŹ", "â", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ",
925 }, },
926 { "sc bf", {
927 "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ",
928 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©",
929 }, },
930 { "fr", {
931 "đ", "đ", "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·",
932 "đ", "đ
", "â", "đ", "đ", "đ", "đ", "â", "â", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "â", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "âš",
933 }, },
934 { "ds", {
935 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«",
936 "đž", "đč", "â", "đ»", "đŒ", "đœ", "đŸ", "â", "đ", "đ", "đ", "đ", "đ", "â", "đ", "â", "â", "â", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "â€", "đ",
937 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ"
938 }, },
939 { "fr bf", {
940 "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ",
941 "đ", "đ
", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ"
942 }, },
943 { "ss tf", {
944 "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ", "đ", "đ
", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ",
945 "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč",
946 "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«"
947 }, },
948 { "ss bf", {
949 "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ", "đ", "đ
", "đ", "đ",
950 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«", "đŹ", "đ",
951 "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”",
952 }, },
953 { "ss it", {
954 "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș", "đ»",
955 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ",
956 }, },
957 { "ss bi", {
958 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ",
959 "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ", "đ", "đ
", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ",
960 }, },
961 { "tt", {
962 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ", "đą", "đŁ",
963 "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ", "đ", "đ
", "đ", "đ", "đ", "đ",
964 "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż"
965 }, },
966 { "gr tf", {
967 "α", "ÎČ", "Îł", "ÎŽ", "Δ", "ζ", "η", "Ξ", "Îč", "Îș", "λ", "ÎŒ", "Îœ", "Ο", "Îż", "Ï", "Ï", "Ï", "Ï", "Ï", "Ï
", "Ï", "Ï", "Ï", "Ï",
968 "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î", "Î ", "ÎĄ", "Îą", "ÎŁ", "΀", "΄", "Ί", "Χ", "Κ", "Ω",
969 }, },
970 { "gr bf", {
971 "đ", "đ", "đ", "đ
", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ",
972 "đš", "đ©", "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ",
973 }, },
974 { "gr it", {
975 "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ", "đ", "đ
", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ",
976 "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș",
977 }, },
978 { "gr bi", {
979 "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ", "đ", "đ
", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ",
980 "đ", "đ", "đ", "đ", "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ",
981 }, },
982 { "gr ss bf", {
983 "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ", "đ", "đ", "đ
", "đ", "đ", "đ",
984 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš", "đ©", "đȘ", "đ«", "đŹ", "đ", "đź",
985 }, },
986 { "gr ss bi", {
987 "đȘ", "đ«", "đŹ", "đ", "đź", "đŻ", "đ°", "đ±", "đČ", "đł", "đŽ", "đ”", "đ¶", "đ·", "đž", "đč", "đș", "đ»", "đŒ", "đœ", "đŸ", "đż", "đ", "đ", "đ",
988 "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ", "đ ", "đĄ", "đą", "đŁ", "đ€", "đ„", "đŠ", "đ§", "đš",
989 }, },
990 { "op", {
991 }, },
992 { "sy a", {
993 }, },
994 { "sy b", {
995 }, },
996 { "sy c", {
997 }, },
998}
999
1000local mathlists = { }
1001local mathselector = { }
1002
1003for i=1,#mathsets do
1004 local mathset = mathsets[i]
1005 mathselector[#mathselector+1] = mathset[1]
1006 mathlists[mathset[1]] = mathset[2]
1007end
1008
1009local enabled = 0
1010local usedlists = {
1011 { name = "text", current = "en", lists = textlists, selector = textselector },
1012 { name = "math", current = "tf", lists = mathlists, selector = mathselector },
1013}
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050function runner.unicodes(name)
1051
1052
1053
1054
1055
1056
1057
1058end
1059
1060return runner
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101 |