#!/bin/bash # ooi2beamer -- Copyright (C) 2006 Christophe Lohr / ENST-Bretagne # Translate an OpenOffice-Impress document to a LaTeX-Beamer one # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # GNU General Public License: # http://www.gnu.org/licenses/gpl.html # Documentation : # https://info.enstb.org/documentation/latex/beamer/ooi2beamer/ # Usage : # 1- Créez un nouveau répertoire # 2- Exécutez ooimpress, chargez votre document # 3- Exportez au format html (Fichier/Exporter, et surtout pas AssistantWeb) # 4- Répondez ce que vous voulez aux questions, ça n'a pas d'importance # 5- De très nombreux fichiers sont créés, on ne s'intéresse qu'à text*.html # 6- Exécutez "ooi2beamer" dans ce répertoire # 7- Un fichier main.tex est créé, enjoy! # Choisit un nom de fichier temporaire avec un suffixe .html TEMP="`tempfile -s .html`" # Les options qui vont bien pour html2tex, insérées dans le fichier html # Voir http://www.iwriteiam.nl/html2tex.html cat << EOF > $TEMP EOF # Avant de supprimer le bandeau de navigation entre transparents avec un # simple sed, il faut cannoniser le html avec tidy for i in text?.html text??.html text???.html; do if [ -f "$i" ] ; then echo $i >&2 tidy -q --input-encoding utf8 --output-encoding latin1 -w 1000 $i fi done \ | sed -e '/.*Première.*Précédent.*Suivant.*?,+1d' \ >> "$TEMP" cat << EOF >> "$TEMP" EOF # Le fameux html2tex # compiler http://www.iwriteiam.nl/html2tex_c.txt avec "-DASCII8" html2tex -o "$TEMP.tex" "$TEMP" # Utilise sed pour : # - supprimer du blabla html2tex avec le nom du fichier # - essayer de bien gérer les notes qui sont coincées entre le # subsubsection{Notes:} et le end{frame}... # - gérer en LaTex les symbols html laissés par html2tex sed -e '1d;$d' "$TEMP.tex" \ -e '/.*subsubsection{Notes:}.*/,/.*end{frame}.*/{s,.*subsubsection{Notes:}.*,\\note{,g;s,.*end{frame}.*,}\n\\end{frame},g}' \ -e "s,\\’,',g" -e 's,\\…,\\ldots,g' -e 's,\\–,--,g' \ > main.tex # Supprime les fichiers temporaires rm -f "$TEMP" "$TEMP.tex"