Piki is a minimal wiki
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

help.py 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. from django.utils.translation import gettext as _
  2. import mycreole
  3. import pages
  4. from themes import color_icon_url
  5. HELP_UID = 'help'
  6. MAIN = mycreole.render_simple(_(
  7. """
  8. = Piki
  9. **piki** is a minimal wiki implemented with python and django.
  10. == Get it
  11. For download and installation instructions, visit [[https://git.mount-mockery.de/application/piki]].
  12. == Help
  13. * [[creole|Creole Markup Language]]
  14. * [[access|Access Control for the site content]]
  15. * [[search|Help on Search]]
  16. """))
  17. CREOLE = mycreole.mycreole_help_pagecontent()
  18. CREOLE += mycreole.render_simple("""
  19. = Piki Markup
  20. | {{{[[rel_path_to_page|Name]]}}} | will result in a Link to the given wiki page. |
  21. | {{{<<subpages>>}}} | will result in a list of all subpages below the current page. |
  22. | {{{<<subpages=N,startswith>>}}} | will result in a list of subpages below the current page.\
  23. N will reduce the depth of the subpages to N. \
  24. startswith will reduce the hits to all pages starting with the given string. \
  25. You can give one or both Parameters. |
  26. | {{{<<allpages>>}}} | will result in a last of all pages. You can use [N,startswith] as with subpages. |
  27. """)
  28. ACCESS = mycreole.render_simple(_("""
  29. = Access
  30. * Currently just two specific users have write access.
  31. * Pages containing "private" in the relative page path have no public read access.
  32. """))
  33. SEARCH = mycreole.render_simple(_(
  34. """
  35. = Search
  36. The search looks up full words in //title (page basename)//, //page_src (the creole source)// and //tag (page tags)// \
  37. without giving special search commands in the search string.
  38. === Search fields
  39. * title (TEXT)
  40. * page_src (TEXT)
  41. * tag (TEXT)
  42. * creation_time (DATETIME)
  43. * modified_time (DATETIME)
  44. * modified_user (TEXT)
  45. == Search syntax (Whoosh)
  46. === Logic operators
  47. * AND
  48. ** **Example:** "foo AND bar" - Search will find all items with foo and bar.
  49. * OR
  50. ** **Example:** "foo OR bar" - Search will find all items with foo, bar or with foo and bar.
  51. * NOT
  52. ** **Example:** "foo NOT bar" - Search will find all items with foo and no bar.
  53. === Search in specific fields
  54. A search pattern like //foo:bar// does look for //bar// in the field named //foo//.
  55. This search pattern can also be combined with other search text via logical operators.
  56. === Search for specific content
  57. * **Wildcards:**
  58. * **Range:**
  59. ** From To:
  60. ** Above:
  61. ** Below:
  62. * **Named constants:**
  63. ** //now//: Current date
  64. ** //-[num]y//: Current date minus [num] years
  65. ** //+[num]mo//: Current date plus [num] months
  66. ** //-[num]d//: Current date minus [num] days
  67. ** ...
  68. == Examples
  69. * [[/search/?q=modified_user:system-page|modified_user:system-page]] results in a list of all system pages.
  70. * [[/search/?q=modified_time%3A%5B-5d+to+now%5D| modified_time:[-5d to now] ]] results in a list of all pages which have been modified within the last 5 days.
  71. * [[/search/?q=tag%3Afoo| tag:foo ]] results in a list of all pages which are tagged with //foo//.
  72. """))
  73. BACKUP = mycreole.render_simple(_(
  74. """
  75. = Backup
  76. With the following command, you create a backup of your piki. It contains out of two files. {{{pages.json}}} \
  77. includes userdata, bottombar configurations and so on. The pages are included in {{{pages.tgz}}}.
  78. {{{
  79. $ cd <PROJECT_DIRECTORY>
  80. $ source venv/bin/activate
  81. $ python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e sessions -e auth.Permission -e sessions -e pages --indent 2 > pages.json
  82. $ tar -czf pages.tgz data/pages data/media
  83. }}}
  84. = Recovery
  85. Be carefull with these commands. They delete all the data, before recovering from the backup files!
  86. {{{
  87. $ cd <PROJECT_DIRECTORY>
  88. $ source venv/bin/activate
  89. $ rm db.sqlite3
  90. $ rm -rf data/pages data/media
  91. $ python manage.py migrate
  92. $ python manage.py loaddata pages.json
  93. $ tar -xvzf pages.tgz
  94. }}}
  95. """))
  96. help_pages = {
  97. 'main': MAIN,
  98. 'creole': CREOLE,
  99. 'access': ACCESS,
  100. 'search': SEARCH,
  101. 'backup': BACKUP
  102. }
  103. def actionbar(context, request, current_help_page=None, **kwargs):
  104. actionbar_entries = (
  105. ('1', 'Main'),
  106. ('2', 'Creole'),
  107. ('3', 'Access'),
  108. ('4', 'Search'),
  109. ('5', 'Backup'),
  110. )
  111. for num, name in actionbar_entries:
  112. context[context.ACTIONBAR].append_entry(
  113. HELP_UID + '-%s' % name.lower(), # uid
  114. _(name), # name
  115. color_icon_url(request, num + '.png'), # icon
  116. pages.url_helpview(request, name.lower()), # url
  117. True, # left
  118. name.lower() == current_help_page, # active
  119. )