Piki is a minimal wiki
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

help.py 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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)// and //page_src (the creole source)// without giving \
  37. special search commands in the search string.
  38. === Search fields
  39. * title (TEXT)
  40. * page_src (TEXT)
  41. * creation_time (DATETIME)
  42. * modified_time (DATETIME)
  43. * modified_user (TEXT)
  44. == Search syntax (Whoosh)
  45. === Logic operators
  46. * AND
  47. ** **Example:** "foo AND bar" - Search will find all items with foo and bar.
  48. * OR
  49. ** **Example:** "foo OR bar" - Search will find all items with foo, bar or with foo and bar.
  50. * NOT
  51. ** **Example:** "foo NOT bar" - Search will find all items with foo and no bar.
  52. === Search in specific fields
  53. A search pattern like //foo:bar// does look for //bar// in the field named //foo//.
  54. This search pattern can also be combined with other search text via logical operators.
  55. === Search for specific content
  56. * **Wildcards:**
  57. * **Range:**
  58. ** From To:
  59. ** Above:
  60. ** Below:
  61. * **Named constants:**
  62. ** //now//: Current date
  63. ** //-[num]y//: Current date minus [num] years
  64. ** //+[num]mo//: Current date plus [num] months
  65. ** //-[num]d//: Current date minus [num] days
  66. ** ...
  67. == Examples
  68. * [[/search/?q=modified_user:system-page|modified_user:system-page]] results in a list of all system pages.
  69. * [[/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.
  70. """))
  71. BACKUP = mycreole.render_simple(_(
  72. """
  73. = Backup
  74. With the following command, you create a backup of your piki. It contains out of two files. {{{pages.json}}} \
  75. includes userdata, bottombar configurations and so on. The pages are included in {{{pages.tgz}}}.
  76. {{{
  77. $ cd <PROJECT_DIRECTORY>
  78. $ source venv/bin/activate
  79. $ python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e sessions -e auth.Permission -e sessions -e pages --indent 2 > pages.json
  80. $ tar -czf pages.tgz data/pages data/media
  81. }}}
  82. = Recovery
  83. Be carefull with these commands. They delete all the data, before recovering from the backup files!
  84. {{{
  85. $ cd <PROJECT_DIRECTORY>
  86. $ source venv/bin/activate
  87. $ rm db.sqlite3
  88. $ rm -rf data/pages data/media
  89. $ python manage.py migrate
  90. $ python manage.py loaddata pages.json
  91. $ tar -xvzf pages.tgz
  92. }}}
  93. """))
  94. help_pages = {
  95. 'main': MAIN,
  96. 'creole': CREOLE,
  97. 'access': ACCESS,
  98. 'search': SEARCH,
  99. 'backup': BACKUP
  100. }
  101. def actionbar(context, request, current_help_page=None, **kwargs):
  102. actionbar_entries = (
  103. ('1', 'Main'),
  104. ('2', 'Creole'),
  105. ('3', 'Access'),
  106. ('4', 'Search'),
  107. ('5', 'Backup'),
  108. )
  109. for num, name in actionbar_entries:
  110. context[context.ACTIONBAR].append_entry(
  111. HELP_UID + '-%s' % name.lower(), # uid
  112. _(name), # name
  113. color_icon_url(request, num + '.png'), # icon
  114. pages.url_helpview(request, name.lower()), # url
  115. True, # left
  116. name.lower() == current_help_page, # active
  117. )