/usr/share/games/fortunes/livro/livro.py is in fortunes-mario 0.20-8.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | #!/usr/bin/env python
import sys
bverbatim = r'\begin{Verbatim}[fontfamily=times]'
bverbatimascii = r'\begin{Verbatim}[fontsize=\scriptsize]'
bminipage = r'\begin{minipage}{\textwidth}'
bverb = r'\begin{verbatim}'
header = r'''
\documentclass[brazil,twoside,a4paper,12pt]{book}
\usepackage[brazil]{babel}
\usepackage{indentfirst}
% #\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{fancyhdr}
\usepackage{fancyvrb}
\usepackage{url}
\usepackage{float}
\usepackage{afterpage}
\usepackage{amsfonts,amsmath,amssymb}
\usepackage{calc}
\makeindex
\begin{document}
\frontmatter
\newlength{\centeroffset}
\setlength{\centeroffset}{-0.5\oddsidemargin}
\addtolength{\centeroffset}{0.5\evensidemargin}
\thispagestyle{empty}
\vspace*{\stretch{1}}
\noindent\hspace*{\centeroffset}\makebox[0pt][l]{\begin{minipage}{\textwidth}
\flushleft
{\Huge\bfseries \texttt{mario\_fortunes}}
\noindent\rule[-1ex]{\textwidth}{5pt}\\[2.5ex]
\end{minipage}}
\vspace{\stretch{1}}
\noindent\hspace*{\centeroffset}\makebox[0pt][l]{\begin{minipage}{\textwidth}
\flushright
{\texttt{versão 0.20}\\\bfseries Mario Domenech Goulart}
\end{minipage}}
\vspace{\stretch{2}}
\newpage
\tableofcontents
\chapter*{Prefácio}
\VerbatimInput[fontfamily=times,fontshape=it]{../LEIAME}
\mainmatter
\newcommand{\separador}{\centering\huge$\sim\backsim$\vspace{10\lineskip}}
'''
tex_file = open('mario_fortunes-livro.tex', 'w')
tex_file.write(header)
for file in sys.argv[1:]:
fortune_file = open(file, 'r')
section_name = 'mario.' + file.split('.')[-1:][0]
tex_file.write(r'\chapter{' + section_name + '}\n')
tex_file.write(bminipage + '\n')
print section_name
if section_name == 'mario.arteascii':
tex_file.write(bverbatimascii + '\n')
elif section_name == 'mario.computadores':
tex_file.write(bverb + '\n')
else:
tex_file.write(bverbatim + '\n')
for line in fortune_file.readlines():
if line == '%\n':
if section_name == 'mario.computadores':
tex_file.write(r'\end{verbatim}' + '\n')
else:
tex_file.write(r'\end{Verbatim}' + '\n')
if section_name != 'mario.arteascii':
tex_file.write(r'\separador' + '\n')
tex_file.write(r'\end{minipage}' + '\n\n')
tex_file.write(r'\afterpage{\clearpage}' + '\n')
tex_file.write(bminipage + '\n')
if section_name == 'mario.arteascii':
tex_file.write(bverbatimascii + '\n')
elif section_name == 'mario.computadores':
tex_file.write(bverb + '\n')
else:
tex_file.write(bverbatim + '\n')
else:
if section_name == 'mario.anagramas':
line = line.replace('<-->', ' :::: ')
tex_file.write(line)
if section_name == 'mario.computadores':
tex_file.write('\n' + r'\end{verbatim}' + '\n' + r'\end{minipage}' + '\n')
else:
tex_file.write('\n' + r'\end{Verbatim}' + '\n' + r'\end{minipage}' + '\n')
fortune_file.close()
tex_file.write(r'\chapter{Créditos}' + '\n\n')
tex_file.write(r'\VerbatimInput{../CREDITOS}' + '\n\n')
tex_file.write(r'\chapter{Licença}' + '\n\n')
tex_file.write(r'\fvset{fontsize=\small}' + '\n')
tex_file.write(r'\VerbatimInput{../LICENCA}' + '\n\n')
tex_file.write(r'\chapter{Histórico de modificações}' + '\n\n')
tex_file.write(r'\VerbatimInput{../CHANGELOG}' + '\n\n')
tex_file.write(r'\chapter{Dicas}' + '\n\n')
tex_file.write(r'\VerbatimInput{../DICAS}' + '\n\n')
tex_file.write(r'\chapter{\textit{Bugs}}' + '\n\n')
tex_file.write(r'\VerbatimInput{../BUGS}' + '\n\n')
tex_file.write(r'\end{document}' + '\n')
tex_file.close()
|