Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7406517
MMLTestUtilHTML.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
MMLTestUtilHTML.php
View Options
<?php
namespace
MediaWiki\Extension\Math\WikiTexVC\MMLmappings\Util
;
/**
* This class contains functions to generate a
* HTML File which shows the formula converted to MathML
* by WikiTexVC
* @author Johannes Stegmüller
*/
class
MMLTestUtilHTML
{
public
static
function
generateHTMLtableItem
(
string
$input
,
bool
$bold
=
false
):
string
{
if
(
!
$bold
)
{
return
"<td class=
\"
tg-0lax
\"
>"
.
$input
.
"</td>"
;
}
else
{
return
"<td class=
\"
tg-0lax
\"
>"
.
"<b>"
.
$input
.
"</b>"
.
"</td>"
;
}
}
public
static
function
generateHTMLEnd
(
string
$filePath
,
bool
$active
=
true
)
{
if
(
!
$active
)
{
return
;
}
$file
=
fopen
(
$filePath
,
'a'
);
fwrite
(
$file
,
"</tbody></table>"
);
fclose
(
$file
);
}
public
static
function
generateHTMLtableRow
(
string
$filePath
,
array
$rows
,
bool
$bold
=
false
,
bool
$active
=
true
)
{
if
(
!
$active
)
{
return
;
}
$file
=
fopen
(
$filePath
,
'a'
);
$stringData
=
"<tr>"
;
foreach
(
$rows
as
$row
)
{
$stringData
.=
self
::
generateHTMLtableItem
(
$row
,
$bold
);
}
$stringData
.=
"</tr>"
;
fwrite
(
$file
,
$stringData
);
fclose
(
$file
);
// tbd only open close once for all tests
}
public
static
function
generateHTMLstart
(
string
$filePath
,
array
$headrows
=
[
"name"
,
"Tex-Input"
,
"MathML(MathJax3)"
,
"MathML(WikiTexVC)"
],
bool
$active
=
true
)
{
if
(
!
$active
)
{
return
;
}
$htmlRows
=
""
;
foreach
(
$headrows
as
$header
)
{
$htmlRows
.=
"<th class=
\"
tg-0lax
\"
><b>"
.
$header
.
"</b></th>"
;
}
$file
=
fopen
(
$filePath
,
'w'
);
// or die("error");
$stringData
=
/** @lang HTML */
<<<
HTML
<!
DOCTYPE
html
>
<
html
lang
=
"en"
>
<
head
>
<
meta
charset
=
"utf-8"
>
</
head
>
<
style
>
.
tg
{
border
-
collapse
:
collapse
;
border
-
spacing
:
0
;
}
.
tg
td
{
border
-
color
:
black
;
border
-
style
:
solid
;
border
-
width
:
1
px
;
font
-
family
:
Arial
,
sans
-
serif
;
font
-
size
:
14
px
;
overflow
:
hidden
;
padding
:
10
px
5
px
;
word
-
break
:
normal
;
}
.
tg
th
{
border
-
color
:
black
;
border
-
style
:
solid
;
border
-
width
:
1
px
;
font
-
family
:
Arial
,
sans
-
serif
;
font
-
size
:
14
px
;
font
-
weight
:
normal
;
overflow
:
hidden
;
padding
:
10
px
5
px
;
word
-
break
:
normal
;
}
.
tg
.
tg
-
0
lax
{
text
-
align
:
left
;
vertical
-
align
:
top
}
</
style
>
<
table
class
=
"tg"
>
<
thead
>
<
tr
>{
$htmlRows
}</
tr
>
</
thead
>
<
tbody
>
HTML
;
fwrite
(
$file
,
$stringData
);
fclose
(
$file
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 21, 20:27 (1 d, 9 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
25/44/1a83852fddb88483f5735312f38e
Default Alt Text
MMLTestUtilHTML.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment