-
Notifications
You must be signed in to change notification settings - Fork 2
/
tag-file-generator.pl
executable file
·912 lines (877 loc) · 29.1 KB
/
tag-file-generator.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
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
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
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
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
#! /usr/bin/perl -w
#?
#? NAME
#? $0 - tag content generator for EMiR - Event Mappings in Reality
#?
#? SYNOPSIS
#? $0 [<options>] <TAG>
#?
#? OPTIONS
#? --h this text
#? --js only print JavaScript part from emir.html
#? --close generate content in </tag> instead of <tag>
#? --list-tags just list all tags defined in emir.html
#? --list-events just list all events defined in emir.html
#? --dbx-tty print debug information on console's (tty) STDERR
#? --dbx-html print debug information as HTML comment in generated data
#?
#? DESCRIPTION
#? Generates a complete HTML content and prints on STDOUT. The generated
#? content contains all known event attributes for the specified <TAG>.
#? The generated content (when saved to a file) is destined to be used as
#? link (to the saved file) in emir.html for the corresponding <TAG>.
#?
#? NOTE that only one TAG is expected as argument. If more than one TAG
#? is specified, content for each will be generated.
#?
#? Beside some constant text (content) the generated HTML looks like:
#?
#? <head> ...
#? <TAG id="TAG"\
#? EVENT0="return $e$(this,'EVENT0');"
#? EVENT1="return $e$(this,'EVENT1');"
#? EVENT...
#? >-test me-</TAG>
#? ...
#? </head>
#? <body>
#? <div><fieldset><span> <TAG> </span>
#? <label id="l-TAG-EVENT0">\
#? <input id="TAG-EVENT0" type="checkbox"> EVENT </label>
#? <label id="l-TAG-EVENT...
#? </fieldset></div>
#? ...
#? </body>
#?
#? or:
#?
#? <head> ... </head>
#? <body> ...
#? <div><fieldset><span> <TAG> </span>
#? <TAG id="TAG"\
#? EVENT0="return $e$(this,'EVENT0');"
#? EVENT1="return $e$(this,'EVENT1');"
#? EVENT...
#? >-test me-</TAG>
#? <label id="l-TAG-EVENT0">\
#? <input id="TAG-EVENT0" type="checkbox"> EVENT </label>
#? <label id="l-TAG-EVENT...
#? </fieldset></div>
#? ...
#? </body>
#?
#? LIMITATIONS
#? Following limitations exists (4/2020):
#? * parent|child no checks are done, if a tag is valid in the generated
#? HTML content (see DESCRIPTION of content above).
#? * multiple tags in the <head> section, a tag may occour more than
#? once, this is considered valid HTML content.
#? * <html> tag printed inside <body> tag (works for most Mozilla).
#? * <meta> tag printed in <head> section only.
#? * <script> tag printed in <body> section only.
#? * <script> tag does not contain a type= attribute.
#? * <style> tag does not contain a type= attribute.
#? * <body> tag not yet implemented. When given as argument for <TAG>
#? it will generate a <body> tag inside the <body> scope.
#? This behaviour is not yet tested (6/2020).
#? * <form> tag printed nested in <body> section, it's a bug here.
#? * <noframes> tag printed in <body> section, it's a bug here.
#? * <plaintext> tag not supported as most HTML render engines fail to
#? find its closing tag (3/2021).
#? * <invalid> tag any string can be used to generate the content, it
#? then will be treated as tag name and printed like any
#? valid tag name, consider this a feature ;-)
#? * --close NOT IMPLEMENTED for frame and framset tags
#? NOT IMPLEMENTED for empty (aka standalone) tags
#?
# Hacker's INFO
# The HTML tags and all known tag attributes are not defined herein but
# will be extraced from emir.html (which serves as master).
# Following markers are expected in emir.html:
# emir__INFO__
# emir__HEAD__
# emir__TITLE__
# emir__META__
# emir__EVENTS__
# emir__TAGS__
# emir__CHECK__
# emir__FIELDSET__
# emir__BODY__
# emir__JS__
# not yet used:
# emir__CSS__
#
# http://en.wikipedia.org/wiki/DOM_events
# http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#event-mousemultiwheel
# http://www.slideshare.net/guestb0af15/syngresscrosssitescriptingattacksxssexploitsanddefensemay2007
#
#? EXAMPLES
#? $0 link > emir-link.html
#? $0 span --close > emir-span_close.html
#? $0 --js
#? $0 --list-tags
#? $0 --list-events
#?
#? Please use make to see which files to be generated and how to do it:
#? make
#? make all -n
#? make all
#?
#? SEE ALSO
#? emir.html
#?
#? VERSION
#? @(#) 1.5 21/03/17 13:59:35
#?
#? AUTHOR
#? 09-dec-09 Achim Hoffmann
#?
# -----------------------------------------------------------------------------
use strict;
use warnings;
## no critic qw(Subroutines::ProhibitSubroutinePrototypes)
# because we believe that Perl's prototypes make the code better readable
## no critic qw(RegularExpressions::RequireExtendedFormatting)
# because most used RegEx are simple and easy to understand by humans
## no critic qw(BuiltinFunctions::RequireBlockGrep)
# grep is not used in "expression form" but in "function form", hence it
# is good to read by humans (and not awkward as perlcritic states)
## no critic qw(InputOutput::RequireBriefOpen)
# perlcritic is tooo picky
# --------------------------------------------- internal variables; defaults
my @events; # from emir.html
my @tags_all; # from emir.html
my @tags; # from arguments
my $html; # from emir.html
my $script; # from emir.html
my $emir_text = '//# generated by 1.5 for tag(s): ';
my $dbx = ''; # 'tty' or 'html'
my $emir_js = 0; # 1: only print JavaScript content of emir.html
my $tagmode = 0; # 0: events in <tag>; 1: events in </tag>
my $emir_list = ''; # 'tags' or 'events'
my @input_type = qw(button hidden text reset submit file checkbox radio); # TODO: not yet implmented
# siehe emir.html "var tags = {}"
my @tags_file = qw(applet base body form frame frameset head html iframe link meta noembed noframes noscript style title);
my @tags_meta = qw(base head isindex link meta style title);
my @tags_nouse = qw(applet body elements); # TODO: not yet implmented
my @tags_attr = qw(); # TODO
my @tags_empty = qw(area base basefont br col embed frame hr img input isindex keygen link meta param source spacer track wbr);
my @tags_notext = qw(hr script); # done by @tags_empty implicitely
my @tags_action = qw(form isindex); # TODO: not yet implmented
my @tags_input = qw(button input); # TODO: not yet implmented
my @tags_table = qw(table tbody thead tfoot caption col colgroup tr td th);
my @tags_select = qw(multicol optgroup option select); # TODO: not yet implmented
my @tags_lists = qw(ol ul); # not yet used
my @tags_width10= qw(applet embed iframe);
my @tags_check; # contains the tags which need an additional fieldset with
# checkboxes for the events in the <body> part, added dynamically
# --------------------------------------------- functions
sub _dbx_tty($) { my $t=shift; $t=~s/--/−−/g; print STDERR "#[$0]: $t\n"; return; }
sub _dbx_html($){ my $t=shift; $t=~s/--/−−/g; print "<!-- $t -->\n"; return; }
sub _dbx($) {
#? print line as HTML comment for debugging; replace -- by 2 "minus sign"s \u2212
if ('tty' eq $dbx) { _dbx_tty shift; }
if ('html' eq $dbx) { _dbx_html shift; }
return;
}; # _dbx
sub get_data() {
#? extract data from emir.html: @events, @tags_all, $html, $script
#
# extraction expects well formed data in emir.html, following formats
# are expected:
# <script type="text/javascript">
# //# emir__JS__
# ...
# //# emir__JS__
# </script>
# var events = {
# 'all': { //# emir__EVENTS__
# 'event0': any other text
# 'eventX': ...
# ...
# }, // all
# '...':{
# ...
# }, // all //# emir__EVENTS__
# }; // events
# var tags = {
# 'HTML 4': { //# emir__TAGS__
# 'tag0': any other text
# 'tagX': ...
# ...
# }, // HTML 4 //# emir__TAGS__
# 'HTML 5': { //# emir__TAGS__
# 'tag0': any other text
# 'tagX': ...
# ...
# }, // HTML 5 //# emir__TAGS__
# }; // tags
# First word (usualy enclosed in') of each line betwwen emir__EVENTS__
# and emir__TAGS__ will be extracted and added to the corresponding array.
#
binmode(STDOUT, ":encoding(UTF-8)");
my $f = './emir.html';
my $fh;
open($fh, '<:encoding(UTF-8)', $f) || die "$0: WARNING: cannot read »$f«.\n";
my $mode = 'skip';
my $js = 0;
while(<$fh>) {
/\s*{.*emir__INFO__/ && do { $mode = 'info'; next; };
/^\s*}.*emir__INFO__/ && do { $mode = 'skip'; next; };
next if 'info' eq $mode;
/^\s*.*emir__JS__/ && do { $js = not $js; next; };
if ($js) {
$script .= $_ ;
} else{
$html .= $_ ;
}
/^\s*#/ && next; # comments: lazy match, but good enough
/^\s*\/\// && next; # ...
/^\s*\/\*/ && next; # ...
/^\s*\*\/\s*$/ && next; # ...
/^\s*'all'.*emir__EVENTS__/ && do { $mode = 'events'; next; };
/^\s*'HTML .'.*emir__TAGS__/&& do { $mode = 'tags'; next; };
/^\s*}.*emir__/ && do { $mode = 'skip'; next; };
next if 'skip' eq $mode;
my $arg = $_;
$arg =~ s/\s*'([^']*)'.*$/$1/s; # extract left-most word which is enclosd in '
if ('events' eq $mode) {
# 5/2020: content in emir.html changed: events are no
# longer listed in events[all] but in all other hashes
# so only the event definition needs to be extracted,
# they all have the value null
# TODO: extracts also strings inside /* .. */ comments
next if $_ !~ m/^\s*'.*?null.*/;
next if (grep(/^$arg$/, @events)); # ignore duplicates
}
push(@events, $arg) if 'events' eq $mode;
push(@tags_all, $arg) if 'tags' eq $mode;
}
close($fh);
return;
}; # get_data
sub p_event($) { my $evt=shift; my $e='$e$'; return "$evt=\"return $e(this,'$evt');\""; }
sub p_events() { my $ret; $ret .= "\n\t\t" . p_event($_) foreach (@events); return $ret; }
sub p_input($) { return '<input type="checkbox" disabled="1" ' . "id=$_[0] name=$_[0] />"; }
# Note that input tag is disabled to avoid that manual clicking the checkbox
# itself changes the value
sub p_checkbox($$) {
#? return checkbox tag with label: <label><input type=checkbox ></label>
my $tag = shift;
my $evt = shift;
my $display = '"display:none"';
my $label_id= '"l-' . qq($tag-$evt) . '"'; # avoid \" in string concatenation
my $input_id= '"' . qq($tag-$evt) . '"';
return "\t<label id=$label_id style=$display >| " .
p_input($input_id) .
"$evt</label>\n";
}; # p_checkbox
sub p_checkboxes($) {
#? return checkbox tags for all known events
my $tag = shift;
my $ret = '';
foreach my $evt (@events) { $ret .= ' ' . p_checkbox($tag, $evt); }
return $ret;
}; # p_checkboxes
sub p_tag($$$$$) {
#? return tag: <tag events ...>-test-me- </tag>
#? or : <tag>-test-me- </tag events ...>
my $tag = shift;
my $id = shift;
my $txt = shift;
my $end = shift;# 1: print </tag> (currently only required for <head>
# 0: print />
my $cls = shift;# 0: return event is <tag >
# 1: return event is </tag >
# according https://www.w3.org/TR/xhtml1/ empty (aka standalone) tags
# must be written as <tag /> or <tag></tag> and must not contain any
# text; the short notation <tag /> is used here
# ugly code follows ...
my $result = "\t<$tag id=\"$id\" name=\"$id\"" .
((grep(/^$tag$/, @tags_width10)) ? ' width="15" height="15" ' : '');
if (1 == $cls) {
# TODO: @tags_empty not yet supported for events in </tag>
$result .= ">$txt</$tag ";
}
$result .= p_events();
if (1 == $cls) {
$result .= ">";
} else {
$result .= ((grep(/^$tag$/, @tags_empty)) ? ' />' : ">$txt") .
(($end==1) ? "\n\t</$tag>" : '');
}
return "$result\n";
}; # p_tag
sub p_fieldset($$$) {
#? return tag: <tag events ...>-test-me- </tag>
my $tag = shift;
my $see = shift; # 0: no tag with "-test-me-; 1: with tag
my $cls = shift;
#my $chk = shift; # 0: no checkbox tags; 1: checkbox tag for each event
my $chk = 1;
return " <div><fieldset><span><" . uc($tag) . "></span>\n" .
(($see==1) ? p_tag($tag, $tag, '-test me-', 1, $cls) : '') .
(($chk==1) ? p_checkboxes($tag) : '') .
" </fieldset></div>\n\n";
}; # p_fieldset
sub p_frameset($) {
#? return frameset: <tag events ...>-test-me- </tag>
# can be used for frame and frameset tag
my $tag = shift;
#
# frame and frameset tags are a bit tricky, 'cause they are not inside
# <body> and do not allow other usual HTML tags, hence everything must
# be content of an (other) frame. The frames do not use their own file
# here, but all content as inline HTML in the src= attribute. Therfore
# following substitues in the inline HTML are necessary:
# ' must be replaced because they are needed where " are used
# " must be replaced by ' because HTML can't escape quotes
# < HTML entity must be replaced by another charcter
# > HTML entity must be replaced by another charcter
# HTML entities in src="data:text/html,..." are substituded before
# rendered, hence they cannot be used to escape their meta
# functionality
# The attribute src="data:text/html;charset=UTF-8, ..." must be used
# because unicode characters are used in the inline HTML.
# For these substitutes see $checkboxes below.
# The checks for the frame and frameset tag are similar, the generated
# HTML is very similar too, example:
#
# <-- example for frameset -->
# <frameset rows="50,50,*" id="frameset"
# -- list of event attributes -- >
# <frame id="check" src=" -- HTML with checkboxes --" />
# <frame id="dummy" src=" -- dummy HTML --" />
# </frameset>
#
# <-- example for frame -->
# <frameset rows="50,50,*" id="frameset" >
# <frame id="frame-f" name="frame-f"
# -- list of event attributes -- />
# <frame id="check" src=" -- HTML with checkboxes --" />
# <frame id="dummy" src=" -- dummy HTML --" />
# </frameset>
#
my $checkboxes = p_fieldset($tag, 0, 0); # frame containing the checkboxes; # TODO: </tag> klären
$checkboxes =~ s#\n##g; # remove \n
$checkboxes =~ s#'#/#g; # TODO: to be tested
$checkboxes =~ s#"#'#g;
my $frame_dummy = '<frame id="dummy" src="data:text/html,<html><body><h3>just a dummy frame</h3></body></html>" />';
my $frame_check = '<frame id="check" src="data:text/html;charset=UTF-8,<html><body>_CHECKS_</body></html>" />';
$frame_check =~ s/_CHECKS_/$checkboxes/;
my $noframes = '<noframes>Browser does not support frames.</noframes>';
my $frame = p_events() . " >-test me-\n"; # code for frameset
if ($tag =~ m/^frame$/i) {
$frame = " >\n" . p_tag($tag, "$tag-f", '', 1, 0); # code for frame
# close frameset tag and add frame tag with events
}
return '<frameset rows="50,50,*" id="frameset"' .
$frame .
"\t$frame_check\n" .
"\t$frame_dummy\n" .
"</frameset>\n$noframes\n</html>\n";
}; # p_frameset
sub uniq { ## no critic qw(Subroutines::RequireArgUnpacking)
my %seen;
return grep !$seen{$_}++, @_;
}
# --------------------------------------------- options
while ( $#ARGV >= 0 ) {
my $arg = shift;
if ($arg =~ m/--js/) { $emir_js = 1; next; }
if ($arg =~ m/--close/) { $tagmode = 1; next; }
if ($arg =~ m/--list-tags/) { $emir_list = 'tags'; next; }
if ($arg =~ m/--list-events/) { $emir_list = 'events'; next; }
if ($arg =~ m/--dbx.?html/) { $dbx = 'html'; next; }
if ($arg =~ m/--debug.?html/) { $dbx = 'html'; next; }
if ($arg =~ m/--d(bx|ebug).?tty/) { $dbx = 'tty'; next; }
if ($arg =~ m/--d(bx|ebug)?/) { $dbx = 'tty'; next; }
if ($arg =~ m/--?h(elp)?/) {
my $me = $0; $me =~ s#.*[/\\]##;
my $fh;
binmode(STDOUT, ":encoding(UTF-8)");
open($fh, '<:encoding(UTF-8)', $0) || die "$0: WARNING: cannot read myself.\n";
while(<$fh>) {
s/\$0/$me/g;
/^#\?(.*)$/ && print "$1\n";
}
close($fh);
exit(2);
}
push(@tags, $arg);
}
# --------------------------------------------- main
#
# generate code for required tags and corresponding checkboxes
# then insert generated code in proper positions in emir.html
# all the positions are marked with emir__*__ comments, they
# simply replaced with the generated code
$emir_text .= join(" ", @tags);
get_data(); # from emir.html: @events, @tags_all
if (0 < $emir_js) {
print "$emir_text\n";
print $script;
exit 0;
}
@events = uniq(@events);
@tags_all = uniq(@tags_all);
if ('events' eq $emir_list) {
print "@events\n";
exit 0;
}
if ('tags' eq $emir_list) {
print "@tags_all\n";
exit 0;
}
$script = '<script type="text/javascript">var emir_file=true;</script>';
# generated files do not use inline JavaScript, therfore emir_file=true;
# must be defined in its own script tag
$html =~ s/^<!--.*-->//m; # TODO: remove initial comments, useless here
$html =~ s/^(<html>)$/<!-- $emir_text -->\n$1/m; # add generator text
$html =~ s#^(\s*<script .*)>#\t$script$1 src="emir.js" >#m;
# $_ = '<!-- ' . $_ . ' -->' if not $js;
my $tag_html = '';
my $tag_end = 1;
my $tag_noend = 0;
my $tag_testme = 1;
my $tag_tag = 0; # 0: events in <tag>
my $tag_close = 1; # 1: events in </tag>
my $tag_notestme= 0;
my $code = '';
my $meta = '';
_dbx "<head> tag";
if (0 == $tagmode) {
# not for --close
if (grep(/^head$/, @tags)) {
$code = p_tag('head', 'head', $tag_html, $tag_noend, $tagmode);
$html =~ s/^\s*<head>.*emir__HEAD__\s*-->/$code/m;
push(@tags_check, 'head');
}
}
_dbx "tags inside <head>";
foreach my $tag (@tags) {
next if ($tag =~ /^head$/);# already done
next if (!grep(/^$tag$/, @tags_meta));
$code = p_tag($tag, $tag, $tag_html, $tag_end, $tagmode);
if ($tag =~ /^title$/) { # fix visible text
$code =~ s#(</title>)#EMiR - Event Mappings in Reality ( 1.5)$1#;
$html =~ s/^\s*<title>.*emir__TITLE__\s*-->//m; # remove original
}
$meta .= $tag;
push(@tags_check, $tag);
# p_fieldset() also generates the checkboxes used by the events, but as
# this is outside the <body> tag, they are not visible and most likely
# not accessable using JavaScript's DOM. The checkboxes must be created
# in the body part of the content again, that's why @tags_check is set.
}
$html =~ s/^\s*<meta.*emir__META__\s*-->/$code/m if ('' ne $meta);
_dbx "<frame*> tag";
if (0 == $tagmode) {
$code = '';
foreach my $tag (@tags) {
next if (!grep(/^$tag/, 'frameset'));
# TODO: code only works as expected with a single frame* argument
# only frame or frameset requires the same scope, but no other
# tags hence just the <frameset> scope is printed and then exits
$code = p_frameset($tag);
$html =~ s#^\s*<body.*{ //. emir__META__.*} //. emir__BODY__ -->#$code#m;
print $html;
exit;
}
}
_dbx "checkboxes -- for tags inside <head>";
$code = '';
foreach my $tag (@tags_check) {
$code .= p_fieldset($tag, $tag_notestme, $tag_tag);
}
$html =~ s/^\s*<!--.*emir__CHECK__\s*-->/$code/m if ('' ne $code);
_dbx "tags inside <body>";
$code = '';
foreach my $tag (@tags) {
next if (grep(/^$tag$/, @tags_meta));
next if (grep(/^$tag$/, 'plaintext')); # quick&dirty
next if ((grep(/^$tag$/, 'form')) and (1 == $tagmode)); # TODO; dirty hack
$code .= p_fieldset($tag, $tag_testme, $tagmode);
}
$html =~ s/\s*<!--.*emir__FIELDSET__\s*-->/$code/m if ('' ne $code);
# <plaintext> is obsolte, has no end-tag
if (1==2) {
local $\ = "\n";
my $tag = 'plaintext';
print '';
print '<div><fieldset><span><', $tag, ' LI></span>';
print ' <', $tag, ' id="', $tag, '"';
foreach my $evt (@events) { print ' ', p_event($evt); }
print ">\n";
}
print $html;
exit;
__END__
# following data just as incomplete reminder/example (as used in emir.html 1.42)
my %events_all = (
# note that spelling (case) must be identical in all hashes
'DOMContentLoaded' => 'null',
'DOMFrameContentLoaded'=> 'null',
'DOMMouseScroll' => 'null',
'DOMMenuItemActive' => 'null',
'DOMMenuItemInactive' => 'null',
'FSCommand' => 'null', # SWF only
'formchange' => 'null', # typo? Opera
'forminput' => 'null', # typo? Opera
'invalid' => 'null', # typo? Opera
'msVisibilityChange' => 'null', # IE9 ??
'onAbort' => 'null',
'onActivate' => 'null',
'onAfterPrint' => 'null',
'onAfterUpdate' => 'null',
'onAttrModified' => 'null', # typo?
'onAfterScriptExecute' => 'null', # Firefox >= 4
'onBack' => 'null',
'onBeforeActivate' => 'null',
'onBeforeCopy' => 'null',
'onBeforeCut' => 'null',
'onBeforeDeactivate' => 'null',
'onBeforeEditFocus' => 'null',
'onBeforePaste' => 'null',
'onBeforePrint' => 'null',
'onBeforeScriptExecute'=> 'null', # Firefox >= 4
'onBeforeUnload' => 'null',
'onBeforeUpdate' => 'null',
'onBegin' => 'null',
'onBlur' => 'null',
'onBounce' => 'null',
'onBroadcast' => 'null',
'onCanPlay' => 'null',
'onCanPlayThrough' => 'null',
'onCellChange' => 'null',
'onChange' => 'null',
'onCharacterDataModified' => 'null', # typo?
'onClick' => 'null',
'onClose' => 'null',
'onCommand' => 'null',
'oncontentsave' => 'null', # case-sensitive (IE)
'oncontentready' => 'null', # case-sensitive (IE)
'onCommandUpdate' => 'null',
'onContextMenu' => 'null',
'onControlSelect' => 'null',
'onCopy' => 'null',
'onCut' => 'null',
'onDataAvailable' => 'null',
'onDataSetChanged' => 'null',
'onDataSetComplete' => 'null',
'onDblClick' => 'null',
'onDeactivate' => 'null',
'ondetach' => 'null', # case-sensitive (IE)
'ondocumentready' => 'null', # case-sensitive (IE)
'onDOMActivate' => 'null',
'onDOMAttrModified' => 'null',
'onDOMAttributeNameChanged' => 'null',
'onDOMCharacterDataModified' => 'null',
'onDOMElementNameChanged' => 'null',
'onDOMFocusIn' => 'null',
'onDOMFocusOut' => 'null',
'onDOMNodeInserted' => 'null',
'onDOMNodeInsertedIntoDocument'=> 'null',
'onDOMNodeRemoved' => 'null',
'onDOMNodeRemovedFromDocument' => 'null',
'onDOMSubTreeModified' => 'null',
'onDrag' => 'null',
'onDragDrop' => 'null',
'onDragEnd' => 'null',
'onDragEnter' => 'null',
'onDragExit' => 'null',
'onDragGesture' => 'null',
'onDragLeave' => 'null',
'onDragOver' => 'null',
'onDragStart' => 'null',
'onDrop' => 'null',
'onDurationChange' => 'null',
'onEmtied' => 'null',
'onEnded' => 'null',
'onEnd' => 'null',
'onError' => 'null',
'onErrorUpdate' => 'null',
'onExit' => 'null',
'onFilterChange' => 'null',
'onFinish' => 'null',
'onFocus' => 'null',
'onFocusIn' => 'null',
'onFocusOut' => 'null',
'onFormChange' => 'null',
'onFormInput' => 'null',
'onForward' => 'null',
'ongesturechange' => 'null',
'ongestureend' => 'null',
'ongesturestart' => 'null',
'onHashChange' => 'null',
'onHelp' => 'null',
'onhide' => 'null', # case-sensitive (IE)
'onInput' => 'null',
'onInvalid' => 'null',
'onKeyDown' => 'null',
'onKeyPress' => 'null',
'onKeyUp' => 'null',
'onLayoutComplete' => 'null',
'onLoad' => 'null',
'onLoadedData' => 'null',
'onLoadedMetaData' => 'null',
'onLoadStart' => 'null',
'onLocate' => 'null',
'onLoseCapture' => 'null',
'onMediaComplete' => 'null',
'onMediaError' => 'null',
'onMessage' => 'null',
'onMouseDown' => 'null',
'onMouseDrag' => 'null',
'onMouseEnter' => 'null',
'onMouseLeave' => 'null',
'onMouseMove' => 'null',
'onMouseMultiWheel' => 'null',
'onMouseOut' => 'null',
'onMouseOver' => 'null',
'onMouseUp' => 'null',
'onMouseWheel' => 'null',
'onmove' => 'null', # case-sensitive (IE)
'onMoveEnd' => 'null',
'onMoveStart' => 'null',
'onmsGestureChange' => 'null', # IE9 ??
'onmsGestureDoubleTap' => 'null', # IE9 ??
'onmsGestureEnd' => 'null', # IE9 ??
'onmsGestureHold' => 'null', # IE9 ??
'onmsGestureStart' => 'null', # IE9 ??
'onmsGestureTap' => 'null', # IE9 ??
'onmsSiteModeJumpListitemRemoved' => 'null', # IE9 ??
'onmsSiteModeShowJumpList' => 'null', # IE9 ??
'onmsThumbnailClick' => 'null', # IE9 ??
'onNodeInserted' => 'null', # typo?
'onNodeRemoved' => 'null', # typo?
'onOffline' => 'null',
'onOnline' => 'null',
'onopenstatechanged' => 'null', # case-sensitive (IE)
'onorientationchange' => 'null',
'onOutOfSync' => 'null',
'onOverFlow' => 'null',
'onOverFlowChanged' => 'null',
'onPage' => 'null',
'onPageHide' => 'null',
'onPageShow' => 'null',
'onPaste' => 'null',
'onPause' => 'null',
'onPlay' => 'null',
'onPlaying' => 'null',
'onplaystatechange' => 'null', # case-sensitive (IE)
'onPopState' => 'null',
'onPopupHidden' => 'null',
'onPopupHiding' => 'null',
'onPopupShowing' => 'null',
'onPopupShown' => 'null',
'onProgress' => 'null',
'onPropertyChange' => 'null',
'onRateChange' => 'null',
'onReadyStateChange' => 'null',
'onRedo' => 'null',
'onRepeat' => 'null',
'onReset' => 'null',
'onResize' => 'null',
'onResizeEnd' => 'null',
'onResizeStart' => 'null',
'onResume' => 'null',
'onReverse' => 'null',
'onRowDelete' => 'null', # typo?
'onRowEnter' => 'null',
'onRowExit' => 'null',
'onRowInserted' => 'null', # typo?
'onRowsDelete' => 'null',
'onRowsInserted' => 'null',
'onSave' => 'null',
'onScroll' => 'null',
'onSearch' => 'null',
'onSeek' => 'null',
'onSeeked' => 'null',
'onSeeking' => 'null',
'onSelect' => 'null',
'onSelection' => 'null', # iOS
'onSelectionChange' => 'null',
'onSelectStart' => 'null',
'onShow' => 'null',
'onStalled' => 'null',
'onStart' => 'null',
'onStop' => 'null',
'onStorage' => 'null',
'onStorageCommit' => 'null',
'onSubmit' => 'null',
'onSubTreeModified' => 'null', # typo?
'onSuspend' => 'null',
'onSyncRestored' => 'null',
'onSynchRestored' => 'null', # typo?
'onText' => 'null',
'onTextInput' => 'null',
'onTimeError' => 'null',
'onTimeuout' => 'null',
'onTimeupdate' => 'null',
'ontouchcancel' => 'null', # iOS
'ontouchend' => 'null', # iOS
'ontouchenter' => 'null',
'ontouchmove' => 'null', # iOS
'ontouchleave' => 'null',
'ontouchstart' => 'null', # iOS
'onTrackChange' => 'null',
'onUnderflow' => 'null',
'onUndo' => 'null',
'onUnload' => 'null',
'onURLFlip' => 'null',
'onVolumeChange' => 'null',
'onWaiting' => 'null',
'onWheel' => 'null', # Firefox >= 4
'onXfer_Done' => 'null',
'onwebkitanimationend' => 'null',
'onwebkitanimationiteration' => 'null',
'onwebkitanimationstart' => 'null',
'onwebkittransitionend' => 'null',
'seekSegmentTime' => 'null'
);
my @tags4 = qw(
a
abbr
acronym
address
applet
area
audioscope
b
base
basefont
bdo
bgsound
big
blackface
blink
blockquote
-body
bq
br
button
caption
center
cite
code
col
colgroup
comment
dd
del
dfn
dir
div
dl
dt
em
elements
fieldset
fn
font
form
frame
frameset
h1
head
hr
html
i
iframe
ilayer
img
input
ins
isindex
kbd
label
layer
legend
-li
limittext
link
listing
map
marquee
meta
multicol
nextid
nobr
noframes
noscript
object
ol
optgroup
option
p
param
-plaintext
pre
q
s
samp
script
select
server
shadow
sidebar
small
spacer
span
strike
strong
style
sub
sup
table
tbody
td
textarea
tfoot
th
thead
title
tr
tt
u
ul
var
wbr
xml
xmp
);
my @tags5 = qw(
article
aside
bdi
canvas
command
datalist
dialog
details
embed
figcaption
figure
footer
header
hgroup
keygen
mark
menu
meter
nav
noembed
nosmartquotes
progress
output
rp
rt
ruby
section
source
summary
time
track
video
);