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 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. == Help
  11. * [[creole|Creole Markup Language]]
  12. * [[access|Access Control for the site content]]
  13. * [[search|Help on Search]]
  14. """))
  15. CREOLE = mycreole.mycreole_help_pagecontent()
  16. CREOLE += mycreole.render_simple("""
  17. = Piki Markup
  18. | {{{[[rel_path_to_page|Name]]}}} | will result in a Link to the given wiki page. |
  19. | {{{<<subpages>>}}} | will result in a list of all subpages below the current page. |
  20. | {{{<<subpages=N,startswith>>}}} | will result in a list of subpages below the current page.\
  21. N will reduce the depth of the subpages to N. \
  22. startswith will reduce the hits to all pages starting with the given string. \
  23. You can give one or both Parameters. |
  24. | {{{<<allpages>>}}} | will result in a last of all pages. You can use [N,startswith] as with subpages. |
  25. """)
  26. ACCESS = mycreole.render_simple(_("""
  27. = TBD
  28. """))
  29. SEARCH = mycreole.render_simple(_(
  30. """
  31. = Search
  32. The search looks up full words in //title (page basename)// and //page_src (the creole source)// without giving \
  33. special search commands in the search string.
  34. === Search fields
  35. * title (TEXT)
  36. * page_src (TEXT)
  37. * creation_time (DATETIME)
  38. * modified_time (DATETIME)
  39. * modified_user (TEXT)
  40. == Search syntax (Whoosh)
  41. === Logic operators
  42. * AND
  43. ** **Example:** "foo AND bar" - Search will find all items with foo and bar.
  44. * OR
  45. ** **Example:** "foo OR bar" - Search will find all items with foo, bar or with foo and bar.
  46. * NOT
  47. ** **Example:** "foo NOT bar" - Search will find all items with foo and no bar.
  48. === Search in specific fields
  49. A search pattern like //foo:bar// does look for //bar// in the field named //foo//.
  50. This search pattern can also be combined with other search text via logical operators.
  51. === Search for specific content
  52. * **Wildcards:**
  53. * **Range:**
  54. ** From To:
  55. ** Above:
  56. ** Below:
  57. * **Named constants:**
  58. ** //now//: Current date
  59. ** //-[num]y//: Current date minus [num] years
  60. ** //+[num]mo//: Current date plus [num] months
  61. ** //-[num]d//: Current date minus [num] days
  62. ** ...
  63. == Examples
  64. * [[/search/?q=modified_user:system-page|modified_user:system-page]] results in a list of all system pages.
  65. * [[/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.
  66. """))
  67. help_pages = {
  68. 'main': MAIN,
  69. 'creole': CREOLE,
  70. 'access': ACCESS,
  71. 'search': SEARCH,
  72. }
  73. def actionbar(context, request, current_help_page=None, **kwargs):
  74. actionbar_entries = (
  75. ('1', 'Main'),
  76. ('2', 'Creole'),
  77. ('3', 'Access'),
  78. ('4', 'Search'),
  79. )
  80. for num, name in actionbar_entries:
  81. context[context.ACTIONBAR].append_entry(
  82. HELP_UID + '-%s' % name.lower(), # uid
  83. _(name), # name
  84. color_icon_url(request, num + '.png'), # icon
  85. pages.url_helpview(request, name.lower()), # url
  86. True, # left
  87. name.lower() == current_help_page, # active
  88. )