#XWI MODULE
#BY ATLAS COMPUTER
#Shearching company, Subsidiary of Solaris Softaware Software
#creator: jesteraexy@gmail.com
#We don't try to compete with
#the other modules, we bring
#just ours
#warning if your init docCreat and initCss he overwriting index.html and style.css file 


author = "Flow Lord"
doc = '''
WELCOM TO XWI !
------------------------------------
[WARNING] if your init docCreat and initCss he overwriting index.html and style.css file 
------------------------------------
version: 1.2

create and modify a cascading stylesheet file (CSS3)

creat html file
	docCreat()

creat css file
	cssInit()

close css file
	cssclose()

open / close balise propretie
	initag(balise,OPEN/CLOSE)

balise_name(integer value)
balise_name(string value)

execption:
manybalise(liste type)

exemple

docCreat()

cssInit()

initag('body','open')
padding(25)
margin(3)
bg('#000')
color('#fff')
initag('body','open')

initag('header','open')
bg('tomato')
color('#fff')
initag('header','close')

cssclose()

current error:
	padding('25px') NON ---> padding(25)
	font-size(12) NON ---> font_size(12)
	
--------------------------------
all balises available
--------------------------------
width(int)
height(int)
padding(int)
margin(int)
bg(str)
color(str)
font_size(int)
font_familly(str)
opacity(int)
text-decoration(str)
position(str)
z_index(int)
text-align(str)
border(integer value,type,color)
borderradius(int)
bordercolor(str)
bgimage(str)
display(str)
float_cotent(str)
'''


htm = '''<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
<header>
<h1> XWI CSS MODULE </h1>
</header>

<h2> Text exemple </h2>
<p> XWI CSS est un module qui permet de faire du html avec un script python</p>

<footer>
<h3> Generated by @XWI Python </h3>
</footer>'''

def docCreat():
	f = open('index.html','w', encoding='utf-8')
	f.write(htm)
	f.close()

def cssInit():
	f = open('style.css','w',encoding='utf-8')

def cssclose():
	f = open('style.css','r',encoding='utf-8')
	f.close()

def initag(tagname,co):
	f = open('style.css','a')
	if co == 'open':
		f.write(tagname+'{\n')
	elif co == 'close':
		f.write('}\n\n')

def manybalise(list,co):
	tag = ''
	f = open('style.css','a')
	if co == 'open':
		c = 0
		for e in list:
			tag  = tag + e + ','
		f.write(tag+'{\n')
	elif co == 'close':
		f.write('}\n\n')

def width(x):
	f = open('style.css','a')
	f.write(f'\twidth: {x}px;\n')

def height(x):
	f = open('style.css','a')
	f.write(f'\theight: {x}px;\n')

def padding(x):
	f = open('style.css','a')
	f.write('\tpadding: '+str(x)+'px;\n')
	
def margin(x):
	f = open('style.css','a')
	f.write('\tmargin: '+str(x)+'px;\n')

def opacity(x):
	f = open('style.css','a')
	f.write('\topacity: '+str(x)+'%;\n')

def position(pos):
	f = open('style.css','a')
	f.write('\tposition: '+pos+';\n')

def text_decoration(td):
	f = open('style.css','a')
	f.write('\ttext-decoration: '+td+';\n')

def z_index(x):
	f = open('style.css','a')
	f.write('\tz-index: '+str(x)+'px;\n')

def font_size(x):
	f = open('style.css','a')
	f.write('\tfont-size: '+str(x)+'px;\n')

def font_familly(police):
	list_police = ['Georgia','serif','sans-serif','cursive','system-ui','fantasy','emoji','math','fangsong','inherit','initial','unset']
	f = open('style.css','a')
	if police in list_police:
		f.write('\tfont-family: '+police+';\n')
	else:
		f.write(f'\tfont-family: "{police}"; ')
	f.close()

def text_align(txt):
	f = open('style.css','a')
	f.write('\ttext-align: '+txt+';\n')
	
def border(px,type,color):
	f = open('style.css','a')
	f.write(f'\tborder: {str(px)}px {type} {color};\n')

def bg(color):
	f = open('style.css','a')
	f.write(f'\tbackground-color: {color};\n')

def color(color):
	f = open('style.css','a')
	f.write(f'\tcolor: {color};\n')

def bgimage(img):
	f = open('style.css','a')
	f.write(f'\tbackground-image: url("{img}");\n')

def bordercolor(color):
	f = open('style.css','a')
	f.write(f'\tborder-color: {color};\n')

def borderradius(color):
	f = open('style.css','a')
	f.write(f'\tborder-radius: {color}%;\n')

def display(type):
	f = open('style.css','a')
	f.write(f'\display: {type};\n')

def float_content(x):
	f = open('style.css','a')
	f.write(f'\tfloat: {x};\n')



