File: partialdetag.proc

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (138 lines) | stat: -rw-r--r-- 7,603 bytes parent folder | download | duplicates (3)
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
!! replace prohibited word for prevent HTML and JavaScript Injection
!! see code injection samples here : https://www.codeproject.com/Articles/134024/HTML-and-JavaScript-Injection
!! all prohibited words must be set without CAPS
!! wims_read_parm input
!! word 1: two option words are possible:
!!  - file (to make process on a file)
!!  - variable (to make process on the content of script_data_input,
!!    the result is in script_data_output)
!! word 2: (only if word 1 is file) is the name of the input file
!! word 3: (only if word 1 is file) is the name of the output file
!! additionnal word option can be pass in script_option:
!!  - the word option "allowlink" means that the html links are left
!!  as they are.

!! Warning this script should be use after msg2wims to protect tex formula

!! PS: there is a file named check_partialdetag in wimstest directory
!!  with some general tests of the process.

!if allowlink notwordof $script_option
  list_replace=/^\s*!insmath /!s/\shref\s*=/\ href\=/gi;\
/^ *!insmath /!s/<\s*a /\&lt;a /gi;\
/^ *!insmath /!s/<\s*\/\s*a\s*>/\&lt;\/a>/gi;
!else
  list_replace=$empty
!endif
list_replace=!append line /^ *!insmath /!s/<\s*script\s*>/\&lt;script>/gi;\
/^ *!insmath /!s/<\s*form\s*>/\&lt;form>/gi;\
/^ *!insmath /!s/<\s*meta\s*/\&lt;meta /gi;\
/^ *!insmath /!s/<\s*\/\s*script\s*>/\&lt;\/script>/gi;\
/^ *!insmath /!s/<\s*\/\s*form\s*>/\&lt;\/form>/gi;\
/^ *!insmath /!s/behavior:/\&#98;ehavior\&#58;/gi;\
/^ *!insmath /!s/javascript:/\&#106;avascript\&#58;/gi;\
/^ *!insmath /!s/\s*onabort\s*=/ \&#111;nabort\&#61;/gi;\
/^ *!insmath /!s/\s*class\s*=/ \&#99;lass\&#61;/gi;\
/^ *!insmath /!s/\s*onafterprint\s*=/ \&#111;nafterprint\&#61;/gi;\
/^ *!insmath /!s/\s*onanimationend\s*=/ \&#111;nanimationend\&#61;/gi;\
/^ *!insmath /!s/\s*onanimationiteration\s*=/ \&#111;nanimationiteration\&#61;/gi;\
/^ *!insmath /!s/\s*onanimationstart\s*=/ \&#111;nanimationstart\&#61;/gi;\
/^ *!insmath /!s/\s*onbeforeprint\s*=/ \&#111;nbeforeprint\&#61;/gi;\
/^ *!insmath /!s/\s*onbeforeunload\s*=/ \&#111;nbeforeunload\&#61;/gi;\
/^ *!insmath /!s/\s*onblur\s*=/ \&#111;nblur\&#61;/gi;\
/^ *!insmath /!s/\s*oncanplay\s*=/ \&#111;ncanplay\&#61;/gi;\
/^ *!insmath /!s/\s*oncanplaythrough\s*=/ \&#111;ncanplaythrough\&#61;/gi;\
/^ *!insmath /!s/\s*onchange\s*=/ \&#111;nchange\&#61;/gi;\
/^ *!insmath /!s/\s*onclick\s*=/ \&#111;nclick\&#61;/gi;\
/^ *!insmath /!s/\s*oncontextmenu\s*=/ \&#111;ncontextmenu\&#61;/gi;\
/^ *!insmath /!s/\s*oncopy\s*=/ \&#111;ncopy\&#61;/gi;\
/^ *!insmath /!s/\s*oncut\s*=/ \&#111;ncut\&#61;/gi;\
/^ *!insmath /!s/\s*ondblclick\s*=/ \&#111;ndblclick\&#61;/gi;\
/^ *!insmath /!s/\s*ondrag\s*=/ \&#111;ndrag\&#61;/gi;\
/^ *!insmath /!s/\s*ondragend\s*=/ \&#111;ndragend\&#61;/gi;\
/^ *!insmath /!s/\s*ondragenter\s*=/ \&#111;ndragenter\&#61;/gi;\
/^ *!insmath /!s/\s*ondragleave\s*=/ \&#111;ndragleave\&#61;/gi;\
/^ *!insmath /!s/\s*ondragover\s*=/ \&#111;ndragover\&#61;/gi;\
/^ *!insmath /!s/\s*ondragstart\s*=/ \&#111;ndragstart\&#61;/gi;\
/^ *!insmath /!s/\s*ondrop\s*=/ \&#111;ndrop\&#61;/gi;\
/^ *!insmath /!s/\s*ondurationchange\s*=/ \&#111;ndurationchange\&#61;/gi;\
/^ *!insmath /!s/\s*onended\s*=/ \&#111;nended\&#61;/gi;\
/^ *!insmath /!s/\s*onerror\s*=/ \&#111;nerror\&#61;/gi;\
/^ *!insmath /!s/\s*onfocus\s*=/ \&#111;nfocus\&#61;/gi;\
/^ *!insmath /!s/\s*onfocusin\s*=/ \&#111;nfocusin\&#61;/gi;\
/^ *!insmath /!s/\s*onfocusout\s*=/ \&#111;nfocusout\&#61;/gi;\
/^ *!insmath /!s/\s*onfullscreenchange\s*=/ \&#111;nfullscreenchange\&#61;/gi;\
/^ *!insmath /!s/\s*onfullscreenerror\s*=/ \&#111;nfullscreenerror\&#61;/gi;\
/^ *!insmath /!s/\s*onhashchange\s*=/ \&#111;nhashchange\&#61;/gi;\
/^ *!insmath /!s/\s*oninput\s*=/ \&#111;ninput\&#61;/gi;\
/^ *!insmath /!s/\s*oninvalid\s*=/ \&#111;ninvalid\&#61;/gi;\
/^ *!insmath /!s/\s*onkeydown\s*=/ \&#111;nkeydown\&#61;/gi;\
/^ *!insmath /!s/\s*onkeypress\s*=/ \&#111;nkeypress\&#61;/gi;\
/^ *!insmath /!s/\s*onkeyup\s*=/ \&#111;nkeyup\&#61;/gi;\
/^ *!insmath /!s/\s*onload\s*=/ \&#111;nload\&#61;/gi;\
/^ *!insmath /!s/\s*onloadeddata\s*=/ \&#111;nloadeddata\&#61;/gi;\
/^ *!insmath /!s/\s*onloadedmetadata\s*=/ \&#111;nloadedmetadata\&#61;/gi;\
/^ *!insmath /!s/\s*onloadstart\s*=/ \&#111;nloadstart\&#61;/gi;\
/^ *!insmath /!s/\s*onmessage\s*=/ \&#111;nmessage\&#61;/gi;\
/^ *!insmath /!s/\s*onmousedown\s*=/ \&#111;nmousedown\&#61;/gi;\
/^ *!insmath /!s/\s*onmouseenter\s*=/ \&#111;nmouseenter\&#61;/gi;\
/^ *!insmath /!s/\s*onmouseleave\s*=/ \&#111;nmouseleave\&#61;/gi;\
/^ *!insmath /!s/\s*onmousemove\s*=/ \&#111;nmousemove\&#61;/gi;\
/^ *!insmath /!s/\s*onmouseover\s*=/ \&#111;nmouseover\&#61;/gi;\
/^ *!insmath /!s/\s*onmouseout\s*=/ \&#111;nmouseout\&#61;/gi;\
/^ *!insmath /!s/\s*onmouseup\s*=/ \&#111;nmouseup\&#61;/gi;\
/^ *!insmath /!s/\s*onmousewheel\s*=/ \&#111;nmousewheel\&#61;/gi;\
/^ *!insmath /!s/\s*onoffline\s*=/ \&#111;noffline\&#61;/gi;\
/^ *!insmath /!s/\s*ononline\s*=/ \&#111;nonline\&#61;/gi;\
/^ *!insmath /!s/\s*onopen\s*=/ \&#111;nopen\&#61;/gi;\
/^ *!insmath /!s/\s*onpagehide\s*=/ \&#111;npagehide\&#61;/gi;\
/^ *!insmath /!s/\s*onpageshow\s*=/ \&#111;npageshow\&#61;/gi;\
/^ *!insmath /!s/\s*onpaste\s*=/ \&#111;npaste\&#61;/gi;\
/^ *!insmath /!s/\s*onpause\s*=/ \&#111;npause\&#61;/gi;\
/^ *!insmath /!s/\s*onplay\s*=/ \&#111;nplay\&#61;/gi;\
/^ *!insmath /!s/\s*onplaying\s*=/ \&#111;nplaying\&#61;/gi;\
/^ *!insmath /!s/\s*onpopstate\s*=/ \&#111;npopstate\&#61;/gi;\
/^ *!insmath /!s/\s*onprogress\s*=/ \&#111;nprogress\&#61;/gi;\
/^ *!insmath /!s/\s*onratechange\s*=/ \&#111;nratechange\&#61;/gi;\
/^ *!insmath /!s/\s*onresize\s*=/ \&#111;nresize\&#61;/gi;\
/^ *!insmath /!s/\s*onreset\s*=/ \&#111;nreset\&#61;/gi;\
/^ *!insmath /!s/\s*onscroll\s*=/ \&#111;nscroll\&#61;/gi;\
/^ *!insmath /!s/\s*onsearch\s*=/ \&#111;nsearch\&#61;/gi;\
/^ *!insmath /!s/\s*onseeked\s*=/ \&#111;nseeked\&#61;/gi;\
/^ *!insmath /!s/\s*onseeking\s*=/ \&#111;nseeking\&#61;/gi;\
/^ *!insmath /!s/\s*onselect\s*=/ \&#111;nselect\&#61;/gi;\
/^ *!insmath /!s/\s*onshow\s*=/ \&#111;nshow\&#61;/gi;\
/^ *!insmath /!s/\s*onstalled\s*=/ \&#111;nstalled\&#61;/gi;\
/^ *!insmath /!s/\s*onstorage\s*=/ \&#111;nstorage\&#61;/gi;\
/^ *!insmath /!s/\s*onsubmit\s*=/ \&#111;nsubmit\&#61;/gi;\
/^ *!insmath /!s/\s*onsuspend\s*=/ \&#111;nsuspend\&#61;/gi;\
/^ *!insmath /!s/\s*ontimeupdate\s*=/ \&#111;ntimeupdate\&#61;/gi;\
/^ *!insmath /!s/\s*ontoggle\s*=/ \&#111;ntoggle\&#61;/gi;\
/^ *!insmath /!s/\s*ontouchcancel\s*=/ \&#111;ntouchcancel\&#61;/gi;\
/^ *!insmath /!s/\s*ontouchend\s*=/ \&#111;ntouchend\&#61;/gi;\
/^ *!insmath /!s/\s*ontouchmove\s*=/ \&#111;ntouchmove\&#61;/gi;\
/^ *!insmath /!s/\s*ontouchstart\s*=/ \&#111;ntouchstart\&#61;/gi;\
/^ *!insmath /!s/\s*ontransitionend\s*=/ \&#111;ntransitionend\&#61;/gi;\
/^ *!insmath /!s/\s*onunload\s*=/ \&#111;nunload\&#61;/gi;\
/^ *!insmath /!s/\s*onvolumechange\s*=/ \&#111;nvolumechange\&#61;/gi;\
/^ *!insmath /!s/\s*onwaiting\s*=/ \&#111;nwaiting\&#61;/gi;\
/^ *!insmath /!s/\s*onwheel\s*=/ \&#111;nwheel\&#61;/gi to $list_replace


!distribute word $wims_read_parm into option_,file_,ofile_
!default ofile_=$file_
!if $option_=file
  !sh mkdir -p $wims_home/tmp/sessions/$wims_session/ ;\
sed '$list_replace' $file_ > $wims_home/tmp/sessions/$wims_session/partialdetag.tmp;\
mv $wims_home/tmp/sessions/$wims_session/partialdetag.tmp $ofile_;
  !exit
!endif

!if $option_=variable
  !writefile wimshome/s2/$wims_session/tmpdetag $script_data_input
  script_data_output=!sh sed '$list_replace' $wims_home/s2/$wims_session/tmpdetag;\
rm -f $wims_home/s2/$wims_session/tmpdetag;
  !exit
!endif

!reset script_option