Skip to content
Christian Ziemski edited this page Mar 7, 2016 · 5 revisions

Why SubWikis?

Access control: On the one hand I want to have all my information accessible within a single search function (most of the time I use WikidPad's CTRL-O to search for Wiki Word names). On the other hand I want to be able to give access to defined parts of my personal Wiki to other people, for example by exporting part of my personal Wiki.

Proposed Features

Export

Provide a "Subwiki-Export"-Menu item, which will ask the user which Subwiki he wants to export and than takes all [Subwiki:ExampleName]-tagged pages and exports them to .wiki-files.

Example use: Export the "computer notes"-part of your Personal Wiki and take it with you to your working place.

Access restriction

Feature to put WikidPad into a mode which gives the user only access to part (a Subwiki) of the current Wiki (and maybe read-only), until WikidPad is returned to normal mode with a password.

Example: By this you can give your girl-friend quick access to only the public-part of your personal Wiki to have a look into your cooking recipe collection.

Import

Provide a "SubWiki-Import"-Menu item, which imports a directory full of .wiki files and tags each page with [Subwiki:ExampleName].

This runs into problems when the same page name is present in more than one Subwiki. For my part I will just avoid duplicate names, but everybody is free to use their own naming scheme for pages belonging to different SubWikis; there may be supporting functions for naming schemes, like a string which can be prefixed to each page name when importing. I don't like the idea of adding the SubWikis name to each page name. If I want to link to "ExamplePage" I don't want to think about what Subwiki it is in.

Search

Possibility to constrain the search to a SubWiki

Implementation

This page is sitting here quite some time I couldn't find the time to do any programming on a SubWiki-Plugin for WikidPad.

Until I get around doing it, I'll just hope that someone else likes the ideas and implements something :).

Guidance for implementation by Michael Butcher

The export should go somehow like someObject.TextExporter(...,pwiki.wikiData.getWordsWithPropertyValue('SubWiki','ExampleName'),...)

Instead of "pwiki.wikiData" better use "pwiki.getWikiData()" as the variable "wikiData" will be removed in the future.

I don't know the exact syntax from looking into the code, if someone knows the parameters I should use on my call to TextExporter, please please tell me. How do I access TextExport? Do I have to instance a TextExporter myself or should I use an existing instance?

It's generally better to create a new instance of an exporter. Some exporters may have state variables which may be set wrongly after use.

So first create exporter object:

exporter = TextExporter(mainControl)

mainControl means currently the PersonalWikiFrame instance (I plan to split the huge PersonalWikiFrame into the simple gui object and the main control which will contain the background logic some day in the future).

then call

exporter.export(wikiDataManager, wordList, exportType, exportDest, compatFilenames, addopt)

The parameters have the following meaning:

wikiDataManager -- WikiDataManager object

wordList -- Sequence of wiki words to export

exportType -- string tag to identify how to export: To find allowed tags for an exporter, look into the getExportTypes() function. For TextExporter, only "raw_files" is allowed.

exportDest -- Path to destination directory or file to export to: It depends on exporter and exportType if it is a directory (when exporting multiple files) or a single file path. For "raw_files" it is a directory.

compatFilenames -- Should the filenames be encoded to be lowest level compatible: Use False for this parameter, otherwise the exported files may be impossible to import again.

addopt -- additional options returned by getAddOpt(): Use exporter.getAddOpt(None) to retrieve default additional options (as a tuple).

Source: http://trac.wikidpad2.webfactional.com/wiki/SubWikis

Clone this wiki locally