olelo 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. data/.gitignore +10 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +3 -0
  4. data/README.markdown +104 -0
  5. data/Rakefile +92 -0
  6. data/bin/olelo +5 -0
  7. data/config.ru +86 -0
  8. data/config/aspects.rb +256 -0
  9. data/config/config.yml.default +154 -0
  10. data/config/initializers/00-mime_types.rb +29 -0
  11. data/config/initializers/01-slim.rb +2 -0
  12. data/config/interwiki.yml +11 -0
  13. data/doc/AUTHORS +7 -0
  14. data/doc/LICENSE +22 -0
  15. data/lib/olelo.rb +39 -0
  16. data/lib/olelo/application.rb +294 -0
  17. data/lib/olelo/attributes.rb +285 -0
  18. data/lib/olelo/config.rb +88 -0
  19. data/lib/olelo/extensions.rb +252 -0
  20. data/lib/olelo/helper.rb +290 -0
  21. data/lib/olelo/hooks.rb +142 -0
  22. data/lib/olelo/html_safe.rb +29 -0
  23. data/lib/olelo/initializer.rb +76 -0
  24. data/lib/olelo/locale.rb +63 -0
  25. data/lib/olelo/locale.yml +284 -0
  26. data/lib/olelo/menu.rb +101 -0
  27. data/lib/olelo/middleware/blacklist.rb +25 -0
  28. data/lib/olelo/middleware/degrade_mime_type.rb +19 -0
  29. data/lib/olelo/middleware/flash.rb +97 -0
  30. data/lib/olelo/middleware/force_encoding.rb +41 -0
  31. data/lib/olelo/page.rb +266 -0
  32. data/lib/olelo/patch.rb +311 -0
  33. data/lib/olelo/plugin.rb +188 -0
  34. data/lib/olelo/repository.rb +225 -0
  35. data/lib/olelo/routing.rb +223 -0
  36. data/lib/olelo/templates.rb +30 -0
  37. data/lib/olelo/user.rb +132 -0
  38. data/lib/olelo/util.rb +233 -0
  39. data/lib/olelo/version.rb +3 -0
  40. data/lib/olelo/virtualfs.rb +161 -0
  41. data/lib/rack/olelo_patches.rb +33 -0
  42. data/lib/rack/relative_redirect.rb +44 -0
  43. data/lib/rack/static_cache.rb +93 -0
  44. data/lib/yard/addons.rb +1 -0
  45. data/lib/yard/addons/hook_handler.rb +25 -0
  46. data/lib/yard/addons/override_tag.rb +14 -0
  47. data/lib/yard/addons/route_handler.rb +33 -0
  48. data/lib/yard/addons/sanitize_anchor.rb +16 -0
  49. data/olelo.gemspec +31 -0
  50. data/plugins/aspects/changelog.rb +45 -0
  51. data/plugins/aspects/documentbrowser.rb +57 -0
  52. data/plugins/aspects/download.rb +11 -0
  53. data/plugins/aspects/highlight.rb +8 -0
  54. data/plugins/aspects/image.rb +41 -0
  55. data/plugins/aspects/imageinfo.rb +64 -0
  56. data/plugins/aspects/locale.yml +60 -0
  57. data/plugins/aspects/main.rb +199 -0
  58. data/plugins/aspects/pageinfo.rb +37 -0
  59. data/plugins/aspects/source.rb +6 -0
  60. data/plugins/aspects/subpages.rb +44 -0
  61. data/plugins/aspects/text.rb +9 -0
  62. data/plugins/blog/blog.css +1 -0
  63. data/plugins/blog/blog.scss +37 -0
  64. data/plugins/blog/locale.yml +12 -0
  65. data/plugins/blog/main.rb +85 -0
  66. data/plugins/editor/locale.yml +18 -0
  67. data/plugins/editor/markup/main.rb +3 -0
  68. data/plugins/editor/markup/script.js +10 -0
  69. data/plugins/editor/markup/script/00-jquery.textselection.js +267 -0
  70. data/plugins/editor/markup/script/01-olelo.markupeditor.js +116 -0
  71. data/plugins/editor/markup/script/init.js +10 -0
  72. data/plugins/editor/preview.rb +52 -0
  73. data/plugins/editor/recaptcha.rb +56 -0
  74. data/plugins/filters/creole.rb +37 -0
  75. data/plugins/filters/disposition.rb +9 -0
  76. data/plugins/filters/editsection.rb +67 -0
  77. data/plugins/filters/fix_img_tag.rb +16 -0
  78. data/plugins/filters/html_wrapper.rb +12 -0
  79. data/plugins/filters/interwiki.rb +19 -0
  80. data/plugins/filters/link_classifier.rb +26 -0
  81. data/plugins/filters/locale.yml +15 -0
  82. data/plugins/filters/main.rb +202 -0
  83. data/plugins/filters/markdown_nowiki.rb +15 -0
  84. data/plugins/filters/numbering.xsl +93 -0
  85. data/plugins/filters/orgmode.rb +6 -0
  86. data/plugins/filters/rubypants.rb +6 -0
  87. data/plugins/filters/s5/main.rb +32 -0
  88. data/plugins/filters/s5/s5.xsl +118 -0
  89. data/plugins/filters/tilt.rb +17 -0
  90. data/plugins/filters/toc.rb +50 -0
  91. data/plugins/filters/xhtml2latex.xsl +232 -0
  92. data/plugins/filters/xslt.rb +22 -0
  93. data/plugins/gallery/gallery.css +1 -0
  94. data/plugins/gallery/gallery.scss +28 -0
  95. data/plugins/gallery/main.rb +34 -0
  96. data/plugins/misc/fancybox/images/blank.gif +0 -0
  97. data/plugins/misc/fancybox/images/fancy_close.png +0 -0
  98. data/plugins/misc/fancybox/images/fancy_loading.png +0 -0
  99. data/plugins/misc/fancybox/images/fancy_nav_left.png +0 -0
  100. data/plugins/misc/fancybox/images/fancy_nav_right.png +0 -0
  101. data/plugins/misc/fancybox/images/fancy_shadow_e.png +0 -0
  102. data/plugins/misc/fancybox/images/fancy_shadow_n.png +0 -0
  103. data/plugins/misc/fancybox/images/fancy_shadow_ne.png +0 -0
  104. data/plugins/misc/fancybox/images/fancy_shadow_nw.png +0 -0
  105. data/plugins/misc/fancybox/images/fancy_shadow_s.png +0 -0
  106. data/plugins/misc/fancybox/images/fancy_shadow_se.png +0 -0
  107. data/plugins/misc/fancybox/images/fancy_shadow_sw.png +0 -0
  108. data/plugins/misc/fancybox/images/fancy_shadow_w.png +0 -0
  109. data/plugins/misc/fancybox/images/fancy_title_left.png +0 -0
  110. data/plugins/misc/fancybox/images/fancy_title_main.png +0 -0
  111. data/plugins/misc/fancybox/images/fancy_title_over.png +0 -0
  112. data/plugins/misc/fancybox/images/fancy_title_right.png +0 -0
  113. data/plugins/misc/fancybox/images/fancybox-x.png +0 -0
  114. data/plugins/misc/fancybox/images/fancybox-y.png +0 -0
  115. data/plugins/misc/fancybox/images/fancybox.png +0 -0
  116. data/plugins/misc/fancybox/jquery.fancybox.css +1 -0
  117. data/plugins/misc/fancybox/jquery.fancybox.scss +323 -0
  118. data/plugins/misc/fancybox/main.rb +4 -0
  119. data/plugins/misc/fancybox/script.js +37 -0
  120. data/plugins/misc/fancybox/script/00-jquery.mousewheel.js +84 -0
  121. data/plugins/misc/fancybox/script/01-jquery.easing.js +205 -0
  122. data/plugins/misc/fancybox/script/02-jquery.fancybox.js +1156 -0
  123. data/plugins/misc/fancybox/script/init.js +18 -0
  124. data/plugins/misc/system.rb +192 -0
  125. data/plugins/misc/variables.rb +29 -0
  126. data/plugins/misc/webdav.rb +45 -0
  127. data/plugins/repositories/git_grep.rb +69 -0
  128. data/plugins/repositories/gitrb_repository.rb +204 -0
  129. data/plugins/repositories/locale.yml +12 -0
  130. data/plugins/repositories/rugged_repository.rb +454 -0
  131. data/plugins/security/acl.rb +57 -0
  132. data/plugins/security/basic_auth.rb +21 -0
  133. data/plugins/security/locale.yml +21 -0
  134. data/plugins/security/persistent_login.rb +32 -0
  135. data/plugins/security/portal.rb +28 -0
  136. data/plugins/security/private_wiki.rb +24 -0
  137. data/plugins/security/readonly_wiki.rb +25 -0
  138. data/plugins/security/stack.rb +20 -0
  139. data/plugins/security/yamlfile.rb +66 -0
  140. data/plugins/tags/code.rb +6 -0
  141. data/plugins/tags/footnotes.rb +35 -0
  142. data/plugins/tags/gist-embed.css +123 -0
  143. data/plugins/tags/gist.rb +13 -0
  144. data/plugins/tags/html.rb +57 -0
  145. data/plugins/tags/include.rb +20 -0
  146. data/plugins/tags/main.rb +353 -0
  147. data/plugins/tags/math.rb +117 -0
  148. data/plugins/tags/scripting.rb +64 -0
  149. data/plugins/tags/sort.rb +7 -0
  150. data/plugins/tags/tabs.rb +20 -0
  151. data/plugins/treeview/images/collapsed.png +0 -0
  152. data/plugins/treeview/images/expanded.png +0 -0
  153. data/plugins/treeview/images/menu.png +0 -0
  154. data/plugins/treeview/images/tree.png +0 -0
  155. data/plugins/treeview/images/wait.gif +0 -0
  156. data/plugins/treeview/main.rb +16 -0
  157. data/plugins/treeview/script.js +5 -0
  158. data/plugins/treeview/script/00-jquery.treeview.js +164 -0
  159. data/plugins/treeview/script/init.js +25 -0
  160. data/plugins/treeview/treeview.css +1 -0
  161. data/plugins/treeview/treeview.scss +113 -0
  162. data/plugins/utils/assets.rb +74 -0
  163. data/plugins/utils/cache.rb +53 -0
  164. data/plugins/utils/image_magick.rb +34 -0
  165. data/plugins/utils/pygments.css +1 -0
  166. data/plugins/utils/pygments.rb +50 -0
  167. data/plugins/utils/pygments.scss +83 -0
  168. data/plugins/utils/semaphore.rb +50 -0
  169. data/plugins/utils/shell.rb +45 -0
  170. data/plugins/utils/store.rb +315 -0
  171. data/plugins/utils/worker.rb +36 -0
  172. data/plugins/utils/xml.rb +29 -0
  173. data/static/images/favicon.png +0 -0
  174. data/static/script.js +267 -0
  175. data/static/script/00-json2.js +486 -0
  176. data/static/script/01-jstorage.js +217 -0
  177. data/static/script/02-jquery.js +9440 -0
  178. data/static/script/03-jquery.ui.core.js +337 -0
  179. data/static/script/04-jquery.ui.widget.js +502 -0
  180. data/static/script/05-jquery.ui.position.js +517 -0
  181. data/static/script/06-jquery.ui.menu.js +609 -0
  182. data/static/script/07-jquery.ui.autocomplete.js +601 -0
  183. data/static/script/08-olelo.i18n.js +37 -0
  184. data/static/script/09-olelo.unsaved.js +68 -0
  185. data/static/script/10-olelo.historytable.js +40 -0
  186. data/static/script/11-olelo.pagination.js +18 -0
  187. data/static/script/13-olelo.tabwidget.js +57 -0
  188. data/static/script/14-olelo.timeago.js +70 -0
  189. data/static/script/15-olelo.underliner.js +31 -0
  190. data/static/script/16-olelo.ui.combobox.js +32 -0
  191. data/static/script/init.js +48 -0
  192. data/static/themes/atlantis/constants.scss +15 -0
  193. data/static/themes/atlantis/iehacks.scss +38 -0
  194. data/static/themes/atlantis/images/actions/delete.png +0 -0
  195. data/static/themes/atlantis/images/actions/edit.png +0 -0
  196. data/static/themes/atlantis/images/actions/history.png +0 -0
  197. data/static/themes/atlantis/images/actions/home.png +0 -0
  198. data/static/themes/atlantis/images/actions/move.png +0 -0
  199. data/static/themes/atlantis/images/actions/new.png +0 -0
  200. data/static/themes/atlantis/images/actions/page.png +0 -0
  201. data/static/themes/atlantis/images/bg/button.png +0 -0
  202. data/static/themes/atlantis/images/bg/container.png +0 -0
  203. data/static/themes/atlantis/images/bg/content.png +0 -0
  204. data/static/themes/atlantis/images/bg/footer.png +0 -0
  205. data/static/themes/atlantis/images/bg/header.jpg +0 -0
  206. data/static/themes/atlantis/images/bg/header.orig.jpg +0 -0
  207. data/static/themes/atlantis/images/bg/header_gray.jpg +0 -0
  208. data/static/themes/atlantis/images/bug.png +0 -0
  209. data/static/themes/atlantis/images/filetypes/7z.png +0 -0
  210. data/static/themes/atlantis/images/filetypes/_archive.png +0 -0
  211. data/static/themes/atlantis/images/filetypes/_audio.png +0 -0
  212. data/static/themes/atlantis/images/filetypes/_code.png +0 -0
  213. data/static/themes/atlantis/images/filetypes/_linux.png +0 -0
  214. data/static/themes/atlantis/images/filetypes/_picture.png +0 -0
  215. data/static/themes/atlantis/images/filetypes/_video.png +0 -0
  216. data/static/themes/atlantis/images/filetypes/bz2.png +0 -0
  217. data/static/themes/atlantis/images/filetypes/doc.png +0 -0
  218. data/static/themes/atlantis/images/filetypes/flac.png +0 -0
  219. data/static/themes/atlantis/images/filetypes/gz.png +0 -0
  220. data/static/themes/atlantis/images/filetypes/html.png +0 -0
  221. data/static/themes/atlantis/images/filetypes/java.png +0 -0
  222. data/static/themes/atlantis/images/filetypes/jpg.png +0 -0
  223. data/static/themes/atlantis/images/filetypes/midi.png +0 -0
  224. data/static/themes/atlantis/images/filetypes/mp3.png +0 -0
  225. data/static/themes/atlantis/images/filetypes/ogg.png +0 -0
  226. data/static/themes/atlantis/images/filetypes/pdf.png +0 -0
  227. data/static/themes/atlantis/images/filetypes/php.png +0 -0
  228. data/static/themes/atlantis/images/filetypes/png.png +0 -0
  229. data/static/themes/atlantis/images/filetypes/ppt.png +0 -0
  230. data/static/themes/atlantis/images/filetypes/psd.png +0 -0
  231. data/static/themes/atlantis/images/filetypes/rar.png +0 -0
  232. data/static/themes/atlantis/images/filetypes/rb.png +0 -0
  233. data/static/themes/atlantis/images/filetypes/sh.png +0 -0
  234. data/static/themes/atlantis/images/filetypes/tar.png +0 -0
  235. data/static/themes/atlantis/images/filetypes/txt.png +0 -0
  236. data/static/themes/atlantis/images/filetypes/wma.png +0 -0
  237. data/static/themes/atlantis/images/filetypes/xls.png +0 -0
  238. data/static/themes/atlantis/images/filetypes/zip.png +0 -0
  239. data/static/themes/atlantis/images/folder.png +0 -0
  240. data/static/themes/atlantis/images/folder_open.png +0 -0
  241. data/static/themes/atlantis/images/loading.gif +0 -0
  242. data/static/themes/atlantis/images/loading.xcf +0 -0
  243. data/static/themes/atlantis/images/not_found.png +0 -0
  244. data/static/themes/atlantis/images/page.png +0 -0
  245. data/static/themes/atlantis/images/search.png +0 -0
  246. data/static/themes/atlantis/layout.scss +115 -0
  247. data/static/themes/atlantis/menu.scss +99 -0
  248. data/static/themes/atlantis/print.scss +129 -0
  249. data/static/themes/atlantis/screen.scss +495 -0
  250. data/static/themes/atlantis/style.css +3 -0
  251. data/static/themes/lib/autocomplete.scss +39 -0
  252. data/static/themes/lib/headlines.scss +10 -0
  253. data/static/themes/lib/horizontal-list.scss +31 -0
  254. data/static/themes/lib/patch.scss +88 -0
  255. data/static/themes/lib/reset.scss +114 -0
  256. data/static/themes/lib/rounded.scss +46 -0
  257. data/static/themes/lib/shadow.scss +14 -0
  258. data/test/config_test.rb +28 -0
  259. data/test/factory_test.rb +29 -0
  260. data/test/hash_extensions_test.rb +16 -0
  261. data/test/helper.rb +38 -0
  262. data/test/hooks_test.rb +85 -0
  263. data/test/object_extensions_test.rb +20 -0
  264. data/test/page_test.rb +168 -0
  265. data/test/request_test.rb +166 -0
  266. data/test/string_extensions_test.rb +32 -0
  267. data/test/templates_test.rb +39 -0
  268. data/test/util_test.rb +71 -0
  269. data/views/changes.slim +22 -0
  270. data/views/compare.slim +8 -0
  271. data/views/delete.slim +9 -0
  272. data/views/deleted.slim +2 -0
  273. data/views/edit.slim +65 -0
  274. data/views/error.slim +6 -0
  275. data/views/history.slim +20 -0
  276. data/views/layout.slim +38 -0
  277. data/views/login.slim +37 -0
  278. data/views/move.slim +10 -0
  279. data/views/not_found.slim +6 -0
  280. data/views/profile.slim +26 -0
  281. data/views/show.slim +9 -0
  282. metadata +488 -0
@@ -0,0 +1,15 @@
1
+ description 'Markdown nowiki filter'
2
+
3
+ Filter.create :markdown_nowiki do |context, content|
4
+ output = ''
5
+ until content.blank?
6
+ case content
7
+ when /(\A( {4}|\t).*)|(\A``.*?``)|(\A`[^`]*`)/
8
+ output << "<notags>#{$&}</notags>"
9
+ when /(\A[^`\n]+)|(\A\n+)/
10
+ output << $&
11
+ end
12
+ content = $'
13
+ end
14
+ output
15
+ end
@@ -0,0 +1,93 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ Add headline numbering to XHTML
4
+ -->
5
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6
+ xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0">
7
+
8
+ <xsl:output method="xml"
9
+ version="1.0"
10
+ encoding="UTF-8"
11
+ doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
12
+ doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" indent="yes"/>
13
+
14
+ <xsl:strip-space elements="*"/>
15
+
16
+ <!-- Identity template -->
17
+ <xsl:template match="@*|node()">
18
+ <xsl:copy>
19
+ <xsl:apply-templates select="@*|node()"/>
20
+ </xsl:copy>
21
+ </xsl:template>
22
+
23
+ <xsl:template match="xhtml:h2">
24
+ <xsl:variable name="number">
25
+ <xsl:number count="xhtml:h2" level="any"/>
26
+ </xsl:variable>
27
+ <h2 id="s{$number}">
28
+ <span class="number"><xsl:value-of select="$number"/></span>
29
+ <xsl:text>
30
+ </xsl:text>
31
+ <xsl:apply-templates select="@*|node()"/>
32
+ </h2>
33
+ </xsl:template>
34
+
35
+ <xsl:template match="xhtml:h3">
36
+ <xsl:variable name="number">
37
+ <xsl:number count="xhtml:h2" level="any" format="1."/>
38
+ <xsl:number count="xhtml:h3" from="xhtml:h2" level="any"/>
39
+ </xsl:variable>
40
+ <h3 id="s{$number}">
41
+ <span class="number"><xsl:value-of select="$number"/></span>
42
+ <xsl:text>
43
+ </xsl:text>
44
+ <xsl:apply-templates select="@*|node()"/>
45
+ </h3>
46
+ </xsl:template>
47
+
48
+ <xsl:template match="xhtml:h4">
49
+ <xsl:variable name="number">
50
+ <xsl:number count="xhtml:h2" level="any" format="1."/>
51
+ <xsl:number count="xhtml:h3" from="xhtml:h2" level="any" format="1."/>
52
+ <xsl:number count="xhtml:h4" from="xhtml:h3" level="any"/>
53
+ </xsl:variable>
54
+ <h4 id="s{$number}">
55
+ <span class="number"><xsl:value-of select="$number"/></span>
56
+ <xsl:text>
57
+ </xsl:text>
58
+ <xsl:apply-templates select="@*|node()"/>
59
+ </h4>
60
+ </xsl:template>
61
+
62
+ <xsl:template match="xhtml:h5">
63
+ <xsl:variable name="number">
64
+ <xsl:number count="xhtml:h2" level="any" format="1."/>
65
+ <xsl:number count="xhtml:h3" from="xhtml:h2" level="any" format="1."/>
66
+ <xsl:number count="xhtml:h4" from="xhtml:h3" level="any" format="1."/>
67
+ <xsl:number count="xhtml:h5" from="xhtml:h4" level="any"/>
68
+ </xsl:variable>
69
+ <h5 id="s{$number}">
70
+ <span><xsl:value-of select="$number"/></span>
71
+ <xsl:text>
72
+ </xsl:text>
73
+ <xsl:apply-templates select="@*|node()"/>
74
+ </h5>
75
+ </xsl:template>
76
+
77
+ <xsl:template match="xhtml:h6">
78
+ <xsl:variable name="number">
79
+ <xsl:number count="xhtml:h2" level="any" format="1."/>
80
+ <xsl:number count="xhtml:h3" from="xhtml:h2" level="any" format="1."/>
81
+ <xsl:number count="xhtml:h4" from="xhtml:h3" level="any" format="1."/>
82
+ <xsl:number count="xhtml:h5" from="xhtml:h4" level="any" format="1."/>
83
+ <xsl:number count="xhtml:h6" from="xhtml:h5" level="any"/>
84
+ </xsl:variable>
85
+ <h6 id="s{$number}">
86
+ <span class="number"><xsl:value-of select="$number"/></span>
87
+ <xsl:text>
88
+ </xsl:text>
89
+ <xsl:apply-templates select="@*|node()"/>
90
+ </h6>
91
+ </xsl:template>
92
+
93
+ </xsl:stylesheet>
@@ -0,0 +1,6 @@
1
+ description 'Emacs org-mode filter'
2
+ require 'org-ruby'
3
+
4
+ Filter.create :orgmode do |context, content|
5
+ ::Orgmode::Parser.new(content).to_html
6
+ end
@@ -0,0 +1,6 @@
1
+ description 'Filter which fixes punctuation'
2
+ require 'rubypants'
3
+
4
+ Filter.create :rubypants do |context, content|
5
+ ::RubyPants.new(content).to_html
6
+ end
@@ -0,0 +1,32 @@
1
+ description 'XSLT filter which transforms a html page to a S5 presentation'
2
+ dependencies 'filters/xslt', 'utils/assets'
3
+ export_assets 'ui/**/*', 'ui/default/*'
4
+
5
+ Page.attributes do
6
+ group :s5 do
7
+ string :presdate
8
+ string :author
9
+ string :company
10
+ string :theme
11
+ string :transitions
12
+ integer :fadeDuration
13
+ integer :incrDuration
14
+ end
15
+ end
16
+
17
+ class S5 < XSLT
18
+ def configure(options)
19
+ super(options.merge(:stylesheet => 's5/s5.xsl'))
20
+ end
21
+
22
+ def params(context)
23
+ themes = Dir.glob(File.join(File.dirname(__FILE__), 'ui', '*')).map {|name| File.basename(name) }
24
+ themes.delete('common')
25
+ themes.delete('default')
26
+ themes.unshift(context.page.attributes['theme'] || 'default')
27
+ super.merge(context.page.attributes['s5'] || {}).
28
+ merge('themes' => themes.join(' '), 's5_path' => build_path('_/assets/filter/s5'))
29
+ end
30
+ end
31
+
32
+ Filter.register :s5, S5
@@ -0,0 +1,118 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <xsl:stylesheet version="1.0"
3
+ xmlns:xhtml="http://www.w3.org/1999/xhtml"
4
+ xmlns="http://www.w3.org/1999/xhtml"
5
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
7
+ exclude-result-prefixes="xhtml xsl xs">
8
+
9
+ <xsl:param name="s5_path"/>
10
+ <xsl:param name="title"/>
11
+ <xsl:param name="presdate"/>
12
+ <xsl:param name="author"/>
13
+ <xsl:param name="company"/>
14
+ <xsl:param name="themes"/>
15
+ <xsl:param name="transitions"/>
16
+ <xsl:param name="fadeDuration"/>
17
+ <xsl:param name="incrDuration"/>
18
+
19
+ <xsl:output method="xml"
20
+ version="1.0"
21
+ encoding="UTF-8"
22
+ doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
23
+ doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" indent="yes"/>
24
+
25
+ <xsl:strip-space elements="*"/>
26
+
27
+ <!-- Identity template -->
28
+ <xsl:template match="@*|node()">
29
+ <xsl:copy>
30
+ <xsl:apply-templates select="@*|node()"/>
31
+ </xsl:copy>
32
+ </xsl:template>
33
+
34
+ <xsl:template name="slidecontent">
35
+ <xsl:param name="current"/>
36
+ <xsl:for-each select="child::node()[name() != 'h1' and name() != 'h2' and name() != 'h3' and name() != 'h4' and name() != 'h5' and name() != 'h6' and
37
+ (preceding::xhtml:h1|preceding::xhtml:h2|preceding::xhtml:h3|preceding::xhtml:h4|preceding::xhtml:h5|preceding::xhtml:h6)[last()] = $current]">
38
+ <xsl:copy>
39
+ <xsl:copy-of select="@*"/>
40
+ <xsl:call-template name="slidecontent">
41
+ <xsl:with-param name="current" select="$current"/>
42
+ </xsl:call-template>
43
+ </xsl:copy>
44
+ </xsl:for-each>
45
+ </xsl:template>
46
+
47
+ <xsl:template name="slides">
48
+ <xsl:for-each select="//xhtml:h1|//xhtml:h2|//xhtml:h3|//xhtml:h4|//xhtml:h5|//xhtml:h6">
49
+ <div class="slide">
50
+ <h1><xsl:apply-templates select="@*|node()"/></h1>
51
+ <div class="slidecontent">
52
+ <xsl:variable name="current" select="."/>
53
+ <xsl:for-each select="following-sibling::node()[name() != 'h1' and name() != 'h2' and name() != 'h3' and name() != 'h4' and name() != 'h5' and name() != 'h6' and
54
+ (preceding::xhtml:h1|preceding::xhtml:h2|preceding::xhtml:h3|preceding::xhtml:h4|preceding::xhtml:h5|preceding::xhtml:h6)[last()] = $current]">
55
+ <xsl:copy>
56
+ <xsl:copy-of select="@*"/>
57
+ <xsl:call-template name="slidecontent">
58
+ <xsl:with-param name="current" select="$current"/>
59
+ </xsl:call-template>
60
+ </xsl:copy>
61
+ </xsl:for-each>
62
+ </div>
63
+ </div>
64
+ </xsl:for-each>
65
+ </xsl:template>
66
+
67
+ <xsl:template match="xhtml:head">
68
+ <xsl:copy>
69
+ <xsl:apply-templates select="@*|node()"/>
70
+ <!-- metadata -->
71
+ <meta name="generator" content="S5"/>
72
+ <meta name="version" content="S5 1.3"/>
73
+ <xsl:if test="$presdate"><meta name="presdate" content="{$presdate}"/></xsl:if>
74
+ <xsl:if test="$author"><meta name="author" content="{$author}"/></xsl:if>
75
+ <xsl:if test="$company"><meta name="company" content="{$company}"/></xsl:if>
76
+ <!-- configuration parameters -->
77
+ <xsl:if test="$transitions"><meta name="transitions" content="{$transitions}"/></xsl:if>
78
+ <xsl:if test="$fadeDuration"><meta name="fadeDuration" content="{$fadeDuration}"/></xsl:if>
79
+ <xsl:if test="$incrDuration"><meta name="incrDuration" content="{$incrDuration}"/></xsl:if>
80
+ <meta name="themes" content="{$themes}"/>
81
+ <xsl:value-of select="concat('&lt;script src=&quot;', $s5_path, '/ui/common/jquery.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;')"
82
+ disable-output-escaping="yes"/>
83
+ <xsl:value-of select="concat('&lt;script src=&quot;', $s5_path, '/ui/common/s5.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;')"
84
+ disable-output-escaping="yes"/>
85
+ </xsl:copy>
86
+ </xsl:template>
87
+
88
+ <xsl:template name="first-slide">
89
+ <xsl:for-each select="child::node()[name() != 'h1' and name() != 'h2' and name() != 'h3' and name() != 'h4' and name() != 'h5' and name() != 'h6' and
90
+ not(preceding::xhtml:h1|preceding::xhtml:h2|preceding::xhtml:h3|preceding::xhtml:h4|preceding::xhtml:h5|preceding::xhtml:h6)]">
91
+ <xsl:copy>
92
+ <xsl:copy-of select="@*"/>
93
+ <xsl:call-template name="first-slide"/>
94
+ </xsl:copy>
95
+ </xsl:for-each>
96
+ </xsl:template>
97
+
98
+ <xsl:template match="xhtml:body">
99
+ <xsl:copy>
100
+ <div class="layout">
101
+ <div id="header"></div>
102
+ <div id="footer">
103
+ <h1><xsl:value-of select="$presdate"/></h1>
104
+ <h2><xsl:value-of select="$title"/></h2>
105
+ </div>
106
+ </div>
107
+ <div class="presentation">
108
+ <div class="slide">
109
+ <h1><xsl:value-of select="$title"/></h1>
110
+ <xsl:if test="$author!=''"><h2><xsl:value-of select="$author"/></h2></xsl:if>
111
+ <xsl:call-template name="first-slide"/>
112
+ </div>
113
+ <xsl:call-template name="slides"/>
114
+ </div>
115
+ </xsl:copy>
116
+ </xsl:template>
117
+
118
+ </xsl:stylesheet>
@@ -0,0 +1,17 @@
1
+ description 'Tilt filter'
2
+ require 'tilt'
3
+
4
+ class TiltFilter < Filter
5
+ def filter(context, content)
6
+ ::Tilt[name].new { content }.render
7
+ end
8
+ end
9
+
10
+ [:markdown, :textile, :sass, :scss, :less, :rdoc, :coffee, :mediawiki].each do |name|
11
+ begin
12
+ ::Tilt[name].new { '' } # Force initialization of tilt library
13
+ Filter.register(name, TiltFilter)
14
+ rescue Exception => ex
15
+ Olelo.logger.warn "Could not load Tilt filter #{name}"
16
+ end
17
+ end
@@ -0,0 +1,50 @@
1
+ description 'Auto-generated table of contents'
2
+ dependencies 'utils/xml'
3
+
4
+ Page.attributes do
5
+ boolean :toc
6
+ end
7
+
8
+ Filter.create :toc do |context, content|
9
+ return content if !context.page.attributes['toc']
10
+
11
+ doc = XML::Fragment(content)
12
+ toc = ''
13
+ level = 0
14
+ count = [0]
15
+
16
+ elem = doc.css('h1, h2, h3, h4, h5, h6').first
17
+ offset = elem ? elem.name[1..1].to_i - 1 : 0
18
+
19
+ doc.traverse do |child|
20
+ if child.name =~ /^h(\d)$/
21
+ nr = $1.to_i - offset
22
+ if nr > level
23
+ while nr > level
24
+ toc << (level == 0 ? '<ol class="toc">' : '<ol>')
25
+ count[level] = 0
26
+ level += 1
27
+ toc << '<li>' if nr > level
28
+ end
29
+ else
30
+ while nr < level
31
+ level -= 1
32
+ toc << '</li></ol>'
33
+ end
34
+ toc << '</li>'
35
+ end
36
+ count[level-1] += 1
37
+ headline = child.children.first ? child.children.first.inner_text : ''
38
+ section = ['sec', count[0..level-1], headline.strip.gsub(/[^\w]/, '-')].flatten.join('-').downcase
39
+ toc << %{<li class="toc#{level-offset+1}"><a href="##{section}">#{headline}</a>}
40
+ child.inner_html = %{<span class="number" id="#{section}">#{count[0..level-1].join('.')}</span> #{child.inner_html}}
41
+ end
42
+ end
43
+
44
+ while level > 0
45
+ level -= 1
46
+ toc << '</li></ol>'
47
+ end
48
+
49
+ toc + doc.to_xhtml
50
+ end
@@ -0,0 +1,232 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ XHTML to LaTeX Stylesheet von Daniel Mendler <mail at daniel-mendler dot de> (2008)
4
+ -->
5
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6
+ xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0"
7
+ xmlns:chr="http://character-table/">
8
+
9
+ <xsl:output method="text"/>
10
+ <xsl:strip-space elements="*"/>
11
+ <xsl:param name="root_path" />
12
+ <xsl:param name="http_host" />
13
+
14
+ <chr:char-table>
15
+ <chr:char val="&amp;" rep="\&amp;" />
16
+ <chr:char val="$" rep="\$" />
17
+ <chr:char val="#" rep="\#" />
18
+ <chr:char val="%" rep="\%" />
19
+ <chr:char val="_" rep="\_" />
20
+ <chr:char val="{" rep="\{" />
21
+ <chr:char val="}" rep="\}" />
22
+ <chr:char val="^" rep="\^" />
23
+ <chr:char val="~" rep="\~" />
24
+ <chr:char val="\" rep="\textbackslash " />
25
+ <chr:char val="&quot;" rep="&apos;&apos;" />
26
+ <chr:char val="°" rep="$^{\circ}$" />
27
+ </chr:char-table>
28
+
29
+ <xsl:template name="string-escape">
30
+ <xsl:param name="string" />
31
+ <xsl:param name="table" select="document('')/xsl:stylesheet/chr:char-table" />
32
+
33
+ <xsl:variable name="len" select="string-length($string)" />
34
+
35
+ <xsl:if test="$len &gt; 0">
36
+ <xsl:variable name="chr" select="substring($string, 1, 1)" />
37
+ <xsl:variable name="rep" select="string($table/chr:char[@val = $chr]/@rep)" />
38
+ <xsl:choose>
39
+ <xsl:when test="string($rep) = ''">
40
+ <xsl:value-of select="$chr" />
41
+ </xsl:when>
42
+ <xsl:otherwise>
43
+ <xsl:value-of select="$rep" />
44
+ </xsl:otherwise>
45
+ </xsl:choose>
46
+
47
+ <xsl:call-template name="string-escape">
48
+ <xsl:with-param name="string" select="substring($string, 2, $len div 2)" />
49
+ <xsl:with-param name="table" select="$table" />
50
+ </xsl:call-template>
51
+
52
+ <xsl:call-template name="string-escape">
53
+ <xsl:with-param name="string" select="substring($string, 2 + $len div 2, $len div 2)" />
54
+ <xsl:with-param name="table" select="$table" />
55
+ </xsl:call-template>
56
+ </xsl:if>
57
+ </xsl:template>
58
+
59
+ <xsl:template name="include-image">
60
+ <xsl:param name="src" />
61
+ <xsl:choose>
62
+ <xsl:when test="contains($src, '?')">
63
+ <xsl:text>\includegraphics{</xsl:text><xsl:value-of select="substring-before($src, '?')"/><xsl:text>}</xsl:text>
64
+ </xsl:when>
65
+ <xsl:otherwise>
66
+ <xsl:text>\includegraphics{</xsl:text><xsl:value-of select="$src"/><xsl:text>}</xsl:text>
67
+ </xsl:otherwise>
68
+ </xsl:choose>
69
+ </xsl:template>
70
+
71
+ <xsl:template match="//text()">
72
+ <xsl:call-template name="string-escape">
73
+ <xsl:with-param name="string" select="."/>
74
+ </xsl:call-template>
75
+ </xsl:template>
76
+
77
+ <xsl:template match="xhtml:html">\documentclass[a4paper,10pt]{article}
78
+ \usepackage[utf8]{inputenc}
79
+ \usepackage[ngerman]{babel}
80
+ \usepackage{longtable}
81
+ \usepackage[pdftex]{graphicx}
82
+ \usepackage{float}
83
+ \usepackage[colorlinks=true,urlcolor=blue,linkcolor=blue]{hyperref}
84
+ \usepackage{geometry}
85
+ \geometry{a4paper,left=2cm,right=2cm,top=2cm,bottom=2cm}
86
+ \setlength{\parindent}{0pt}
87
+ \renewcommand{\familydefault}{phv}
88
+ \renewcommand{\rmdefault}{phv}
89
+ \usefont{\encodingdefault}{\familydefault}{\seriesdefault}{\shapedefault}
90
+ \graphicspath{
91
+ {<xsl:value-of select="$root_path"/>}
92
+ }
93
+
94
+ \begin{document}
95
+
96
+ <xsl:apply-templates select="xhtml:body"/>\end{document}
97
+ </xsl:template>
98
+
99
+ <xsl:template match="xhtml:h1">
100
+ <xsl:text>\section*{</xsl:text>
101
+ <xsl:apply-templates/>
102
+ <xsl:text>}&#10;&#10;</xsl:text>
103
+ </xsl:template>
104
+
105
+ <xsl:template match="xhtml:h2">
106
+ <xsl:text>\subsection*{</xsl:text>
107
+ <xsl:apply-templates/>
108
+ <xsl:text>}&#10;&#10;</xsl:text>
109
+ </xsl:template>
110
+
111
+ <xsl:template match="xhtml:h3">
112
+ <xsl:text>\subsubsection*{</xsl:text>
113
+ <xsl:apply-templates/>
114
+ <xsl:text>}&#10;&#10;</xsl:text>
115
+ </xsl:template>
116
+
117
+ <xsl:template match="xhtml:br">
118
+ <xsl:text>&#10;&#10;</xsl:text>
119
+ </xsl:template>
120
+
121
+ <xsl:template match="xhtml:em">
122
+ <xsl:text>{\em </xsl:text>
123
+ <xsl:apply-templates/>
124
+ <xsl:text>}</xsl:text>
125
+ </xsl:template>
126
+
127
+ <xsl:template match="xhtml:img[@class='math']">
128
+ <xsl:text>\begin{equation}</xsl:text>
129
+ <xsl:value-of select="@alt"/>
130
+ <xsl:text>\end{equation}</xsl:text>
131
+ </xsl:template>
132
+
133
+ <xsl:template match="xhtml:table//xhtml:img">
134
+ <xsl:call-template name="include-image">
135
+ <xsl:with-param name="src" select="@src"/>
136
+ </xsl:call-template>
137
+ </xsl:template>
138
+
139
+ <xsl:template match="xhtml:img">
140
+ <xsl:text>\begin{figure}</xsl:text>
141
+ <xsl:text>\centering</xsl:text>
142
+ <xsl:call-template name="include-image">
143
+ <xsl:with-param name="src" select="@src"/>
144
+ </xsl:call-template>
145
+ <xsl:text>\end{figure}</xsl:text>
146
+ </xsl:template>
147
+
148
+ <xsl:template match="xhtml:strong">
149
+ <xsl:text>{\bf </xsl:text>
150
+ <xsl:apply-templates/>
151
+ <xsl:text>}</xsl:text>
152
+ </xsl:template>
153
+
154
+ <xsl:template match="xhtml:p">
155
+ <xsl:text>\par&#10;</xsl:text>
156
+ <xsl:apply-templates/>
157
+ <xsl:text>&#10;\par&#10;&#10;</xsl:text>
158
+ </xsl:template>
159
+
160
+ <xsl:template match="xhtml:a">
161
+ <xsl:choose>
162
+ <xsl:when test="starts-with(@href, 'http') or starts-with(@href, 'mailto')">
163
+ <xsl:text>\href{</xsl:text><xsl:value-of select="@href"/>}{<xsl:apply-templates/><xsl:text>}</xsl:text>
164
+ </xsl:when>
165
+ <xsl:otherwise>
166
+ <xsl:text>\href{</xsl:text><xsl:value-of select="concat($http_host, @href)"/>}{<xsl:apply-templates/><xsl:text>}</xsl:text>
167
+ </xsl:otherwise>
168
+ </xsl:choose>
169
+ </xsl:template>
170
+
171
+ <xsl:template match="xhtml:select|xhtml:input"/>
172
+
173
+ <xsl:template match="xhtml:table">
174
+ <xsl:text>\begin{table}[H]</xsl:text>
175
+ <xsl:for-each select="xhtml:caption">
176
+ <xsl:text>\caption{</xsl:text>
177
+ <xsl:apply-templates/>
178
+ <xsl:text>}&#10;</xsl:text>
179
+ </xsl:for-each>
180
+ <xsl:text>\begin{longtable}{|</xsl:text>
181
+ <xsl:for-each select="//xhtml:tr[1]/*">
182
+ <xsl:text>l|</xsl:text>
183
+ </xsl:for-each>
184
+ <xsl:text>}&#10;</xsl:text>
185
+ <xsl:apply-templates select="*[not(self::xhtml:caption)]"/>
186
+ <xsl:text>\hline&#10;</xsl:text>
187
+ <xsl:text>\end{longtable}&#10;\end{table}&#10;</xsl:text>
188
+ </xsl:template>
189
+
190
+ <xsl:template match="xhtml:thead">
191
+ <xsl:apply-templates/>
192
+ \hline&#10;
193
+ </xsl:template>
194
+
195
+ <xsl:template match="xhtml:tr">
196
+ <xsl:text>\hline&#10;</xsl:text>
197
+ <xsl:for-each select="*">
198
+ <xsl:if test="@colspan">\multicolumn{<xsl:value-of select="@colspan"/>}{l|}{</xsl:if>
199
+ <xsl:if test="name() = 'th'">{\bf </xsl:if>
200
+ <xsl:apply-templates />
201
+ <xsl:if test="name() = 'th'">}</xsl:if>
202
+ <xsl:if test="@colspan">}</xsl:if>
203
+ <xsl:if test="position() != last()">
204
+ <xsl:text> &amp; </xsl:text>
205
+ </xsl:if>
206
+ </xsl:for-each>
207
+ <xsl:text> \\&#10;</xsl:text>
208
+ </xsl:template>
209
+
210
+ <xsl:template match="xhtml:ul">
211
+ <xsl:text>\begin{itemize}&#10;</xsl:text>
212
+ <xsl:for-each select="xhtml:li">
213
+ <xsl:text> \item{</xsl:text>
214
+ <xsl:apply-templates />
215
+ <xsl:text>}&#10;</xsl:text>
216
+ </xsl:for-each>
217
+ <xsl:text>\end{itemize}&#10;&#10;</xsl:text>
218
+ </xsl:template>
219
+
220
+ <xsl:template match="xhtml:ol">
221
+ <xsl:text>\begin{enumerate}
222
+ </xsl:text>
223
+ <xsl:for-each select="xhtml:li">
224
+ <xsl:text>\item </xsl:text>
225
+ <xsl:apply-templates />
226
+ </xsl:for-each>
227
+ <xsl:text>
228
+ \end{enumerate}
229
+ </xsl:text>
230
+ </xsl:template>
231
+
232
+ </xsl:stylesheet>