Commit 73f2ae9d128127ad7420fcd924d18cd7351da1f5
0 parents
Outils de rédaction
Showing
9 changed files
with
339 additions
and
0 deletions
Show diff stats
1 | +++ a/7seg.svg | |
... | ... | @@ -0,0 +1,22 @@ |
1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
2 | +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | |
3 | +<svg xmlns="http://www.w3.org/2000/svg" width="192px" height="320px" viewBox="-1 -1 12 20"> | |
4 | +<g id="none" style="fill-rule:evenodd; stroke:#FFFFFF; stroke-width:0.25; stroke-opacity:1; stroke-linecap:butt; stroke-linejoin:miter;"> | |
5 | + <polygon id="a" points=" 1, 1 2, 0 8, 0 9, 1 8, 2 2, 2" fill="#DDDDDD"/> | |
6 | + <polygon id="b" points=" 9, 1 10, 2 10, 8 9, 9 8, 8 8, 2" fill="#DDDDDD"/> | |
7 | + <polygon id="c" points=" 9, 9 10,10 10,16 9,17 8,16 8,10" fill="#DDDDDD"/> | |
8 | + <polygon id="d" points=" 9,17 8,18 2,18 1,17 2,16 8,16" fill="#DDDDDD"/> | |
9 | + <polygon id="e" points=" 1,17 0,16 0,10 1, 9 2,10 2,16" fill="#DDDDDD"/> | |
10 | + <polygon id="f" points=" 1, 9 0, 8 0, 2 1, 1 2, 2 2, 8" fill="#DDDDDD"/> | |
11 | + <polygon id="g" points=" 1, 9 2, 8 8, 8 9, 9 8,10 2,10" fill="#DDDDDD"/> | |
12 | +</g> | |
13 | +<g style="fill-rule:evenodd; stroke:none;font-size:2px; font-family:Arial,sans-serif; font-weight:bold;text-anchor:middle;"> | |
14 | + <text x="5" y="1.6">a</text> | |
15 | + <text x="9" y="5.6">b</text> | |
16 | + <text x="9" y="13.6">c</text> | |
17 | + <text x="5" y="17.7">d</text> | |
18 | + <text x="1" y="13.6">e</text> | |
19 | + <text x="1" y="5.6">f</text> | |
20 | + <text x="5" y="9.4">g</text> | |
21 | +</g> | |
22 | +</svg> | ... | ... |
1 | +++ a/CR.md | |
... | ... | @@ -0,0 +1,36 @@ |
1 | +# Tutorat de microprocesseurs - Sujet 8 - Thermostat | |
2 | +## DJERABA Taky - HUBERT Thomas - PREUD'HOMME Geoffrey | |
3 | + | |
4 | +# Brouillon | |
5 | + | |
6 | +Wouhou, on peut écrire en **gras** et en *italique*, des ~~conneries~~ bêtises, écrire des formules très complexes telles que $ax^2+bx+c=0$ et écrire du `petit code` et du gros code ! | |
7 | + | |
8 | +```avrasmplus | |
9 | +.equ RAMEND = 0x21FF | |
10 | +.equ SPH = 0x3E ; initialisation de la pile | |
11 | +.equ SPL = 0x3D | |
12 | + | |
13 | +.org 0x000 | |
14 | + ; Vecteur RESET | |
15 | + jmp debut | |
16 | + | |
17 | +.org 0x0080 | |
18 | + | |
19 | +debut: | |
20 | + ldi r16,0xFF ; On configure les ports A et B en sortie | |
21 | + out DDRA,r16 | |
22 | + out DDRB,r16 | |
23 | + r17 <- 0b00000001 ; 8 places de chenillard | |
24 | +``` | |
25 | + | |
26 | +Il faut passer une ligne pour faire un nouveau paragraphe. | |
27 | +Sinon ça marche pas. | |
28 | + | |
29 | +Là oui. | |
30 | + | |
31 | +On peut intégrer des images | |
32 | + | |
33 | +![Afficheur 7 segments](7seg.svg) | |
34 | + | |
35 | +<!-- Et des commentaires aussi ! --> | |
36 | +<!-- TODO Enlever ce brouillon --> | ... | ... |
1 | +++ a/Makefile | |
... | ... | @@ -0,0 +1,20 @@ |
1 | +.PHONY: default cleantmp clean | |
2 | + | |
3 | +default: $(subst md,pdf,$(wildcard *.md)) | |
4 | + | |
5 | +SOURCES=$(wildcard *.asm) $(wildcard *.txt) | |
6 | + | |
7 | +%.pdf: %.html | |
8 | + ./html2pdf -i "$<" -o "$@" -t "Tutorat de microprocesseurs S6 - TD1 Sujet 8" | |
9 | + | |
10 | +%.html: %.tmp template.html | |
11 | + ./md2html -i "$<" -o "$@" -t template.html | |
12 | + | |
13 | +%.tmp: %.md $(SOURCES) | |
14 | + markedpp "$<" > "$@" | |
15 | + | |
16 | +cleantmp: | |
17 | + rm -rf $(subst md,html,$(wildcard *.md)) *.tmp | |
18 | + | |
19 | +clean: cleantmp | |
20 | + rm -rf $(subst md,pdf,$(wildcard *.md)) | ... | ... |
1 | +++ a/configure | |
... | ... | @@ -0,0 +1,20 @@ |
1 | +#!/usr/bin/env bash | |
2 | + | |
3 | +echo "Vérification de la configuration système..." | |
4 | + | |
5 | +if ! which node &> /dev/null | |
6 | +then | |
7 | + echo "Veuillez installer NodeJS (sudo apt-get install nodejs npm)" | |
8 | + exit 1 | |
9 | +fi | |
10 | + | |
11 | +if ! which npm &> /dev/null | |
12 | +then | |
13 | + echo "Veuillez installer NPM (sudo apt-get install npm)" | |
14 | + exit 1 | |
15 | +fi | |
16 | + | |
17 | +echo "Préparation..." | |
18 | + | |
19 | +npm install | |
20 | + | ... | ... |
1 | +++ a/html2pdf | |
... | ... | @@ -0,0 +1,52 @@ |
1 | +#!/usr/bin/env node | |
2 | + | |
3 | +// Imports | |
4 | +var fs = require('fs'); | |
5 | +var pdf = require('html-pdf'); | |
6 | +var yargs = require('yargs'); | |
7 | + | |
8 | + | |
9 | +// Understanding | |
10 | +var argv = yargs | |
11 | + .usage("Usage: $0 -o out.pdf [options]") | |
12 | + .example('$0 -i doc.pdf -o doc.pdf', 'Convert doc.html to PDF using the default values') | |
13 | + .help('h') | |
14 | + .alias('h', 'help') | |
15 | + | |
16 | + .describe('i', 'Input file') | |
17 | + .alias('i', 'input') | |
18 | + .default('i', '/dev/stdin') | |
19 | + | |
20 | + .describe('o', 'Output file') | |
21 | + .alias('o', 'output') | |
22 | + | |
23 | + .describe('t', 'Title of file') | |
24 | + .alias('t', 'title') | |
25 | + .default('t', 'Sans titre') | |
26 | + | |
27 | + .demandOption(['o']) | |
28 | + .argv; | |
29 | + | |
30 | + | |
31 | +// Settings | |
32 | +options = { | |
33 | + "base": "file://" + process.cwd() + '/', | |
34 | + "format": "A4", | |
35 | + "orientation": "portrait", | |
36 | + "border": "2cm", | |
37 | + | |
38 | + "footer": { | |
39 | + "height": "10mm", | |
40 | + "contents": { | |
41 | + default: '<div style="text-align: left; float: left;">' + argv.title + '</div> <div style="text-align:right; float: right;">{{page}}/{{pages}}</div>', | |
42 | + } | |
43 | + }, | |
44 | +} | |
45 | + | |
46 | +// Reading | |
47 | +htmlString = fs.readFileSync(argv.i, "utf8"); | |
48 | + | |
49 | +// Conversion | |
50 | +pdf.create(htmlString, options).toFile(argv.o, function(err, res) { | |
51 | + if (err) console.error(err); | |
52 | +}); | ... | ... |
1 | +++ a/md2html | |
... | ... | @@ -0,0 +1,107 @@ |
1 | +#!/usr/bin/env node | |
2 | + | |
3 | +// Imports | |
4 | +var fs = require('fs'); | |
5 | +var marked = require('marked'); | |
6 | +var highlight = require('highlight.js'); | |
7 | +var katex = require('katex'); | |
8 | +var yargs = require('yargs'); | |
9 | +var extend = require('util')._extend; | |
10 | + | |
11 | + | |
12 | +// Constants | |
13 | +var template = '<!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="UTF-8"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/styles/xcode.min.css" integrity="sha256-OED7Gmqde0cMVVeo1zVd+3fBD4EST32D4h9YT7KY0aY=" crossorigin="anonymous" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous"> <style type="text/css"> image { max-width: 100 % } </style> <title>%TITLE%</title> </head> <body> <main class="page-content" aria-label="Content"> %BODY% </main> </body> </html>' | |
14 | + | |
15 | + | |
16 | +// Understanding | |
17 | +var argv = yargs | |
18 | + .usage("Usage: $0 [options]") | |
19 | + .example('$0 -i doc.md -o doc.html', 'Convert doc.md to HTML using the default template') | |
20 | + .help('h') | |
21 | + .alias('h', 'help') | |
22 | + | |
23 | + .describe('i', 'Input file') | |
24 | + .alias('i', 'input') | |
25 | + .default('i', '/dev/stdin') | |
26 | + | |
27 | + .describe('o', 'Output file') | |
28 | + .alias('o', 'output') | |
29 | + .default('o', '/dev/stdout') | |
30 | + | |
31 | + .describe('t', 'Template file (%BODY% is replaced by the text)') | |
32 | + .alias('t', 'template') | |
33 | + | |
34 | + .argv; | |
35 | + | |
36 | +if (argv.t) { | |
37 | + template = fs.readFileSync(argv.t, "utf8"); | |
38 | +} | |
39 | + | |
40 | + | |
41 | +// Settings | |
42 | + | |
43 | +var extraLangages = { | |
44 | + avrpseudo: function (hljs) { | |
45 | + lang = extend({}, highlight.getLanguage('avrasm')); | |
46 | + lang.keywords.keyword += 'Si Alors Sinon FinSi TantQue FinTantQue Pour FinPour allant de à ←'; | |
47 | + lang.keywords.keyword += 'Lire Sortir sur Appeler Retourner'; | |
48 | + lang.keywords.keyword += 'DecalerDroite DecalerGauche'; | |
49 | + lang.keywords.built_in += ' vrai faux'; | |
50 | + return lang; | |
51 | + }, | |
52 | + avrasmplus: function (hljs) { | |
53 | + lang = extend({}, highlight.getLanguage('avrasm')); | |
54 | + lang.keywords.keyword += ' si saut alors et ou if then goto && || <-'; | |
55 | + lang.contains.push({ | |
56 | + className: 'meta', | |
57 | + begin: /@\w+/, | |
58 | + }); | |
59 | + return lang; | |
60 | + }, | |
61 | +}; | |
62 | + | |
63 | +for (lang in extraLangages) { | |
64 | + // This must be done before any call to highlight.highlight :/ | |
65 | + highlight.registerLanguage(lang, extraLangages[lang]); | |
66 | +} | |
67 | + | |
68 | +var renderer = new marked.Renderer(); | |
69 | +marked.setOptions({ | |
70 | + highlight: function (code, lang) { | |
71 | + if (highlight.getLanguage(lang)) { | |
72 | + return highlight.highlight(lang, code).value; | |
73 | + } else { | |
74 | + // if (extraLangages[lang]) { | |
75 | + // highlight.registerLanguage(lang, extraLangages[lang]); | |
76 | + // return highlight.highlight(lang, code).value; | |
77 | + // } else { | |
78 | + // } | |
79 | + console.warn("Unknown language: " + lang); | |
80 | + return highlight.highlightAuto(code).value; | |
81 | + } | |
82 | + } | |
83 | +}); | |
84 | + | |
85 | + | |
86 | +// Processing | |
87 | +markdownString = fs.readFileSync(argv.i, "utf8"); | |
88 | + | |
89 | +// TeX | |
90 | +markdownString = markdownString.replace(/\\\$/g, '$') | |
91 | +markdownString = markdownString.replace(/\$\$([\s\S]+)\$\$/gm, function(glob, formula) { | |
92 | + return katex.renderToString(formula, {displayMode: true}); | |
93 | +}); | |
94 | +markdownString = markdownString.replace(/\$([^$]+)\$/g, function(glob, formula) { | |
95 | + return katex.renderToString(formula, {displayMode: false}); | |
96 | +}); | |
97 | + | |
98 | +// Conversion | |
99 | +htmlString = marked(markdownString, {renderer: renderer}); | |
100 | +fullHtmlString = template.replace('%BODY%', htmlString); | |
101 | + | |
102 | +// Saving | |
103 | +if (argv.o == '/dev/stdout') { | |
104 | + console.log(fullHtmlString); | |
105 | +} else { | |
106 | + fs.writeFileSync(argv.o, fullHtmlString); | |
107 | +} | ... | ... |
1 | +++ a/package.json | |
... | ... | @@ -0,0 +1,18 @@ |
1 | +{ | |
2 | + "name": "s6-mp-tutorat", | |
3 | + "version": "1.0.0", | |
4 | + "description": "Tutorat de microprocesseurs S6 - TD1 Sujet 8", | |
5 | + "main": "index.js", | |
6 | + "repository": { | |
7 | + "type": "git", | |
8 | + "url": "https://archives.plil.fr/gbontoux/s6-mp-tutorat" | |
9 | + }, | |
10 | + "author": "GeoffreyFrogeye", | |
11 | + "license": "GPL-3.0", | |
12 | + "dependencies": { | |
13 | + "highlight.js": "^9.11.0", | |
14 | + "katex": "^0.7.1", | |
15 | + "marked": "^0.3.6", | |
16 | + "yargs": "^8.0.1" | |
17 | + } | |
18 | +} | ... | ... |
1 | +++ a/template.html | |
... | ... | @@ -0,0 +1,59 @@ |
1 | +<!DOCTYPE html> | |
2 | +<html lang="fr"> | |
3 | + | |
4 | +<head> | |
5 | + <meta charset="utf-8"> | |
6 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | |
7 | + <meta charset="UTF-8"> | |
8 | + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/styles/xcode.min.css" integrity="sha256-OED7Gmqde0cMVVeo1zVd+3fBD4EST32D4h9YT7KY0aY=" crossorigin="anonymous" /> | |
9 | + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous"> | |
10 | + <style type="text/css"> | |
11 | + body { | |
12 | + font-family: Cantarell; | |
13 | + font-size: 12px; | |
14 | + } | |
15 | + code { | |
16 | + white-space: pre-wrap; | |
17 | + } | |
18 | + h1, h2, h3 { | |
19 | + text-decoration: underline; | |
20 | + margin-bottom: 0; | |
21 | + } | |
22 | + h1:first-of-type { | |
23 | + text-align: center; | |
24 | + text-decoration: none; | |
25 | + margin-bottom: 0; | |
26 | + } | |
27 | + h2:first-of-type { | |
28 | + color: gray; | |
29 | + text-align: center; | |
30 | + text-decoration: none; | |
31 | + margin-top: 0; | |
32 | + } | |
33 | + img { | |
34 | + max-width: 100%; | |
35 | + } | |
36 | + p { | |
37 | + text-align: justify; | |
38 | + } | |
39 | + p code { | |
40 | + border: 1px solid #ccc; | |
41 | + border-radius: 2px; | |
42 | + padding: 0px 2px; | |
43 | + } | |
44 | + @media print { | |
45 | + code {page-break-inside: avoid;} | |
46 | + h1, h2, h3, h4, h5 {page-break-after: avoid;} | |
47 | + img {page-break-after: avoid;} | |
48 | + } | |
49 | + </style> | |
50 | + <title>%TITLE%</title> | |
51 | +</head> | |
52 | + | |
53 | +<body> | |
54 | + <main class="page-content" aria-label="Content"> | |
55 | +%BODY% | |
56 | + </main> | |
57 | +</body> | |
58 | + | |
59 | +</html> | ... | ... |