Commit 531039c2 authored by svilayphiou's avatar svilayphiou
Browse files

Moulinette pour transformer le markdow en html via python.

Pour installer:
- faire un venv
- pip install -r requirements.txt

Pour utiliser:
- sourcer le venv
- python moulinette.py avant-propos.md   # Changer le nom du fichier ofcourse
parent b67b8833
Pipeline #586 failed with stages
in 0 seconds
</main>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>ether2html</title>
<!-- UNCOMMENT THE LINE BELOW IF YOU WANT TO START YOUR STYLES FROM SCRATCH, WITHOUT DEFAULT ONES FROM THE BROWSER -->
<!-- <link href="https://meyerweb.com/eric/tools/css/reset/reset.css" rel="stylesheet"> -->
<!-- CHANGE THE URL OF YOUR CSS PAD BELOW -->
<link href="http://pads.osp.kitchen/p/iselp-50-css/export/txt" rel="stylesheet" text="text/css">
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
window.setTimeout(function(){
$.getScript("https://unpkg.com/pagedjs/dist/paged.polyfill.js", function(data, textStatus, jqxhr) {})
});
});
</script>
<!-- This is the default stylesheet of paged.js -->
<style type="text/css" media="screen">:root{--color-background:whitesmoke;--color-pageBox:#666;--color-paper:white;--color-marginBox:transparent}@media screen{body{background-color:var(--color-background)}.pagedjs_pages{display:flex;width:calc(var(--pagedjs-width) * 2);flex:0;flex-wrap:wrap;margin:0 auto}.pagedjs_page{background-color:var(--color-paper);box-shadow:0 0 0 1px var(--color-pageBox);margin:0;flex-shrink:0;flex-grow:0;margin-top:10mm}.pagedjs_first_page{margin-left:var(--pagedjs-width)}.pagedjs_page:last-of-type{margin-bottom:10mm}.pagedjs_margin-bottom,.pagedjs_margin-bottom-center,.pagedjs_margin-bottom-left,.pagedjs_margin-bottom-left-corner-holder,.pagedjs_margin-bottom-right,.pagedjs_margin-bottom-right-corner-holder,.pagedjs_margin-left,.pagedjs_margin-left-bottom,.pagedjs_margin-left-middle,.pagedjs_margin-left-top,.pagedjs_margin-right,.pagedjs_margin-right-bottom,.pagedjs_margin-right-middle,.pagedjs_margin-right-top,.pagedjs_margin-top,.pagedjs_margin-top-center,.pagedjs_margin-top-left,.pagedjs_margin-top-left-corner-holder,.pagedjs_margin-top-right,.pagedjs_margin-top-right-corner-holder{box-shadow:0 0 0 1px inset var(--color-marginBox)}}</style>
</head>
<body>
<main>
import sys
import markdown
from markdown.extensions import Extension
with open("header.html", "r", encoding="utf-8") as input_file:
h = input_file.read()
with open(sys.argv[1], "r", encoding="utf-8") as input_file:
md = input_file.read()
with open("footer.html", "r", encoding="utf-8") as input_file:
f = input_file.read()
o = open(sys.argv[1].replace(".md", ".html"), "w", encoding="utf-8")
md_html = markdown.markdown(md, extension = ["extra",])
o.write("%s \n %s \n %s " % (h, md_html, f))
o.close()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment