Com convertir un manual de UserBase a Docbook

From KDE UserBase Wiki
Revision as of 19:53, 21 November 2011 by Abella (talk | contribs) (Created page with "/ruta/al/vostre/dblatex-cvs-install/share/dblatex/scripts/dblatex $*</syntaxhighlight>}}<!--{{-->")

Prefaci

El procediment actual no està polit, el codi de l'script és lleig, no prou intel·ligent, etc. L'única excusa és que funciona d'alguna manera .

Si voleu millorar el procediment, teniu bones habilitats amb Python, i coneixeu els principis d'autoria de docbook, podeu millorar el procediment. Si us plau, poseu-vos en contacte amb Yurchor si sou capaç d'ajudar.

Preparar les pàgines per a la conversió

  • Comproveu si cada pàgina conté la seva capçalera en funció al nivell d'aquesta pàgina a la taula de continguts.
Taula de referència
UserBase Docbook Comentari
==Secció== <capítol>
===Secció=== <secció1>
====Secció==== <secció2>
=====Secció===== <secció3>
======Secció====== <secció4> No utilitzeu aquest últim nivell, si és posible.
  • Comproveu si totes les cel tenen espai després del caràcter de canonada. Aquesta norma s'ajusta al format wiki tradicional.
  • Feu que el nom de l'aplicació tingui un format consistent (eviteu l'ús de Amaroks, feu Amarok's).
  • Assegureu-vos que totes les imatges estan en format PNG.
  • Elimineu tots els caràcters no imprimibles dels noms d'imatge.

===Exportar===

  • Prepareu la llista de pàgines (elimineu les adreces de UserBase http://userbase.kde.org). Exemple per a Amarok:
Amarok/Manual/Introduction
Amarok/QuickStartGuide
Amarok/QuickStartGuide/GettingStarted
Amarok/QuickStartGuide/TheAmarokWindow
Amarok/QuickStartGuide/TheMusicCollection
Amarok/QuickStartGuide/Playlists
Amarok/QuickStartGuide/TheContextView
Amarok/QuickStartGuide/HowToDealWithProblems
Amarok/QuickStartGuide/Glossary
Amarok/Manual/AmarokWindow
Amarok/Manual/AmarokWindow/Toolbar
Amarok/Manual/AmarokWindow/MediaSources
Amarok/Manual/AmarokWindow/ContextPane
Amarok/Manual/AmarokWindow/PlaylistPane
Amarok/Manual/ConfiguringAmarok
Amarok/Manual/ConfiguringAmarok/ChangingLayout
Amarok/Manual/Organization
Amarok/Manual/Organization/Collection
Amarok/Manual/Organization/CollectionScanning
Amarok/Manual/Organization/Collection/SearchInCollection
Amarok/Manual/Organization/Collection/OrganizeCollection
Amarok/Manual/Organization/Collection/RemoteCollections
Amarok/Manual/Organization/Collection/RemoteCollections/Ampache
Amarok/Manual/Organization/Collection/RemoteCollections/DAAP
Amarok/Manual/Organization/Collection/RemoteCollections/Samba
Amarok/Manual/Organization/Collection/RemoteCollections/UPnP
Amarok/Manual/Organization/Collection/ExternalDatabase
Amarok/Manual/Organization/Collection/WorkingWithMediaDevices
Amarok/Manual/Organization/CoverManager
Amarok/Manual/Organization/TagEditor
Amarok/Manual/Organization/Transcoding
Amarok/Manual/Organization/ScriptManager
Amarok/Manual/Playlist
Amarok/Manual/Playlist/SavedPlaylists
Amarok/Manual/Playlist/PlaylistFiltering
Amarok/Manual/Playlist/QueueManager
Amarok/Manual/Playlist/DynamicPlaylists
Amarok/Manual/Playlist/AutomaticPlaylistGenerator
Amarok/Manual/Various
Amarok/Manual/Various/Moodbar
Amarok/Manual/Various/AmarokOnOtherPlatforms
Amarok/Manual/Various/AmarokOnOtherPlatforms/NonKDE Desktops
Amarok/Manual/Various/AmarokOnOtherPlatforms/Windows
Amarok/Manual/Various/AmarokOnOtherPlatforms/OSX
Amarok/Manual/Various/TroubleshootingAndCommonProblems
Amarok/Manual/Various/FAQ
Amarok/Manual/References
Amarok/Manual/References/MenuAndCommandReference
Amarok/Manual/References/MenuAndCommandReference/AmarokMenu
Amarok/Manual/References/MenuAndCommandReference/ViewMenu
Amarok/Manual/References/MenuAndCommandReference/Playlist
Amarok/Manual/References/MenuAndCommandReference/Tools
Amarok/Manual/References/MenuAndCommandReference/Settings
Amarok/Manual/References/MenuAndCommandReference/Help
Amarok/Manual/References/KeybindingReference
Amarok/Manual/References/KeybindingReference/GlobalShortcuts
Amarok/Manual/References/KeybindingReference/AmarokShortcuts
Amarok/Manual/References/Credits and License

Consell

Podeu obtenir la llista completa de les pàgines per a la vostra aplicació amb el següent script:
<DPL>
  nottitlematch = %/__|%/zh-%|%(%)
  titlematch = Amarok%
  namespace = Main
  columns = 1
  format = ,\n* [[%PAGE%|%TITLE%]],,
</DPL>
Substituïu Amarok amb el nom de la vostra aplicació, poseu-ho a la vostra pàgina d'usuari, i feu clic a Vista prèvia. Es reordenarà la llista d'acord amb l'índex de continguts del manual.


  • Enganxeu la llista de pàgines al camp de text més gran.
  • Feu clic a Exporta.
S'exportaran les pàgines de manual de Amarok.
  • Deseu el fitxer. El fitxer desat s'anomenarà Manual.xml en el que segueix.

Convertir

  • Instal·leu el paquet Subversion pel vostre sistema.
  • Obteniu l'última versió de l'script de la conversió:
    svn checkout --depth=files svn://anonsvn.kde.org/home/kde/branches/work/doc/
  • Copieu Manual.xml a la carpeta de l'script.
  • Executeu
    python wiki2docbook.py Manual.xml
    si voleu descarregar totes les capture de pantalla (es necessita algun temps per a descarregar totes les imatges des de UserBase, grep i wget han d'estar instal·lats), o
    python wiki2docbook.py -s Manual.xml
    si no necessiteu descarregar les imatges.

Post-processament

  • Canvieu el nom de Manual.xml.docbook a index.docbook.
  • Comproveu si la conversió s'ha realitzat correctament:
    checkXML index.docbook
  • Corregiu els errors (millor sobre les pàgines de UserBase).
  • Convertir docbook a HTML:
    meinproc4 index.docbook
  • Comproveu les pàgines HTML (totes les imatges han de ser visibles, els enllaços no han de donar lloc a pàgines 404).
  • Substituïu les imatges grans per miniatures usant convert de ImageMagick.
  • Arrangeu els enllaços a docbook, de manera que portin a la secció de docbook, no pàgines de UserBase.
  • Arrangeu el nom de l'aplicació d'acord amb la llista d'entitats del KDE.
  • Copieu index.docbook i les imatges a la vostra carpeta /doc i publiqueu-ho (commit) al repositori.
La documentació de K3b a UserBase en Opera i la pàgina convertida en el Konqueror.

Actualitzar els DocBook des de UserBase

To update your converted docbook please use the following procedure:

  • Re-export XML from UserBase. See Export section.
  • Use the script to update the content (headers with abstract and keywords and footer will be kept):
    python wiki2docbook.py -r index.docbook Manual.xml
  • Check the docbook, rename the file into index.docbook and commit it with screenshots into your repository.

Convertir els DocBook a un altre format

Convertir-los a PDF

Usually, there is no need to convert DocBook manually. You can download the converted PDFs from KDE Documentation site.

Should you need additional customization please do as follows:

  • Make sure that you have some LaTeX distribution installed (usually, TeXLive).
  • Create the following script file (named buildpdf.sh) in your DocBook directory:
#!/bin/bash

export SGML_CATALOG_FILES=/usr/share/sgml/docbook/sqml-dtd-4.2/catalog:/usr/share/apps/ksgmltools2/customization/catalog.xml:/usr/share/sgml/docbook/xml-dtd-4.2/docbook

# add -d to command below to keep the /tmp folder, so you can examine the generated tex.
./dblatex-cvs-install/bin/dblatex -d -b pdftex --style \
	kdestyle\
	-o $(pwd | awk -F/ '{ print $NF }').pdf \
	-P latex.output.revhistory=0  -P newtbl.use=1 \
	-P imagedata.default.scale=pagebound \
	-P literal.width.ignore=1 \
	-I $KDEDIR/share/doc/HTML/en/ \
	-X \
        $1
  • Download KDE styles:
svn co svn://anonsvn.kde.org/home/kde/trunk/www/areas/docs/dblatex-cvs-install/
  • Tweak dblatex-cvs-install/bin/dblatex in like this
#!/bin/sh

TEXINPUTS=:/path/to/your/dblatex-cvs-install/share/dblatex/latex//:$TEXINPUTS
export TEXINPUTS

/ruta/al/vostre/dblatex-cvs-install/share/dblatex/scripts/dblatex  $*

(Canvieu /ruta/al/vostre/ segons el cas).

  • Copy KDE styles (/dblatex-cvs-install/share/dblatex/latex/contrib/) to some TeX dir where it can be found by LaTeX installation (I have copied them to /usr/share/texmf-dist/tex/latex/kde).
  • Update paths with mktexlsr from root.
  • Run ./buildpdf.sh index.docbook.
  • Copy all files from /tmp/tpb-your_user-digits to the work directory.
  • Customize and edit tex file in Kile as appropriate.
  • Compile PDF file with Alt + 6.

Convertir-los a EPUB

  • Make sure that Calibre is installed in your system.
  • Convert your DocBook into HTML first. Use meinproc4 index.docbook for this.
  • Start Calibre and choose Add books.
  • Select index.html in your DocBook folder. Wait until the book is loaded.
  • Choose Convert books.
  • Fill the metadata fields as appropriate.
Calibre conversion configuration page.
  • Press OK and wait until the work is done.
  • Copy the book from ~/Calibre Library on your ebook reader.