Methods

init_html(self, title: str, lang: str, charset='UTF-8', inhead: str = '')

Generates the stat of a html code until the body

<!DOCTYPE html>
<html lang=":param lang:">
<head>
    :param inhead:
    <meta charset=":param charset:">
    <title>:param title:</title>
</head>
<body> {UNTIL HERE}
title title of your html page
lang lang of html
charset lcharset of html
inhead puts content un head
return self
set_filename(self, name: str)
Set the name of output file
simple_down(self, times: int = 1)

This method allows to jump for next line

times Number of tags that you want to go down in a code if negative close tag inline
return self
to_html(self, name: str, path: str = '') -> None

Export to Html

name name of html code with sufix
path path to put code with slash bar
return None
content(self, content: str)

content to main html code

downline(self, times: int = 1)
This method allows to close a tag
times Number of tags that you want to go down in a code
return self
generate(self) -> str
This method generetes the html final code.
import_html(self, style_path, charset='UTF-8') -> None

Import html code from file code

style_path Path to the css code
charset encoding of css code
return self
import_style(self, style_path, encoding='UTF-8')

Import style from css code

style_path Path to the css code
encoding encoding of css code
return self

Dunder methods

__add__(self, other: str)
Add a string into a html, like to append

Use case:

MyPy8TML + str
__call__(self, times: int = 1, inline: str = '-')
Closes the last htm tag, using times to close more than 1 , if negative closes inline

Breaking line:

html = MyPy8TML().p()
print(html.generate())
Inline:
html = MyPy8TML().p(-1)
print(html.generate())
__getitem__(self, item: str)

The way to put content between tags

Param Description
item Any string or a tuple (str, 'in' or 'out')
item[1] if == 'in' put the content inside a tag if == 'out' contents go out

Exemple:

html = MyPy8TML().p['Hello world ! ']
print(html.generate())

In:

html = MyPy8TML().p['class="hello-world"', 'in']
print(html.generate())

Out:

html = MyPy8TML().p['Hello world ! ', 'out']
print(html.generate())

In properties

Use these properties to write into tags

in_content(self, content: str)

Puts content inside a tag

content any kind of content ex: class='just-a-class'
return self
in_accesskey(self, value: str)
in_action(self, value: str)
in_alt(self, value: str)
in_bgcolor(self, value: str)
in_border(self, value: str)
in_cellpadding(self, value: str)
in_cellspacing(self, value: str)
in_class(self, value: str)
in_cols(self, value: str)
in_colspan(self, value: str)
in_for(self, value: str)
in_height(self, value: str)
in_href(self, value: str)
in_id(self, value: str)
in_lang(self, value: str)
in_method(self, value: str)
in_name(self, value: str)
in_rows(self, value: str)
in_rowspan(self, value: str)
in_src(self, value: str)
in_style(self, value: str)
in_tabindex(self, value: str)
in_target(self, value: str)
in_title(self, value: str)
in_type(self, value: str)
in_value(self, value: str)
in_width(self, value: str)

Jinja in properties

jnj(self, expretion)
jnj_add_bootstrap(self)
jnj_block(self, name: str)
jnj_comand(self, comand)
jnj_coment(self, coment)
jnj_elif(self, expretion)
jnj_else(self)
jnj_endblock(self)
jnj_endif(self)
jnj_expretion(self, expretion)
jnj_extends_temp(self, template: str)
jnj_if(self, expretion)
jnj_include_temp(self, template: str)
sdnl = simple_down(self, times: int = 1)


Html tags

All html tags below are properties and return the SELF object.

a
abbr
area
audio
b
body
br
button
canvas
caption
cite
code
col
colgroup
data
datalist
dfn
div
doctype
em
embed
fieldset
footer
form
h1
h2
h3
h4
h5
h6
head
header
html
i
iframe
img
input
kbd
label
legend
li
link
map
mark
meta
meter
nav
noscript
object
optgroup
option
output
p
pre
progress
q
s
samp
script
section
select
slot
small
source
span
strong
style
sub
sup
svg
table
tbody
td
template
textarea
tfoot
th
thead
time
title
tr
track
u
ul
var
video