Hi Philippe
philippe gonze wrote:
> **
>
> instead of:
>
> : [[SomeArticle ]]
>
> write:
>
> : [[SomeArticle|Display title of the Article]]
>
>
> *I do not use collections. I am using mw-render and pdftk in bash
> scripts.... More convenient than UI-driven actions.
> *
Ok, in that case I guess you really want to know more about the metabook
format ;)
Actually there is a documentation about the metabook format in the
mwlib/docs directory (should also be located in the site-packages dir of
mwlib as described below for mwlib.rl)
I'll also attach a small script which constructs a json encoded metabook
file. The input is a list of chapters, with an associated list of
articles and their display titles.
If you constructed a metabook (with the script I attached for example)
you can render a pdf by using the -m option for the metabook instead of
a zipfile.
e.g.
mw-render -w rl -o test.pdf -c http://en.wikipedia.org/w -m mbook.json
One thing to note: the attached script is a somewhat quick and dirty
hack, so don't hold me responsible for anything related to that ;)
>
>
>
>
> > - force page jump between all wiki pages
> >
> Add pageBreakAfterArticle = True to your customconfig.py as
> described in
> the README.txt of mwlib.rl
>
> *The README.txt just mentions files named customconfig.py and
> pdfstyles.py... but WHERE ARE THESE FILES ?
> *
If your on some kind of linux they should be in the site-packages directory
so something like:
/usr/lib/python2.5/site-packages/mwlib.rl/mwlib/rl/pdfstyles.py
The customconfig.py file does not exist - you have to create it and then
override the settings from pdfstyles.py.
If you checked out the sources with mercurial, the pdfstyles.py file can
by found in the source-tree you checked out.
>
>
>
> > - specify the presence/absence of footnote documents regarding
> author
> > and/or tool
> >
> Can you clarify that please.
>
> > Am I asking too much ? (I also searched a way to add non-wiki
> > intersticial pages - this was solved with pdftk).
> >
> Adding non wiki pages to the pdf is not possible. Using a tool like
> pdftk is currently the only way.
>
> *Was solved before so no more prob.*
>
>
>
> > And by the way what is a "metabook" ?... Where is it documented
> ? How
> > is it used ?
> >
> Explaining the purpose and usage of the metabook might get lengthy ;).
> What are you trying to do?
>
> *I am simply writing a large private wiki (probably 200 articles, and
> I try to organize a PDF version (with title page, article numbering,
> TOC...).
> *
ok.
Regarding the TOC: just a couple of days ago I implemented an alpha
version of a TOC which is not used currently.
The corresponding ticket can be found at:
http://code.pediapress.com/wiki/ticket/277 . Feel free to contribute
Regards,
Volker
--
volker haas brainbot technologies ag
fon +49 6131 2116394 boppstraße 64
fax +49 6131 2116392 55118 mainz
[email protected] http://www.brainbot.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"mwlib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/mwlib?hl=en
-~----------~----~----~----~------~----~------~--~---
#! /usr/bin/env python
#! -*- coding:utf-8 -*-
import simplejson
from mwlib import metabook
book = [('Introduction', [
('Amphibious aircraft', 'Amphibious aircraft DISPLAY TITLE')
]),
('Technical Aspects', [
('Propeller', 'Propeller'),
('Turboprop', 'Turboprop'),
('Wing configuration', 'Wing configuration'),
('Lift-to-drag ratio', 'Lift-to-drag ratio'),
('Thrust', 'Thrust'),
]),
('Aircrafts', [
('J2F Duck', 'J2F Duck'),
('ShinMaywa US-1A', 'ShinMaywa US-1A'),
('Lake Aircraft', 'Lake Aircraft'),
('PBY Catalina', 'PBY Catalina'),
('Kawanishi H6K', 'Kawanishi H6K'),
])
]
mbook = metabook.make_metabook(title='Amphibious Aircrafts', subtitle='...a short overview')
source = metabook.make_source(name='English Wikipedia', url='http://en.wikipedia.org/', language='en')
from mwlib import utils
license_url = 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Text_of_the_GNU_Free_Documentation_License&action=raw'
license_text = utils.fetch_url(
license_url,
ignore_errors=True,
expected_content_type='text/x-wiki',
)
if license_text:
try:
license_text = unicode(license_text, 'utf-8')
except UnicodeError:
license_text = None
else:
pass
license = { 'mw_rights_text': license_text,
'name': 'GNU Free Documentation License',
}
mbook['licenses'] = [license]
for (chapter_name, article_name_list) in book:
chapter = metabook.make_chapter(chapter_name)
articles = [ metabook.make_article(title=title, displaytitle=displaytitle) for title, displaytitle in article_name_list]
chapter['items'] = articles
mbook['items'].append(chapter)
mbookfilename = 'mbook.json'
m = open(mbookfilename, 'w')
m.write(simplejson.dumps(mbook))
m.close()