Example #1
0
	ct=[]
	for h in div.findAll(["h2","h3","h4","h5","h6"]):
		c=int(h.name[1])
		aux=[x for x in ct if x<c]
		if len(aux)>0:
			a=aux[-1]+1
			if a<c:
				flag=True
				h.name="h"+str(a)
		ct.append(c)
	if flag:
		fix_h(div)

oht="out/tecmint.html"

out = util.get_tpt("LFCS and LFCE by tecmint.com","rec/tecmint.css")
h1=out.new_tag("h1")
h1.string="LFCS"
out.body.div.append(h1)

index=True
flag=0
part=re.compile(u"\s*[\-–—]\s*Part\s+\w+$", re.UNICODE | re.IGNORECASE)
for url in urls:
	if not url.startswith("http"):
		hr=out.new_tag("div")
		hr.attrs["class"]="h0"
		hr.string=url
		out.body.div.append(hr)
		continue
Example #2
0
def set_anchor(i,ca):
	a=soup.new_tag("a", **{"href": "#"+i.attrs['id'], "title":u"Cápitulo "+str(ca)})
	if i.name=="fieldset":
		i=i.legend
	a.string=i.string
	i.string=""
	i.attrs["class"]="item"
	i.append(a)

def get_lab(f,txt):
	a=soup.new_tag("a",  **{"href": "labs/"+f, "title":"Fichero original en: https://lms.360training.com/custom/12396/808239/"+f})
	a.string=txt
	return a

soup = util.get_tpt("LFS201","rec/lfs201.css")

fldB=None
divCp=None

hts=sorted(glob.glob('html/clean/*.html'))
for ht in hts:
	soup2 = util.get_soup(ht)
	t=soup2.title
	b=soup2.body

	if "_popup" in ht:
		n=3
	else:
		ca=int(cp.sub("\\1",ht))
		if ca>caB: