## CSS obscure rule: margin-top of
#!/usr/bin/python
# -*- coding: utf-8 -*-
import feedparser
from bs4 import BeautifulSoup
def main():
# url du flux rss
tpsreac_feed_url = "https://tempsdereaction.wordpress.com/feed/"
# on aspire le flux rss avec feedparser
tpsreac_feeds = feedparser.parse(tpsreac_feed_url)
# base template du fichier html
base = "<html><head></head><body></body></html>"
# create dom for html file base
base_dom = BeautifulSoup(base, 'html.parser')
# page base template
page_base = "<section class='page'></section>"
# boucle sur les entrées racine du flux
for key in tpsreac_feeds:
print(key)
# on boucle sur les entrées du flux rss
for entrie in tpsreac_feeds['entries']:
print('- - - - -',entrie['title'])
# just display entrie keys
for key in entrie:
print(key)
# entries.extend( feed[ "items" ] )
# create page dom
p_dom = BeautifulSoup(page_base, 'html.parser')
# add content in page dom
p_dom.section.append(entrie['summary'])
# add newly created page dom to html dom
base_dom.body.append(p_dom)
# create main html file from filled base html dom
with open("index.html", 'w') as fp:
fp.write(base_dom.prettify(formatter=None))
if __name__ == "__main__":
main()
h3(#python-pandoc-and-template). python pandoc and template
https://figureslibres.io/gogs/bachir/gitbook-html2print
#!/usr/bin/python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import pypandoc
def main():
# create main html dom from template
template_f = open("templates/main.tpl.html", "r")
template_html = template_f.read()
template_dom = BeautifulSoup(template_html, 'html.parser')
pdoc_args = ['--mathjax',
'--smart']
pdoc_filters = []
output = pypandoc.convert_file("lechemin/de/monfichier.md",
to='html5',
format='markdown+header_attributes+link_attributes+bracketed_spans',
extra_args=pdoc_args,
filters=pdoc_filters)
# outputfile=out_f)
# print("output :\n"+output)
output_dom = BeautifulSoup(output, 'html.parser')
template_dom.append(output_dom)
# create main html file from filled template html dom
html_f = 'monfichier.html'
with open(html_f, 'w') as fp:
fp.write(template_dom.prettify(formatter=None))
if __name__ == "__main__":
main()
h2(#ajuster-une-image). Ajuster une image
voir https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit et https://developer.mozilla.org/en-US/docs/Web/CSS/object-position
h2(#css-regions). CSS regions
h1(#flow-main). flow-main {
bc. -webkit-flow-into: flow-main;
flow-into: flow-main;
}
.flow-main { -webkit-flow-from: flow-main; flow-from: flow-main; }
ex: https://jsfiddle.net/asmqaheq/