1Zim(3) User Contributed Perl Documentation Zim(3)
2
3
4
6 Zim - Application object for the zim desktop wiki
7
9 use Zim;
10
11 my $repo = Zim->new(
12 type => 'Files',
13 dir => $dir,
14 );
15 my $page = $repo->get_page('Home');
16
18 This class defines the public interface to the document repository as
19 used by zim(1). It acts as a dispatcher that manages one or more store
20 objects to handle page requests. It also adds some tests and thus tries
21 to isolate the stores from errors in the GUI. These repositories are
22 called "notebooks" in the UI
23
24 The interface which child objects should support is defined in
25 Zim::Store.
26
28 Public Methods
29
30 The following methods can be used by the GUI.
31
32 new(PARENT, NAMESPACE, FILE)
33 new(PARENT, NAMESPACE, DIR, TYPE, ...)
34 Constructor. PARENT can be a parent repository object or undef.
35 NAMESPACE is the prefix for all pages managed by this repository.
36
37 TODO: implement this: FILE should be the path to a repository con‐
38 fig file.
39
40 DIR is the root namespace of the repository and might contain a
41 onfig file.
42
43 TYPE is optional and is used to initialize a top level child repos‐
44 itory when no other config is given. This is used for example to
45 intialize a repository. All remaining arguments are passed on to
46 this top level child repository.
47
48 "init_history()"
49 Initializes a Zim::History to be used with this repository.
50 Returns the history object or undef.
51
52 "add_child(NAMESPACE, CHILD, ...)"
53 This will connect a new child object to this repository under a
54 certain namespace. CHILD is a class name implementing the store
55 interface. The class will be looked for in "Zim::Store::". All
56 remaining arguments will be passed on to the constructor of the
57 object.
58
59 "config()"
60 Returns a hash with config options.
61
62 "save()"
63 Save config, history, etc. to disk.
64
65 "root()"
66 Returns self.
67
68 "base()"
69 Returns the base directory for files.
70
71 The "base" directories for individual pages should either be the
72 same as this directory or a subdirectory of it.
73
74 "list_pages(NAMESPACE)"
75 Lists pages in NAMESPACE. Sub-namespaces have a trailing ':' in the
76 listing.
77
78 If a page is not present in this list that does not mean that it
79 doesn't exists. This list is used for hierarchical views of the
80 page structure; not all stores need to support a hierarchical
81 order.
82
83 get_page(NAME)
84 Returns an object of a class inheriting from Zim::Page. When you
85 ask for a page that doesn't exists yet, you should get a new
86 object. In case it is not possible to create the page in question
87 "undef" is returned.
88
89 "resolve_page(LINK, PAGE, NO_DEFAULT)"
90 Like "get_page()" but now expecting NAME to be user input, so NAME
91 is sanitized first.
92
93 "resolve_name(LINK, PAGE, REFERENCE, NO_DEFAULT)"
94 Cleans up NAME but does not actually fetch a page object.
95
96 "resolve_namespace(NAME)"
97 Returns a namespace string. Used to sanitize user input.
98
99 copy_page(SOURCE, TARGET, UPDATE_LINKS)
100 Copy page SOURCE to TARGET. Both arguments can be either page names
101 or objects. Returns the (new) TARGET object. The UPDATE_LINKS argu‐
102 ment is a boolean that tells whether links to this page should be
103 updated to point to this new name.
104
105 move_page(SOURCE, TARGET, UPDATE_LINKS)
106 Move page SOURCE to TARGET. Both arguments can be either page names
107 or objects. Returns the (new) TARGET object.The UPDATE_LINKS argu‐
108 ment is a boolean that tells whether links to this page should be
109 updated to point to this new name.
110
111 delete_page(PAGE)
112 Delete PAGE. PAGE can be either a page name or a page object.
113
114 "list_backlinks(PAGE)"
115 Returns a list of links to this page.
116
117 "search(QUERY, CALLBACK)"
118 TODO stable api for this using Zim::Selection
119
120 Results are given as arguments to CALLBACK in the form "[PAGE,
121 SCORE]".
122
123 "interwiki_lookup(KEY, PAGE)"
124 Returns an url for an interwiki link with interwiki name KEY and
125 page PAGE. Lookup for names is case in-sensitive.
126
127 "get_history()"
128 Return a object of class Zim::History or undef.
129
130 Class Methods
131
132 These methods can be called as "Zim->method(...)".
133
134 "list_notebooks()"
135 Returns a reference to a list with names for known notebooks.
136
137 "set_default_notebook(REPOSITORY)"
138 Set the path or name for the default notebook.
139
140 "get_default_notebook()"
141 Returns the path for the default notebook, if there is one.
142
143 "set_notebook(NAME =" PATH)>
144 Set the name for a notebook.
145
146 "get_notebook(NAME)"
147 Returns a path for a notebook with NAME or undef if the notebook is
148 unknown. The lookup is case in-sensitive.
149
151 Please mail the author if you find any bugs.
152
154 Jaap Karssenberg ⎪⎪ Pardus [Larus] <pardus@cpan.org>
155
156 Copyright (c) 2005 Jaap G Karssenberg. All rights reserved. This pro‐
157 gram is free software; you can redistribute it and/or modify it under
158 the same terms as Perl itself.
159
161 zim(1), Zim::Store
162
163
164
165perl v5.8.8 2007-12-27 Zim(3)