init avec readme

This commit is contained in:
Tykayn 2024-09-06 11:47:54 +02:00 committed by tykayn
commit 60bc5ca9d0
26 changed files with 1955 additions and 0 deletions

View file

@ -0,0 +1,60 @@
import subprocess
import re
# Fichier Org d'origine
fichier_org = "livre.org"
style_css = "style.css"
# Copie du fichier Org
fichier_org_copie = "livre_org_copie.org"
# Créer une copie du fichier Org
with open(fichier_org, "r") as fichier:
contenu_org = fichier.read()
with open(style_css, "r") as fichier:
contenu_css = fichier.read()
# Compter le nombre de lignes du fichier original
nb_lignes_origine = len(contenu_org.splitlines())
# Supprimer les titres qui ne contiennent pas le tag :title:
contenu_org = re.sub(r"^\*+.*\n", lambda x: x.group() if ":title:" in x.group() else "", contenu_org, flags=re.MULTILINE)
# Effacer toutes les occurences de ":title:"
contenu_org = re.sub(r":title:", "", contenu_org)
# Compter le nombre de lignes du fichier modifié
nb_lignes_modifie = len(contenu_org.splitlines())
# Afficher le nombre de lignes supprimées
nb_lignes_supprimees = nb_lignes_origine - nb_lignes_modifie
print(f"Nombre de lignes supprimées : {nb_lignes_supprimees}")
# Écrire la copie du fichier Org
with open(fichier_org_copie, "w") as fichier:
fichier.write(contenu_org)
print('Convertir la copie du fichier Org en HTML')
# Convertir la copie du fichier Org en HTML
process = subprocess.run(["pandoc", "livre_org_copie.org", "-o", "livre.html"], capture_output=True, text=True)
# Afficher les messages de console du subprocess
print(process.stdout)
print(process.stderr)
# ouvrir le html et insérer le style css
with open("livre.html", "r") as fichier:
contenu_html = fichier.read()
contenu_html = re.sub("</head>", "<style type='text/css' >"+contenu_css+"</style></head>", contenu_org)
with open(fichier_org_copie, "w") as fichier:
fichier.write(contenu_org)
print('Convertir la copie du fichier Org en pdf')
process = subprocess.run(["pandoc", "livre.html", "-o", "livre.pdf"], capture_output=True, text=True)
# Afficher les messages de console du subprocess
print(process.stdout)
print(process.stderr)

View file

@ -0,0 +1,3 @@
#!/bin/bash
emacs --batch --eval "(require 'org)" --eval "(org-export-as-html \"livre.org\" \"livre.html\")"

265
example_livre/index.html Normal file
View file

@ -0,0 +1,265 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2024-09-05 jeu. 11:28 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>livre nom_de_mon_livre</title>
<meta name="author" content="(votre nom)" />
<meta name="generator" content="Org Mode" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
body {
max-width: 80vw;
margin: 1rem auto;
}
#table-of-contents{
font-size: 1rem;
border-left: solid 3px;
padding-left: 1rem;
}
#table-of-contents h2{
font-size: 1rem;
text-align:left;
}
.section-number-2{
display:none;
}
.title sub{
font-size: 1em;
margin-left: 0.5ch;
}
.timestamp{
font-weight:700;
color: crimson;
}
h1 {
color: #111;
font-family: 'Open Sans Condensed', sans-serif;
font-size: 64px;
font-weight: 700;
line-height: 64px;
margin: 0 0 0;
padding: 20px 30px;
text-align: center;
text-transform: uppercase;
}
h2 {
color: #111;
font-family: 'Open Sans Condensed', sans-serif;
font-size: 48px;
font-weight: 700;
line-height: 48px;
margin: 0 0 24px;
padding: 0 30px;
text-align: center;
text-transform: uppercase;
}
p {
color: #111;
font-family: 'Calibri', 'Open Sans', sans-serif;
font-size: 1rem;
line-height: 1.5rem;
margin: 0 0 2rem;
/*columns:3;*/
}
a {
color: #990000;
text-decoration: none;
}
a:hover {
text-decoration: underline
}
.date {
color: #111;
display: block;
font-family: 'Open Sans', sans-serif;
font-size: 16px;
position: relative;
text-align: center;
z-index: 1;
background: white;
}
.date:before {
border-top: 1px solid #111;
content: "";
position: absolute;
top: 0rem;
left: 0;
width: 100%;
z-index: -1;
}
.author {
color: #111;
display: block;
font-family: 'Open Sans', sans-serif;
font-size: 16px;
padding-bottom: 38px;
position: relative;
text-align: center;
z-index: 1;
background: white;
}
.author:before {
border-top: 1px solid #111;
content: "";
position: absolute;
top: 0rem;
left: 0;
width: 100%;
z-index: -1;
}
.date span,
.author span {
background: #fdfdfd;
padding: 0 10px;
text-transform: uppercase;
}
.line {
border-top: 1px solid #111;
display: block;
margin-top: 60px;
padding-top: 50px;
position: relative;
}
.read-more {
-moz-border-radius: 50%;
-moz-transition: all 0.2s ease-in-out;
-webkit-border-radius: 50%;
-webkit-transition: all 0.2s ease-in-out;
background: #111;
border-radius: 50%;
border: 10px solid #fdfdfd;
color: #fff;
display: block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
height: 80px;
line-height: 80px;
margin: -40px 0 0 -40px;
position: absolute;
bottom: 0px;
left: 50%;
text-align: center;
text-transform: uppercase;
width: 80px;
}
.read-more:hover {
background: #990000;
text-decoration: none;
}
.org-src-container{
background: #dedede;
padding:0.5rem;
margin-bottom: 2rem;
}
pre.example{
background: #ccc;
padding: 0.5rem;
margin: 1rem;
}
/*]]>*/-->
</style>
</head>
<body>
<div id="content" class="content">
<h1 class="title">livre nom<sub>de</sub><sub>mon</sub><sub>livre</sub></h1>
<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li><a href="#orgabaee6b">Livre nom<sub>de</sub><sub>mon</sub><sub>livre</sub>&#xa0;&#xa0;&#xa0;<span class="tag"><span class="title">title</span></span></a>
<ul>
<li><a href="#orgbebc8c5">Chapitre 1&#xa0;&#xa0;&#xa0;<span class="tag"><span class="title">title</span></span></a>
<ul>
<li><a href="#org6b1c73f">scène d'exposition</a></li>
</ul>
</li>
<li><a href="#org6b4bb0f">Chapitre 2&#xa0;&#xa0;&#xa0;<span class="tag"><span class="title">title</span></span></a></li>
<li><a href="#org338a36e">Chapitre 3&#xa0;&#xa0;&#xa0;<span class="tag"><span class="title">title</span></span></a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-orgabaee6b" class="outline-2">
<h2 id="orgabaee6b">Livre nom<sub>de</sub><sub>mon</sub><sub>livre</sub>&#xa0;&#xa0;&#xa0;<span class="tag"><span class="title">title</span></span></h2>
<div class="outline-text-2" id="text-orgabaee6b">
</div>
<div id="outline-container-orgbebc8c5" class="outline-3">
<h3 id="orgbebc8c5">Chapitre 1&#xa0;&#xa0;&#xa0;<span class="tag"><span class="title">title</span></span></h3>
<div class="outline-text-3" id="text-orgbebc8c5">
</div>
<div id="outline-container-org6b1c73f" class="outline-4">
<h4 id="org6b1c73f">scène d'exposition</h4>
<div class="outline-text-4" id="text-org6b1c73f">
<p>
blah blah
bleh
</p>
<div class="org-src-container">
<pre class="src src-elisp"> <span style="color: #81A1C1;">(</span><span style="color: #81A1C1;">defun</span> <span style="color: #88C0D0;">org-export-as-html</span> <span style="color: #B48EAD;">(</span><span style="color: #8FBCBB;">&amp;optional</span> async<span style="color: #B48EAD;">)</span>
<span style="color: #B48EAD;">(</span><span style="color: #81A1C1;">interactive</span> <span style="color: #A3BE8C;">"P"</span><span style="color: #B48EAD;">)</span>
<span style="color: #B48EAD;">(</span><span style="color: #81A1C1;">let</span> <span style="color: #A3BE8C;">(</span><span style="color: #5D80AE;">(</span>buffer <span style="color: #8FBCBB;">(</span>current-buffer<span style="color: #8FBCBB;">)</span><span style="color: #5D80AE;">)</span>
<span style="color: #5D80AE;">(</span>with-current-buffer buffer
<span style="color: #8FBCBB;">(</span><span style="color: #81A1C1;">let</span> <span style="color: #81A1C1;">(</span><span style="color: #B48EAD;">(</span>title <span style="color: #A3BE8C;">(</span>plist-get <span style="color: #5D80AE;">(</span>org-inbuffer-options<span style="color: #5D80AE;">)</span> <span style="color: #81A1C1;">:title</span><span style="color: #A3BE8C;">)</span><span style="color: #B48EAD;">)</span><span style="color: #81A1C1;">)</span>
<span style="color: #81A1C1;">(</span>org-export-as-html-to-buffer
<span style="color: #B48EAD;">(</span>concat <span style="color: #A3BE8C;">(</span>buffer-file-name<span style="color: #A3BE8C;">)</span> <span style="color: #A3BE8C;">".html"</span><span style="color: #B48EAD;">)</span>
<span style="color: #B48EAD;">(</span>list <span style="color: #81A1C1;">:title</span> title<span style="color: #B48EAD;">)</span>
async<span style="color: #81A1C1;">)</span>
<span style="color: #81A1C1;">(</span>write-file <span style="color: #B48EAD;">(</span>concat <span style="color: #A3BE8C;">(</span>buffer-file-name<span style="color: #A3BE8C;">)</span> <span style="color: #A3BE8C;">".html"</span><span style="color: #B48EAD;">)</span><span style="color: #81A1C1;">)</span><span style="color: #8FBCBB;">)</span><span style="color: #5D80AE;">)</span><span style="color: #A3BE8C;">)</span><span style="color: #B48EAD;">)</span>
<span style="color: #81A1C1;">)</span>
</pre>
</div>
<p>
1111111111111111
</p>
</div>
</div>
</div>
<div id="outline-container-org6b4bb0f" class="outline-3">
<h3 id="org6b4bb0f">Chapitre 2&#xa0;&#xa0;&#xa0;<span class="tag"><span class="title">title</span></span></h3>
<div class="outline-text-3" id="text-org6b4bb0f">
<p>
2222222222222
</p>
</div>
</div>
<div id="outline-container-org338a36e" class="outline-3">
<h3 id="org338a36e">Chapitre 3&#xa0;&#xa0;&#xa0;<span class="tag"><span class="title">title</span></span></h3>
<div class="outline-text-3" id="text-org338a36e">
<p>
33333333333333333
</p>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: (votre nom)</p>
<p class="date">Created: 2024-09-05 jeu. 11:28</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>

View file

48
example_livre/livre.org Normal file
View file

@ -0,0 +1,48 @@
:PROPERTIES:
:ID: 1b3c6217-f565-42d9-b16b-db11644f6121
:END:
#+title: livre example_livre
#+AUTHOR: (votre nom)
#+EMAIL: votre@email.com
#+BEGIN_EXPORT epub
:title "Mon livre"
:author "Votre nom"
:email "votre@email.com"
:language "fr"
:encoding "UTF-8"
:subject "Littérature"
:description "Ceci est un livre écrit en Org-mode"
:keywords "Org-mode, livre, électronique"
:cover "image/cover.jpg"
#+END_EXPORT
* Livre nom_de_mon_livre :title:
** préambule du cul
eeeeeeeeeeeeeeeeeeeee préambule du cul eeeeeeeeeeeeeeeeee
ne devrait pas avoir de titre
** Chapitre 0
--------------
là non plus pas de titre à afficher
-------------
** Chapitre 1 :title:
celui là on doit le voir: chapitre 1 au dessus ici.
Dans un monde lointain, il y avait une île mystérieuse où les arbres avaient des feuilles qui brillaient comme des étoiles. Un jeune aventurier nommé Eryndor y arriva un jour, attiré par les légendes de l'île. Il découvrit un temple caché où les dieux anciens avaient laissé des secrets et des pouvoirs magiques.
*** scène d'exposition
blah blah
bleh
Eryndor trouva un cristal qui lui permit de communiquer avec les esprits de la nature. Avec leur aide, il put vaincre les ténèbres qui menaçaient l'île et restaurer la lumière éternelle. L'île fut sauvée et Eryndor devint un héros légendaire.
1111111111111111
** Chapitre 2 :title:
2222222222222
#+begin_comment
ouaish heuuuu
commentaire làààà
#+end_comment
** Chapitre 3 :title:
33333333333333333

View file

@ -0,0 +1,45 @@
:PROPERTIES:
:ID: 1b3c6217-f565-42d9-b16b-db11644f6121
:END:
#+title: livre example_livre
#+AUTHOR: (votre nom)
#+EMAIL: votre@email.com
#+BEGIN_EXPORT epub
:title "Mon livre"
:author "Votre nom"
:email "votre@email.com"
:language "fr"
:encoding "UTF-8"
:subject "Littérature"
:description "Ceci est un livre écrit en Org-mode"
:keywords "Org-mode, livre, électronique"
:cover "image/cover.jpg"
#+END_EXPORT
* Livre nom_de_mon_livre
eeeeeeeeeeeeeeeeeeeee préambule du cul eeeeeeeeeeeeeeeeee
ne devrait pas avoir de titre
--------------
là non plus pas de titre à afficher
-------------
** Chapitre 1
celui là on doit le voir: chapitre 1 au dessus ici.
Dans un monde lointain, il y avait une île mystérieuse où les arbres avaient des feuilles qui brillaient comme des étoiles. Un jeune aventurier nommé Eryndor y arriva un jour, attiré par les légendes de l'île. Il découvrit un temple caché où les dieux anciens avaient laissé des secrets et des pouvoirs magiques.
blah blah
bleh
Eryndor trouva un cristal qui lui permit de communiquer avec les esprits de la nature. Avec leur aide, il put vaincre les ténèbres qui menaçaient l'île et restaurer la lumière éternelle. L'île fut sauvée et Eryndor devint un héros légendaire.
1111111111111111
** Chapitre 2
2222222222222
#+begin_comment
ouaish heuuuu
commentaire làààà
#+end_comment
** Chapitre 3
33333333333333333

View file

@ -0,0 +1,9 @@
:PROPERTIES:
:ID: 0effcaac-f8af-42be-8537-d11f885097a7
:END:
#+title: notes d'intention de example_livre
* Notes d'intention
** Thématiques globales
** Sources d'inspiration

View file

@ -0,0 +1,20 @@
:PROPERTIES:
:ID: 8aa3fa3c-b897-4c17-9bc1-4ee232e738a3
:END:
#+title: personnages de example_livre
* Personnages
** Bob
- nom: Bob l'éponge
- personnalité:
- objectifs:
** Carlo
- nom: Carlo Squidward
- personnalité:
- objectifs:
** Krabs
- nom: Reginald Krabs
- personnalité:
- objectifs:

169
example_livre/style.css Normal file
View file

@ -0,0 +1,169 @@
body {
max-width: 80vw;
margin: 1rem auto;
}
#table-of-contents {
font-size: 1rem;
border-left: solid 3px;
padding-left: 1rem;
}
#table-of-contents h2 {
font-size: 1rem;
text-align: left;
}
.section-number-2 {
display: none;
}
.title sub {
font-size: 1em;
margin-left: 0.5ch;
}
.timestamp {
font-weight: 700;
color: crimson;
}
h1 {
color: #111;
font-family: 'Open Sans Condensed', sans-serif;
font-size: 64px;
font-weight: 700;
line-height: 64px;
margin: 0 0 0;
padding: 20px 30px;
text-align: center;
text-transform: uppercase;
}
h2 {
color: #111;
font-family: 'Open Sans Condensed', sans-serif;
font-size: 48px;
font-weight: 700;
line-height: 48px;
margin: 0 0 24px;
padding: 0 30px;
text-align: center;
text-transform: uppercase;
}
p {
color: #111;
font-family: 'Calibri', 'Open Sans', sans-serif;
font-size: 1rem;
line-height: 1.5rem;
margin: 0 0 2rem;
/*columns:3;*/
}
a {
color: #990000;
text-decoration: none;
}
a:hover {
text-decoration: underline
}
.date {
color: #111;
display: block;
font-family: 'Open Sans', sans-serif;
font-size: 16px;
position: relative;
text-align: center;
z-index: 1;
background: white;
}
.date:before {
border-top: 1px solid #111;
content: "";
position: absolute;
top: 0rem;
left: 0;
width: 100%;
z-index: -1;
}
.author {
color: #111;
display: block;
font-family: 'Open Sans', sans-serif;
font-size: 16px;
padding-bottom: 38px;
position: relative;
text-align: center;
z-index: 1;
background: white;
}
.author:before {
border-top: 1px solid #111;
content: "";
position: absolute;
top: 0rem;
left: 0;
width: 100%;
z-index: -1;
}
.date span,
.author span {
background: #fdfdfd;
padding: 0 10px;
text-transform: uppercase;
}
.line {
border-top: 1px solid #111;
display: block;
margin-top: 60px;
padding-top: 50px;
position: relative;
}
.read-more {
-moz-border-radius: 50%;
-moz-transition: all 0.2s ease-in-out;
-webkit-border-radius: 50%;
-webkit-transition: all 0.2s ease-in-out;
background: #111;
border-radius: 50%;
border: 10px solid #fdfdfd;
color: #fff;
display: block;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
height: 80px;
line-height: 80px;
margin: -40px 0 0 -40px;
position: absolute;
bottom: 0px;
left: 50%;
text-align: center;
text-transform: uppercase;
width: 80px;
}
.read-more:hover {
background: #990000;
text-decoration: none;
}
.org-src-container {
background: #dedede;
padding: 0.5rem;
margin-bottom: 2rem;
}
pre.example {
background: #ccc;
padding: 0.5rem;
margin: 1rem;
}