This repository has been archived on 2023-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
langue-phundrak-com/headers/headers.org

95 lines
3.5 KiB
Org Mode

# -*- mode: org; -*-
#+AUTHOR: Lucien Cartier-Tilet
#+EMAIL: phundrak@phundrak.fr
#+CREATOR: Lucien Cartier-Tilet
#+LANGUAGE: fr
# ### LaTeX ####################################################################
#+LATEX_CLASS: article
#+LaTeX_CLASS_OPTIONS: [a4paper,twoside]
#+LATEX_HEADER: \usepackage{xltxtra,fontspec,xunicode}\usepackage[total={6.5in,10.0in}]{geometry}\setromanfont[Numbers=Lowercase]{Charis SIL}
#+LATEX_HEADER: \usepackage{xcolor} \usepackage{hyperref}
#+LATEX_HEADER: \hypersetup{colorlinks=true,linkbordercolor=red,linkcolor=blue,pdfborderstyle={/S/U/W 1}}
#+LATEX_HEADER: \usepackage{multicol} \usepackage{indentfirst}
# ### HTML #####################################################################
#+HTML_DOCTYPE: html5
#+HTML_HEAD: <link rel="shortcut icon" href="https://cdn.phundrak.fr/img/mahakala-128x128.png" type="img/png" media="screen" />
#+HTML_HEAD: <link rel="shortcut icon" href="https://cdn.phundrak.fr/img/favicon.ico" type="image/x-icon" media="screen" />
#+HTML_HEAD: <meta property="og:image" content="https://cdn.phundrak.fr/img/rich_preview.png" />
#+HTML_HEAD: <meta name="twitter:card" content="summary" />
#+HTML_HEAD: <meta name="twitter:site" content="@phundrak" />
#+HTML_HEAD: <meta name="twitter:creator" content="@phundrak" />
# ### CODE #####################################################################
#+NAME: process-tree
#+BEGIN_SRC scheme :noweb yes :exports none :eval yes
(define (left-child tree)
(cadr tree))
(define (left-child-name tree)
(car (left-child tree)))
(define (right-child tree)
(caddr tree))
(define (right-child-name tree)
(car (right-child tree)))
(define (cur-name tree)
(car tree))
(define (to-string phon-tree node-nbr child next-nbr)
(let ((this-name (string-append "node"
(number->string node-nbr)))
(child-name (string-append "node"
(number->string next-nbr))))
(string-append child-name
"[label=\""
(cur-name child)
"\"];"
this-name
"--"
child-name
";"
(to-dot-main child next-nbr))))
(define (to-dot-main phon-tree node-nbr)
(let* ((this-name (string-append (number->string node-nbr)
"node")))
(if (null? (left-child phon-tree))
""
(let ((x (* 2 (+ 1 node-nbr)))
(y (* 2 (+ 2 node-nbr))))
(string-append (to-string phon-tree node-nbr
(left-child phon-tree)
x)
(to-string phon-tree node-nbr
(right-child phon-tree)
y))))))
(define (to-dot phon-tree)
(if (null? phon-tree)
""
(string-append
"graph{"
"node[shape=plaintext];"
"graph[bgcolor=\"transparent\"];"
"node1[label=\""
(cur-name phon-tree)
"\"];"
(to-dot-main phon-tree 1)
"}")))
#+END_SRC
# ### MACROS ###################################################################
#+MACRO: newline @@latex:\hspace{0pt}\\@@ @@html:<br>@@
#+MACRO: newpage @@latex:\newpage@@
#+MACRO: latex-html @@latex:$1@@ @@html:$2@@
#+MACRO: last-update Dernière mise à jour le {{{time(%d/%m/%y à %H:%M)}}}.
#+MACRO: phon @@latex:/$1/@@ @@html:&frasl;$1&frasl;@@
#+OPTIONS: H:4 broken_links:mark email:t ^:{}