Simplified creation of wiki_root dir by fn-wiki create config. Added better default text.
diff --git a/fniki/default_files/wikitext/EditingTips b/fniki/default_files/wikitext/EditingTips new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/EditingTips @@ -0,0 +1,41 @@ +Names of pages have to LookLikeThis. +It's called a WikiName. +If you write a word that LookLikeThis, it will be automatically turned into a link. + +Be aware that PikiPiki does not lock pages during editing, so if you pause for a long time on the edit screen you may overwrite somebody else's changes. + +Leave blank lines between paragraphs. + +You can also write ''italics'' and '''bold'''. +To write italics, enclose the text in double single quotes. +To write bold, enclose the text in triple single quotes. +If you can't figure out what I mean, click EditText to look at the source for this page. + +If you indent text + + like this, then it is indented in the output + + you can have multiple levels of indent + +And if you put asterisks at the start of the line + + * you get a + * bulleted + * list + * which can also be indented + * to several levels + +To insert program source without reformatting in a monospace font, use three curly braces: + +{{{ + public static void main(String[] args) { + out.println("Hello"); + } +}}} + +Just like that. + +Now click EditText in the footer to see the markup for this page, and try it yourself in PikiSandBox. + +---- +Contributors and PikiGurus: JohnFarrell, MartinPool \ No newline at end of file diff --git a/fniki/default_files/wikitext/FindPage b/fniki/default_files/wikitext/FindPage new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/FindPage @@ -0,0 +1,29 @@ +Here are some good starting points for browsing: + + * FrontPage -- top of this system + * RecentChanges recorded automatically + * TipsForBeginners + * TitleIndex -- all pages in the database + * WordIndex -- all words in all titles + +---- +The following interface only works if you are running the wiki +locally. No in Freenet search ;-) +---- + +You can use this page to search all entries in PikiPiki. Searches are not case sensitive. + +Here's a title search. Try something like ''manager'': + + [[TitleSearch]] + +Here's a full-text search. + + [[FullSearch]] + +You can also use regular expressions, such as + +{{{ seriali[sz]e}}} + +Or go direct to a page, or create a new page by entering its name here: + [[GoTo]] \ No newline at end of file diff --git a/fniki/default_files/wikitext/FreenetOnlyFeatures b/fniki/default_files/wikitext/FreenetOnlyFeatures new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/FreenetOnlyFeatures @@ -0,0 +1,13 @@ +Links to freenet URIs are automatically hypertexted but they only work when the wiki is inserted into Freenet. + +freenet:USK@qd-hk0vHYg7YvK2BQsJMcUD5QSF0tDkgnnF6lnWUH0g,xTFOV9ddCQQk6vQ6G~jfL6IzRUgmfMcZJ6nuySu~NUc,AQACAAE/activelink-index-text/81/ + +Normal 'http:' links are also hypertexted. They will automatically be converted into the _CHECKED_HTTP_ links when the wiki is inserted into freenet. + +Images with links to Freenet URIs are supported, but you can only see them when the wiki is inserted into Freenet. + +''Remember'' to use 'freenet:' at the start of the URI. + +[[[freenet:USK@qd-hk0vHYg7YvK2BQsJMcUD5QSF0tDkgnnF6lnWUH0g,xTFOV9ddCQQk6vQ6G~jfL6IzRUgmfMcZJ6nuySu~NUc,AQACAAE/activelink-index-text/81/activelink.png|(alt tag for image)|(title tag for image]]] + +Use the edit text link below to view the markup for these features. \ No newline at end of file diff --git a/fniki/default_files/wikitext/FrontPage b/fniki/default_files/wikitext/FrontPage new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/FrontPage @@ -0,0 +1,24 @@ +'''Minimal wiki skeleton directory to start your wiki from''' + +fniki is based on PikiPiki. + +TitleIndex has a list of all pages. + +These pages have examples of wiki markup: + * TipsForBeginners, EditingTips, HorizontalRules + * FreenetOnlyFeatures + + +Removing pages isn't supported though the wiki interface (yet!). +You can manually remove pages by removing files from the: +{{{ +<repo root>/wiki_root/wikitext +}}} +directory. + +These pages have embedded macros. You might want to take a look at +the document source before you delete them. + + * FindPage,RecentChanges,TitleIndex, WordIndex + + diff --git a/fniki/default_files/wikitext/HorizontalRules b/fniki/default_files/wikitext/HorizontalRules new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/HorizontalRules @@ -0,0 +1,7 @@ +You can rule a line across the page by typing four or more dashes. In PikiPiki the number of dashes in a horizontal rule markup determine how thick it is: use them in moderation. (A suggestion from JohnFarrell.) + +--- +---- +----- +------ +------- \ No newline at end of file diff --git a/fniki/default_files/wikitext/PikiPiki b/fniki/default_files/wikitext/PikiPiki new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/PikiPiki @@ -0,0 +1,7 @@ +I'm using piki as the wiki engine for this project, mostly since it is so small and easy to understand / modify even if it is a little old. Thanks to MartinPool for making this code available. I started hacking from: + +sha1:e71779f4f8fea7dc851ffb1e74f18c613a94b086 piki-1.62.zip + +which I got here: + +http://sourcefrog.net/projects/piki/ diff --git a/fniki/default_files/wikitext/RecentChanges b/fniki/default_files/wikitext/RecentChanges new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/RecentChanges @@ -0,0 +1,1 @@ +[[RecentChanges]] \ No newline at end of file diff --git a/fniki/default_files/wikitext/TipsForBeginners b/fniki/default_files/wikitext/TipsForBeginners new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/TipsForBeginners @@ -0,0 +1,4 @@ + + * The highlighted PageTitle shows a list of all pages that link to the current page. It even works on pages that are not defined yet. + + * A question mark after a link (e.g. NoSuchPage) means that the page is not defined: you can click the question mark to offer a definition. \ No newline at end of file diff --git a/fniki/default_files/wikitext/TitleIndex b/fniki/default_files/wikitext/TitleIndex new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/TitleIndex @@ -0,0 +1,10 @@ +This is an index of all pages in PikiPiki. + +See also: + + * WordIndex -- a permuted index of all words occuring in titles + * RecentChanges + +---- + +[[TitleIndex]] \ No newline at end of file diff --git a/fniki/default_files/wikitext/UploadFile b/fniki/default_files/wikitext/UploadFile new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/UploadFile @@ -0,0 +1,1 @@ +Uploading files isn't implemented. \ No newline at end of file diff --git a/fniki/default_files/wikitext/WordIndex b/fniki/default_files/wikitext/WordIndex new file mode 100644 --- /dev/null +++ b/fniki/default_files/wikitext/WordIndex @@ -0,0 +1,10 @@ +This is an index of all words occuring in page titles. + +See also: + + * TitleIndex -- a shorter index + * RecentChanges + +---- + +[[WordIndex]] \ No newline at end of file diff --git a/fniki/piki.css b/fniki/default_files/www/piki.css rename from fniki/piki.css rename to fniki/default_files/www/piki.css diff --git a/fniki/pikipiki-logo.png b/fniki/default_files/www/pikipiki-logo.png rename from fniki/pikipiki-logo.png rename to fniki/default_files/www/pikipiki-logo.png diff --git a/fniki/piki.py b/fniki/piki.py --- a/fniki/piki.py +++ b/fniki/piki.py @@ -690,22 +690,13 @@ def set_data_dir_from_cfg(base_path=None reset_root_dir(root_dir) import shutil -def create_empty_wiki(base_path, www_src): +def create_default_wiki(base_path): if os.path.exists(base_path): raise IOError("The directory already exists.") - os.makedirs(base_path) - new_text = os.path.join(base_path, 'wikitext') - new_www = os.path.join(base_path, 'www') - os.makedirs(new_text) - os.makedirs(new_www) - out = open(os.path.join(new_text, 'FrontPage'), 'wt') - out.write("Empty wiki.\nStart editing :-)\n") - out.close() - if www_src is None: - return - for name in PIKI_REQUIRED_FILES: - shutil.copyfile(os.path.join(www_src, name), - os.path.join(new_www, name)) + + shutil.copytree(os.path.join(os.path.dirname(__file__), + 'default_files'), + base_path) def dump(output_dir, wiki_root): global form, scrub_links diff --git a/infocalypse/__init__.py b/infocalypse/__init__.py --- a/infocalypse/__init__.py +++ b/infocalypse/__init__.py @@ -740,7 +740,8 @@ cmdtable = { "fn-wiki": (infocalypse_wiki, [('', 'run', None, "start a local http server " + "displaying a wiki"), - ('', 'createconfig', None, "create default fnwiki.cfg"), + ('', 'createconfig', None, "create default fnwiki.cfg " + + "and skeleton wiki_root dir"), ('', 'http_port', 8081, "port for http server"), ('', 'http_bind', 'localhost', "interface http " + "listens on, '' to listen on all"),], diff --git a/infocalypse/wikicmds.py b/infocalypse/wikicmds.py --- a/infocalypse/wikicmds.py +++ b/infocalypse/wikicmds.py @@ -32,10 +32,7 @@ from pathhacks import add_parallel_sys_p add_parallel_sys_path('fniki') import servepiki -from piki import create_empty_wiki - -# piki's required files are in that directory. -PIKI_WWW_SRC = os.path.dirname(servepiki.__file__) +from piki import create_default_wiki def execute_wiki(ui_, repo, params): """ Run the wiki command. """ @@ -59,7 +56,7 @@ def execute_wiki(ui_, repo, params): raise util.Abort("The wiki_root subdirectory already exists! " + "Move it out of the way to continue.") - create_empty_wiki(os.path.join(repo.root, 'wiki_root'), PIKI_WWW_SRC) + create_default_wiki(os.path.join(repo.root, 'wiki_root')) ui_.status("Created skeleton wiki_root dir.\n") write_default_config(ui_, repo, True) return