terça-feira, 17 de junho de 2014

Estilos EPUB

Paulo Werneck

Biblioteca do Convento de Mafra
Fonte: Wiki

Em "Modo fácil de Criar EPUBs", foi apresentada uma receita de bolo de como converter arquivos ".doc" para ".epub", usando editor de textos e o programa gratuito Sigil. Agora será mostrado como criar os estilos no EPUB, completando a receita

Primeiro, utilizando o bloco de notas, criar o arquivo "pgepub.css", contendo o seguinte texto:
@charset "utf-8";
h1 
color: black;
margin: 1.4em 0 0.7em 0;
border-style: solid none solid none;
border-width: 5px;
padding: 10px 0 10px 0;
text-align: left;
line-height: 1.2em;
font-size: 1.4em;
font-style: normal;
font-weight: bold;
}
h2 {
color: black;
margin-top: 1.2em;
margin-bottom: 1.2em;
margin-left: 00%;
margin-right: 00%;
text-align: left;
line-height: 120%;
font-size: 1.2em;
font-style: normal;
font-weight: bold;
}
.nor {
color: black;
margin: 0.6em 00%;
text-align: justify;
text-indent: 0;
line-height: 120%;
font-size: 1.0em;
font-style: normal;
font-weight: normal;
}
.cit {
color: black;
margin: 0.6em 0% 0.6em 5%;
text-align: justify;
text-indent: 0;
line-height: 120%;
font-size: 1.0em;
font-style: normal;
font-weight: normal;
}

Depois, no Sigil, trocar o início do arquivo "Section0001.xhtml", até a linha contendo "</head>", inclusive, pelo seguinte texto:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../Styles/pgepub.css" rel="stylesheet" type="text/css" />
</head>
Finalmente, no Sigil, clicar com o botão direito o ícone Styles (na janela Navegador), e selecionar "Acrescentar arquivo existente...". Na janela que se abrir, marcar o arquivo "pgepub.css" recém criado.
Salvar o arquivo EPUB, e pronto. Pode levá-lo para o Kobo (ou outro leitor) ou mesmo lê-lo no PC, como o próprio Sigil ou outro leitor.

As definições constantes do "pgepub.css" estão em "CSS", Cascading Style Sheets, outra linguagem de programação, assim como o XHTML, EXtensible HyperText Markup Language

Ótimos tutoriais sobre essas duas linguagens podem ser encontrados em "www.w3schools.com".