super-pro-rb 0.0.1

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 (252) hide show
  1. checksums.yaml +7 -0
  2. data/gollum-6.1.0/CONTRIBUTING.md +221 -0
  3. data/gollum-6.1.0/Dockerfile +57 -0
  4. data/gollum-6.1.0/Gemfile +30 -0
  5. data/gollum-6.1.0/HISTORY.md +229 -0
  6. data/gollum-6.1.0/LATEST_CHANGES.md +6 -0
  7. data/gollum-6.1.0/LICENSE +21 -0
  8. data/gollum-6.1.0/README.md +177 -0
  9. data/gollum-6.1.0/Rakefile +297 -0
  10. data/gollum-6.1.0/bin/gollum +301 -0
  11. data/gollum-6.1.0/bin/gollum-migrate-tags +283 -0
  12. data/gollum-6.1.0/config.rb +12 -0
  13. data/gollum-6.1.0/config.ru +12 -0
  14. data/gollum-6.1.0/contrib/automation/gollum-post +66 -0
  15. data/gollum-6.1.0/contrib/openrc/conf.d/gollum +3 -0
  16. data/gollum-6.1.0/contrib/openrc/init.d/gollum +36 -0
  17. data/gollum-6.1.0/contrib/systemd/gollum@.service +12 -0
  18. data/gollum-6.1.0/contrib/sysv-debian/init.d/gollum +79 -0
  19. data/gollum-6.1.0/docker-run.sh +24 -0
  20. data/gollum-6.1.0/gollum.gemspec +305 -0
  21. data/gollum-6.1.0/lib/gollum/app.rb +747 -0
  22. data/gollum-6.1.0/lib/gollum/assets.rb +33 -0
  23. data/gollum-6.1.0/lib/gollum/helpers.rb +74 -0
  24. data/gollum-6.1.0/lib/gollum/locales/cn.yml +103 -0
  25. data/gollum-6.1.0/lib/gollum/locales/en.yml +103 -0
  26. data/gollum-6.1.0/lib/gollum/public/assets/app-05adca32f8f4f3effe10f8f4cf26dfd6a419ba986bce60d3f51a97e4055d4113.js +30 -0
  27. data/gollum-6.1.0/lib/gollum/public/assets/app-05adca32f8f4f3effe10f8f4cf26dfd6a419ba986bce60d3f51a97e4055d4113.js.gz +0 -0
  28. data/gollum-6.1.0/lib/gollum/public/assets/app-e224b375d824f0171fc926d624dc0887bf453db83f485b1992bc0859c4110e3e.css +11 -0
  29. data/gollum-6.1.0/lib/gollum/public/assets/app-e224b375d824f0171fc926d624dc0887bf453db83f485b1992bc0859c4110e3e.css.gz +0 -0
  30. data/gollum-6.1.0/lib/gollum/public/assets/criticmarkup-7b66f7a53b854bc9e4168be5b4725ca38e2bc6e9c41d5c050a9f60d9a94cb405.css +1 -0
  31. data/gollum-6.1.0/lib/gollum/public/assets/criticmarkup-7b66f7a53b854bc9e4168be5b4725ca38e2bc6e9c41d5c050a9f60d9a94cb405.css.gz +0 -0
  32. data/gollum-6.1.0/lib/gollum/public/assets/editor-9bef5462bb5dae2db84d6d8d534b55c5bb5a430e11344b3c23f9ea4410312f52.js +165 -0
  33. data/gollum-6.1.0/lib/gollum/public/assets/editor-9bef5462bb5dae2db84d6d8d534b55c5bb5a430e11344b3c23f9ea4410312f52.js.gz +0 -0
  34. data/gollum-6.1.0/lib/gollum/public/assets/gollum.katex-e70c1d51a08ebfe759eecbb33fbed54f300ccd7fb8d0e86e251caaf4e50f6b68.js +9 -0
  35. data/gollum-6.1.0/lib/gollum/public/assets/gollum.katex-e70c1d51a08ebfe759eecbb33fbed54f300ccd7fb8d0e86e251caaf4e50f6b68.js.gz +0 -0
  36. data/gollum-6.1.0/lib/gollum/public/assets/gollum.mermaid-06fd2f5494199db250618043312c27770720504b50c3f6ca99d2d2df529c7da3.js +118 -0
  37. data/gollum-6.1.0/lib/gollum/public/assets/gollum.mermaid-06fd2f5494199db250618043312c27770720504b50c3f6ca99d2d2df529c7da3.js.gz +0 -0
  38. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  39. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  40. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  41. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  42. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  43. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
  44. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  45. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
  46. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
  47. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  48. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
  49. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  50. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  51. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  52. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
  53. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  54. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  55. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  56. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  57. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  58. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/katex-709d4191c4f005516a709377f79e468d343f4e6c91a29a6ff188d13d124ba55f.css +1 -0
  59. data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/katex-709d4191c4f005516a709377f79e468d343f4e6c91a29a6ff188d13d124ba55f.css.gz +0 -0
  60. data/gollum-6.1.0/lib/gollum/public/assets/print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css +1 -0
  61. data/gollum-6.1.0/lib/gollum/public/assets/print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css.gz +0 -0
  62. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/HOWTO_UPDATE_MATHJAX.md +21 -0
  63. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/a11y/assistive-mml.js +1 -0
  64. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/a11y/complexity.js +1 -0
  65. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/a11y/explorer.js +1 -0
  66. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/a11y/semantic-enrich.js +1 -0
  67. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/a11y/sre.js +1 -0
  68. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/adaptors/liteDOM.js +1 -0
  69. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/core.js +1 -0
  70. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/asciimath.js +1 -0
  71. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/mml/entities.js +1 -0
  72. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/mml/extensions/mml3.js +1 -0
  73. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/mml/extensions/mml3.sef.json +1 -0
  74. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/mml.js +1 -0
  75. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/action.js +1 -0
  76. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/all-packages.js +34 -0
  77. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/ams.js +1 -0
  78. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/amscd.js +1 -0
  79. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/autoload.js +1 -0
  80. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/bbox.js +1 -0
  81. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/boldsymbol.js +1 -0
  82. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/braket.js +1 -0
  83. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/bussproofs.js +1 -0
  84. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/cancel.js +1 -0
  85. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/cases.js +1 -0
  86. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/centernot.js +1 -0
  87. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/color.js +1 -0
  88. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/colortbl.js +1 -0
  89. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/colorv2.js +1 -0
  90. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/configmacros.js +1 -0
  91. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/empheq.js +1 -0
  92. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/enclose.js +1 -0
  93. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/extpfeil.js +1 -0
  94. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/gensymb.js +1 -0
  95. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/html.js +1 -0
  96. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/mathtools.js +1 -0
  97. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/mhchem.js +34 -0
  98. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/newcommand.js +1 -0
  99. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/noerrors.js +1 -0
  100. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/noundefined.js +1 -0
  101. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/physics.js +1 -0
  102. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/require.js +1 -0
  103. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/setoptions.js +1 -0
  104. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/tagformat.js +1 -0
  105. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/textcomp.js +1 -0
  106. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/textmacros.js +1 -0
  107. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/unicode.js +1 -0
  108. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/upgreek.js +1 -0
  109. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/verb.js +1 -0
  110. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex-base.js +1 -0
  111. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex-full.js +34 -0
  112. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex.js +1 -0
  113. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/latest.js +1 -0
  114. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/loader.js +1 -0
  115. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/node-main.js +1 -0
  116. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/tex.js +1 -0
  117. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
  118. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
  119. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
  120. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
  121. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
  122. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
  123. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
  124. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
  125. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
  126. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
  127. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
  128. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
  129. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
  130. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
  131. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
  132. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
  133. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
  134. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
  135. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
  136. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
  137. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
  138. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
  139. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
  140. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml.js +1 -0
  141. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/svg/fonts/tex.js +1 -0
  142. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/svg.js +1 -0
  143. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/base.json +29 -0
  144. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/ca.json +140 -0
  145. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/da.json +140 -0
  146. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/de.json +146 -0
  147. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/en.json +158 -0
  148. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/es.json +140 -0
  149. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/fr.json +146 -0
  150. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/hi.json +146 -0
  151. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/it.json +146 -0
  152. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/nb.json +146 -0
  153. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/nemeth.json +125 -0
  154. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/nn.json +146 -0
  155. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/sv.json +146 -0
  156. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/startup.js +1 -0
  157. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/tex-chtml-full-speech.js +34 -0
  158. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/tex-mml-chtml.js +1 -0
  159. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/ui/lazy.js +1 -0
  160. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/ui/menu.js +1 -0
  161. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/ui/safe.js +1 -0
  162. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/app.js +15 -0
  163. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/clipboard.min.js +7 -0
  164. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/date.min.js +123 -0
  165. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/gollum.editor.js +1277 -0
  166. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/asciidoc.js +117 -0
  167. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/bib.js +8 -0
  168. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/creole.js +70 -0
  169. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/default.js +201 -0
  170. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/markdown.js +119 -0
  171. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/mediawiki.js +122 -0
  172. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/org.js +128 -0
  173. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/plaintext.js +8 -0
  174. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/pod.js +93 -0
  175. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/rdoc.js +23 -0
  176. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/rest.js +187 -0
  177. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/textile.js +133 -0
  178. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/modes.js.erb +252 -0
  179. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/sections.js +87 -0
  180. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor.js +30 -0
  181. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.behaviors.js +40 -0
  182. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.dialog.js +263 -0
  183. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.js.erb +814 -0
  184. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.katex.js +3 -0
  185. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.mermaid.js +2 -0
  186. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.placeholder.js +54 -0
  187. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/identicon.js +205 -0
  188. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/jquery-1.9.1.min.js +5 -0
  189. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/jquery.resize.js +164 -0
  190. data/gollum-6.1.0/lib/gollum/public/gollum/javascript/polyfills.js +6 -0
  191. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/_base.scss +13 -0
  192. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/_breakpoint.scss +22 -0
  193. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/_features.scss +84 -0
  194. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/_spinners.scss +245 -0
  195. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/app.scss +16 -0
  196. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/criticmarkup.scss +42 -0
  197. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/dialog.scss +140 -0
  198. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/editor.scss +217 -0
  199. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/emoji.scss +5 -0
  200. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/highlights.scss +196 -0
  201. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/print.scss +16 -0
  202. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/spinner.scss +9 -0
  203. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/tables.scss +47 -0
  204. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/template.scss.erb +204 -0
  205. data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/wiki_content.scss +144 -0
  206. data/gollum-6.1.0/lib/gollum/templates/commit.mustache +29 -0
  207. data/gollum-6.1.0/lib/gollum/templates/compare.mustache +84 -0
  208. data/gollum-6.1.0/lib/gollum/templates/create.mustache +26 -0
  209. data/gollum-6.1.0/lib/gollum/templates/edit.mustache +24 -0
  210. data/gollum-6.1.0/lib/gollum/templates/editor.mustache +215 -0
  211. data/gollum-6.1.0/lib/gollum/templates/error.mustache +8 -0
  212. data/gollum-6.1.0/lib/gollum/templates/history.mustache +51 -0
  213. data/gollum-6.1.0/lib/gollum/templates/history_authors/gravatar.mustache +2 -0
  214. data/gollum-6.1.0/lib/gollum/templates/history_authors/identicon.mustache +2 -0
  215. data/gollum-6.1.0/lib/gollum/templates/history_authors/none.mustache +2 -0
  216. data/gollum-6.1.0/lib/gollum/templates/latest_changes.mustache +36 -0
  217. data/gollum-6.1.0/lib/gollum/templates/layout.mustache +140 -0
  218. data/gollum-6.1.0/lib/gollum/templates/mobilenav.mustache +72 -0
  219. data/gollum-6.1.0/lib/gollum/templates/navbar.mustache +110 -0
  220. data/gollum-6.1.0/lib/gollum/templates/overview.mustache +55 -0
  221. data/gollum-6.1.0/lib/gollum/templates/page.mustache +13 -0
  222. data/gollum-6.1.0/lib/gollum/templates/pagination.mustache +23 -0
  223. data/gollum-6.1.0/lib/gollum/templates/search.mustache +51 -0
  224. data/gollum-6.1.0/lib/gollum/templates/searchbar.mustache +3 -0
  225. data/gollum-6.1.0/lib/gollum/templates/wiki_content.mustache +64 -0
  226. data/gollum-6.1.0/lib/gollum/uri_encode_component.rb +212 -0
  227. data/gollum-6.1.0/lib/gollum/views/commit.rb +49 -0
  228. data/gollum-6.1.0/lib/gollum/views/compare.rb +109 -0
  229. data/gollum-6.1.0/lib/gollum/views/create.rb +53 -0
  230. data/gollum-6.1.0/lib/gollum/views/edit.rb +78 -0
  231. data/gollum-6.1.0/lib/gollum/views/editable.rb +31 -0
  232. data/gollum-6.1.0/lib/gollum/views/error.rb +7 -0
  233. data/gollum-6.1.0/lib/gollum/views/has_math.rb +15 -0
  234. data/gollum-6.1.0/lib/gollum/views/has_page.rb +19 -0
  235. data/gollum-6.1.0/lib/gollum/views/has_user_icons.rb +15 -0
  236. data/gollum-6.1.0/lib/gollum/views/helpers/locale_helpers.rb +89 -0
  237. data/gollum-6.1.0/lib/gollum/views/helpers.rb +132 -0
  238. data/gollum-6.1.0/lib/gollum/views/history.rb +56 -0
  239. data/gollum-6.1.0/lib/gollum/views/latest_changes.rb +44 -0
  240. data/gollum-6.1.0/lib/gollum/views/layout.rb +103 -0
  241. data/gollum-6.1.0/lib/gollum/views/overview.rb +81 -0
  242. data/gollum-6.1.0/lib/gollum/views/page.rb +277 -0
  243. data/gollum-6.1.0/lib/gollum/views/pagination.rb +13 -0
  244. data/gollum-6.1.0/lib/gollum/views/rss.rb +84 -0
  245. data/gollum-6.1.0/lib/gollum/views/search.rb +47 -0
  246. data/gollum-6.1.0/lib/gollum/views/template_cascade.rb +29 -0
  247. data/gollum-6.1.0/lib/gollum.rb +42 -0
  248. data/gollum-6.1.0/licenses/licenses.txt +31 -0
  249. data/gollum-6.1.0/package.json +12 -0
  250. data/gollum-6.1.0/yarn.lock +1025 -0
  251. data/super-pro-rb.gemspec +11 -0
  252. metadata +290 -0
@@ -0,0 +1,814 @@
1
+ // Helpers
2
+
3
+ // https://github.com/gollum/gollum/security/dependabot/2
4
+ // Patch in jQuery 3.5.0. Workaround below.
5
+ // TODO upgrade jQuery to > 3.5.0
6
+ jQuery.htmlPrefilter = function( html ) {
7
+ return html;
8
+ };
9
+
10
+ // Replace broken user icons with 'person' octicon
11
+ function brokenAvatarImage(image){
12
+ image.onerror = '';
13
+ image.src = 'data:image/svg+xml;utf8,<%= rocticon_css(:person) %>';
14
+ return true;
15
+ }
16
+
17
+ // Find all divs with `data-gollum-icon` name specified and
18
+ // try to inject the corresponding octicon
19
+ function injectOcticons(){
20
+ $("div[data-gollum-icon]").each(function(index, div){
21
+ var div;
22
+ var octicon = $(div).data('gollum-icon');
23
+ $.ajax({
24
+ url: '/gollum/octicon/' + octicon,
25
+ success: function(data) {
26
+ $(div).prepend(data);
27
+ },
28
+ error: function(data, textStatus, errorThrown) {
29
+ $(div).prepend('<img class="mr-2" src="Error.src?raw" title="Requested octicon does not exist." /> ');
30
+ }
31
+ })
32
+ });
33
+ }
34
+
35
+
36
+
37
+ // Get path for named route, prefixing baseUrl if necessary
38
+ // Uses the route definitions in /lib/gollum/views/helpers.rb.
39
+ // For example, routePath('delete') is equivalent to 'delete_path' in the mustache templates.
40
+ var gollumRoutes = $.parseJSON('<%= routes_to_json %>')
41
+ function routePath(name){
42
+ path = gollumRoutes[name]
43
+ return prefixBaseUrl(path);
44
+ }
45
+
46
+ function prefixBaseUrl(path) {
47
+ if (baseUrl == undefined ) {
48
+ console.log('Gollum error: baseUrl undefined')
49
+ } else if (path == undefined ) {
50
+ console.log('Could not find route with name: ' + name)
51
+ } else {
52
+ if ( baseUrl == "") {
53
+ return path;
54
+ } else if (baseUrl.charAt(baseUrl.length -1) == '/') {
55
+ result = baseUrl + path;
56
+ } else {
57
+ result = baseUrl + '/' + path;
58
+ }
59
+ return result.replace(/\/{2}/g, '/')
60
+ }
61
+ }
62
+
63
+ // Ensure one slash at the beginning, no trailing slash.
64
+ function cleanPath (path){
65
+ var result = '/' + path.replace(/\/$/,'');
66
+ return result.replace(/\/{2}/g, '/');
67
+ }
68
+
69
+ function pageName(){
70
+ // "my/dir/file.md" => "file"
71
+ if (typeof(pageFullPath) == 'undefined') {
72
+ return undefined;
73
+ } else {
74
+ name = pageFullPath.split('/').pop();
75
+ return name.substring(0, name.lastIndexOf('.'));
76
+ }
77
+ }
78
+
79
+ function pagePath(){
80
+ // "my/dir/file" => "my/dir"
81
+ return typeof(pageFullPath) == 'undefined' ? undefined : pageFullPath.split('/').slice(0,-1).join('/');
82
+ }
83
+
84
+ // Generic HTML escape function
85
+ function htmlEscape( str ) {
86
+ // The (slower) alternative is: return $('<div/>').text(str).html();
87
+ // http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding/7124052#7124052
88
+ return String(str)
89
+ .replace(/&/g, '&amp;')
90
+ .replace(/"/g, '&quot;')
91
+ .replace(/'/g, '&#39;')
92
+ .replace(/</g, '&lt;')
93
+ .replace(/>/g, '&gt;');
94
+ }
95
+
96
+ // Given a page name and a current path, returns a fully qualified path.
97
+ function abspath(path, name){
98
+ // Make sure the given path starts at the root.
99
+ if(name[0] != '/'){
100
+ name = '/' + name;
101
+ if (path) {
102
+ name = '/' + path + name;
103
+ }
104
+ }
105
+ var name_parts = name.split('/');
106
+ var newPath = name_parts.slice(0, -1).join('/');
107
+ var newName = name_parts.pop();
108
+ // return array of [path, name]
109
+ return [newPath, newName];
110
+ }
111
+
112
+ function setTextDirection () {
113
+ $('.markdown-body p, .markdown-body span, .markdown-body pre, .markdown-body table').attr('dir','auto');
114
+ }
115
+
116
+ function preparePage () {
117
+ setTextDirection();
118
+ if(criticMarkup == 'true') {
119
+ $('#wiki-content').addClass('criticmarkup');
120
+ $('ins.break').unwrap();
121
+ $('span.critic.comment').wrap('<span class="popover" />');
122
+ $('span.critic.comment').filter(function() {return $(this).text()!="";}).before('&#8225;');
123
+ }
124
+ }
125
+
126
+ function getLocalTime(datetime_string, format) {
127
+ if (format === undefined) { format = 'Y-m-d %H:%M:%S O'; }
128
+
129
+ var date = new Date(datetime_string);
130
+ return date.format(format);
131
+ }
132
+
133
+ function flashNotice(type, notice, button_label, button_function, button_type) {
134
+ // accepted types: info, success, warn, error
135
+ nested_button_html = '';
136
+ if (typeof(button_label) !== 'undefined' && typeof(button_function) !== 'undefined') {
137
+ button_type = (typeof(button_type) !== 'undefined' && button_type == 'danger') ? ' btn-danger' : '';
138
+ nested_button_html = '<span class="px-2"><button type="button" class="btn btn-sm' + button_type + '" onclick="' + button_function + '">' + button_label + '</button></span>'
139
+ }
140
+ html = '<p><div id="gollum-flash" class="flash flash-' + type +'"><button class="flash-close js-flash-close" type="button" onclick="parentNode.remove()"><%=rocticon('x')%></button>' + notice + nested_button_html + '</div></p>';
141
+ $('#gollum-flash').remove();
142
+ $('#wiki-content').before(html);
143
+ if (type == 'success') { setTimeout(function() {$('#gollum-flash').fadeOut();}, 5000); }
144
+ }
145
+
146
+ // Check whether the user has allowed their browser to access their system
147
+ // clipboard.
148
+ async function checkClipboardAccessDenied() {
149
+ if (navigator.permissions && navigator.permissions.query) {
150
+ return await navigator.permissions.query({name: "clipboard-write"})
151
+ .then((permissionStatus) => permissionStatus.state === "denied")
152
+ .catch((error) => {
153
+
154
+ // If the error is about a browser not supporting the 'clipboard-write'
155
+ // PermissionDescriptor member, then we can safely return false, as the
156
+ // browser should not require clipboard permissions for copy-to-clipboard
157
+ // functionality. Of the major browsers, only Firefox should encounter
158
+ // an error as of this writing.
159
+ //
160
+ // Here's Firefox's current error message for reference:
161
+ //
162
+ // TypeError: 'clipboard-write' (value of 'name' member of
163
+ // PermissionDescriptor) is not a valid value for enumeration
164
+ // PermissionName.
165
+ //
166
+ if (error.message.includes("clipboard-write")) {
167
+ console.warn(error);
168
+ return false;
169
+ } else {
170
+ console.error(error);
171
+ }
172
+ });
173
+ }
174
+ }
175
+
176
+ function enable_code_blocks() {
177
+ if (!navigator.clipboard) {
178
+ return;
179
+ }
180
+
181
+ // If there are any codeblocks, create copy-to-clipboard buttons for each of
182
+ // them.
183
+ const codeBlocks = document.querySelectorAll("pre > code");
184
+ if (codeBlocks.length === 0) {
185
+ return;
186
+ }
187
+
188
+ const iconCopyDefault = `<%= rocticon 'copy', width: 18, height: 18 %>`;
189
+ const iconCopyActive = `<%= rocticon 'check', width: 18, height: 18 %>`;
190
+
191
+ const copyToClipboard = async (codeBlockID) => {
192
+ if (await checkClipboardAccessDenied()) {
193
+ return;
194
+ }
195
+
196
+ const button =
197
+ document.querySelector(`button[data-codeblock=${codeBlockID}`);
198
+ const codeBlock = document.getElementById(codeBlockID);
199
+
200
+ if (!codeBlock) {
201
+ throw('Error while copying to clipboard: codeblock not found.');
202
+ return;
203
+ }
204
+
205
+ await navigator.clipboard.writeText(codeBlock.textContent);
206
+
207
+ button.innerHTML = iconCopyActive;
208
+ button.classList.add("tooltipped", "tooltipped-no-delay", "tooltipped-w");
209
+ button.setAttribute('aria-label', 'Copied!');
210
+
211
+ // wait 2 seconds
212
+ await new Promise(resolve => setTimeout(resolve, 2000));
213
+
214
+ button.innerHTML = iconCopyDefault;
215
+ button.classList.remove("tooltipped", "tooltipped-no-delay", "tooltipped-w");
216
+ button.setAttribute('aria-label', 'copy to clipboard');
217
+ };
218
+
219
+ codeBlocks.forEach((item, idx) => {
220
+ // assign a unique ID so the element can be selected later.
221
+ const id = `code-clipboard-${idx + 1}`;
222
+
223
+ const button = document.createElement("button");
224
+
225
+ button.setAttribute('aria-label', 'copy to clipboard');
226
+ button.hidden = true;
227
+ button.dataset.codeblock = id;
228
+ button.innerHTML = iconCopyDefault;
229
+ button.onclick = copyToClipboard.bind(this, id);
230
+ button.classList.add(
231
+ "anim-scale-in",
232
+ "border",
233
+ "btn",
234
+ "btn-octicon",
235
+ "m-1",
236
+ "position-absolute",
237
+ "right-0",
238
+ "top-0",
239
+ );
240
+
241
+ item.id = id;
242
+ item.parentNode.addEventListener('mouseenter', () => {
243
+ button.hidden = false;
244
+ button.classList.add("anim-scale-in");
245
+ });
246
+ item.parentNode.addEventListener('mouseleave', () => {
247
+ button.classList.remove("anim-scale-in");
248
+ button.hidden = true;
249
+ });
250
+ item.parentNode.appendChild(button);
251
+ });
252
+ }
253
+
254
+ // ua
255
+ $(document).ready(function() {
256
+ // for deleting the current page
257
+ $('#delete-link').click( function(e) {
258
+ var ok = confirm($(this).data('confirm'));
259
+ if ( ok ) {
260
+ $.post(routePath('delete') + '/' + pageFullPath,
261
+ {},
262
+ function (result) {
263
+ // page successfully deleted, return to landing page
264
+ window.location = '/';
265
+ });
266
+ }
267
+ // Don't navigate on cancel.
268
+ e.preventDefault();
269
+ } );
270
+ // for deleting files and pages from the overview
271
+ $('.delete-file').click( function(e) {
272
+ var ok = confirm($(this).data('confirm'));
273
+ if ( ok ) {
274
+ var element = $(this);
275
+ $.post(routePath('delete') + '/' + $(this).data('file-path'),
276
+ {},
277
+ function (result) {
278
+ // file successfully deleted, stay on overview but remove element from DOM
279
+ element.closest("li").remove();
280
+ });
281
+ }
282
+ // Don't navigate on cancel.
283
+ e.preventDefault();
284
+ } );
285
+
286
+ // Inject Octicons
287
+ injectOcticons();
288
+
289
+ // Set time in local time
290
+ if (showLocalTime) {
291
+ $(function() {
292
+ $('time').each(function() {
293
+ var datetime = $(this).attr('datetime');
294
+ var format = $(this).data('format');
295
+ $(this).html(getLocalTime(datetime, format));
296
+ });
297
+ });
298
+ }
299
+
300
+ if ($('.minibutton-upload-page').length) {
301
+ new ClipboardJS('#ClipboardJSlink');
302
+ $('.minibutton-upload-page').parent().removeClass('jaws');
303
+ $('.minibutton-upload-page').click(function(e) {
304
+ e.preventDefault();
305
+
306
+ $.GollumDialog.init({
307
+ title: 'Upload File',
308
+ fields: [
309
+ {
310
+ type: 'file',
311
+ context: 'Your uploaded file will be accessible at<br>/'+uploadDest+'/[filename]',
312
+ action: routePath('upload_file')
313
+ }
314
+ ],
315
+ OK: function( res ) {
316
+ $('#wiki-content').addClass('uploading');
317
+ var formData = new FormData($('#upload').get(0));
318
+ var endpoint = $('#upload').attr("action");
319
+
320
+ $.ajax({
321
+ url: endpoint,
322
+ type: 'POST',
323
+ data: formData,
324
+ processData: false,
325
+ contentType: false,
326
+ success: function(data) {
327
+ // File successfully uploaded
328
+ $('#wiki-content').removeClass('uploading');
329
+ flashNotice("success", "Your file was successfully uploaded.");
330
+ },
331
+ error: function(data, textStatus, errorThrown) {
332
+ $('#wiki-content').removeClass('uploading');
333
+ if (data.status == 409) {
334
+ flashNotice('error', 'The file you tried to upload already exists. Please rename the file and try again.');
335
+ } else {
336
+ flashNotice('error', 'Error uploading file: ' + textStatus + ' ' + errorThrown);
337
+ }
338
+ }
339
+ });
340
+ }
341
+ });
342
+ $('#gollum-dialog-action-ok').attr('disabled', true);
343
+ $('input:file').on('change', function() {
344
+ if ($(this).val()) {
345
+ filename = $('input[type=file]').val().split('\\').pop();
346
+ upload_path = '/' + uploadDest + '/' + filename;
347
+ clipboard_button = '<button class="btn btn-sm mb-2" id="ClipboardJSlink" data-clipboard-text="' + upload_path + '"><%=rocticon('paste')%></button>'
348
+ news = 'Your uploaded file will be accessible at<br>' + clipboard_button + '&nbsp;' + upload_path;
349
+ $(".context").html(news);
350
+ $('#gollum-dialog-action-ok').attr('disabled', false);
351
+
352
+ };
353
+ });
354
+ });
355
+ }
356
+
357
+ if ($('.minibutton-rename-page').length) {
358
+ $('.minibutton-rename-page').parent().removeClass('jaws');
359
+ $('.minibutton-rename-page').click(function(e) {
360
+ e.preventDefault();
361
+
362
+ var path = decodeURI(pagePath());
363
+ var oldName = decodeURI(pageName());
364
+ var context_blurb =
365
+ "Renamed page will be under " +
366
+ "<span class='path'>" + htmlEscape(cleanPath(path)) + "</span>" +
367
+ " unless an absolute path is given."
368
+
369
+ $.GollumDialog.init({
370
+ title: 'Rename Page',
371
+ fields: [
372
+ {
373
+ id: 'name',
374
+ name: 'Rename to',
375
+ type: 'text',
376
+ defaultValue: oldName || '',
377
+ context: context_blurb
378
+ }
379
+ ],
380
+ OK: function( res ) {
381
+ var newName = 'Rename Page';
382
+ if ( res['name'] ) {
383
+ newName = res['name'];
384
+ }
385
+ var name_parts = abspath(path, newName);
386
+ var newPath = name_parts[0];
387
+
388
+ var msg = '/' + path == newPath ? 'Renamed ' + oldName + ' to ' + newName
389
+ : 'Renamed ' + oldName + ' to ' + name_parts.join('/');
390
+ // Fill in the rename form
391
+ // This is preferable to AJAX so that we automatically follow the 302 response.
392
+ var rename_form = $("form[name=rename]");
393
+ rename_form.children("input[name=rename]").val(name_parts.join('/'));
394
+ rename_form.children("input[name=message]").val(msg);
395
+ rename_form.submit();
396
+ }
397
+ });
398
+ });
399
+ }
400
+
401
+ if ($('.minibutton-new-page').length) {
402
+ $('.minibutton-new-page').parent().removeClass('jaws');
403
+ $('.minibutton-new-page').click(function(e) {
404
+ e.preventDefault();
405
+ var path = pagePath();
406
+ if( path === undefined && $('#file-browser').length != 0 ){
407
+ // In the pages view, pageFullPath isn't defined.
408
+ // The new button will still expect a value however.
409
+ // So we try to figure one out from window.location
410
+ path = window.location.pathname.replace(routePath('overview'), '')
411
+ }
412
+
413
+ var context_blurb =
414
+ "Page will be created under " +
415
+ "<span class='path'>" + htmlEscape(cleanPath(path)) + "</span>" +
416
+ " unless an absolute path is given."
417
+
418
+ $.GollumDialog.init({
419
+ title: 'Create New Page',
420
+ fields: [
421
+ {
422
+ id: 'name',
423
+ name: 'Page Name',
424
+ type: 'text',
425
+ defaultValue: '',
426
+ context: context_blurb
427
+ }
428
+ ],
429
+ OK: function( res ) {
430
+ var name = 'New Page';
431
+ if ( res['name'] ) {
432
+ name = res['name'];
433
+ }
434
+ var name_encoded = [];
435
+ var name_parts = abspath(path, name).join('/').split('/');
436
+ // Split and encode each component individually.
437
+ for( var i=0; i < name_parts.length; i++ ){
438
+ name_encoded.push(encodeURIComponent(name_parts[i]));
439
+ }
440
+ window.location = routePath('create') + name_encoded.join('/');
441
+ }
442
+ });
443
+ });
444
+ }
445
+
446
+ if ($('#wiki-wrapper').hasClass('history')) {
447
+ $('#wiki-history td.checkbox input').each(function() {
448
+ $(this).click(function() {
449
+ nodeSelector.checkNode($(this));
450
+ });
451
+ if ( $(this).is(':checked') ) {
452
+ nodeSelector.checkNode($(this));
453
+ }
454
+ });
455
+
456
+ if ($('.history button.action-compare-revision').length) {
457
+ $('.history button.action-compare-revision').click(function() {
458
+ $("#selection-form").submit();
459
+ });
460
+ }
461
+ }
462
+
463
+ if ($('#searchbar a#search-submit').length) {
464
+ $.GollumPlaceholder.add($('#searchbar #search-query'));
465
+ $('#searchbar a#search-submit').click(function(e) {
466
+ e.preventDefault();
467
+ $('#searchbar #search-form')[0].submit();
468
+ });
469
+ $('#searchbar #search-form').submit(function(e) {
470
+ $.GollumPlaceholder.clearAll();
471
+ $(this).unbind('submit');
472
+ $(this).submit();
473
+ });
474
+ }
475
+
476
+ if ($('#gollum-revert-form').length &&
477
+ $('.gollum-revert-button').length ) {
478
+ $('a.gollum-revert-button').click(function(e) {
479
+ e.preventDefault();
480
+ $('#gollum-revert-form').submit();
481
+ });
482
+ }
483
+
484
+ // Called when clicking the 'Preview' tab in the editor view
485
+ function getPreview () {
486
+ var formData = new FormData($('#gollum-editor-form').get(0));
487
+ var paths = window.location.pathname.split('/');
488
+ var sectionAnchor = window.location.hash.substr(1);
489
+ formData.append('page', decodeURIComponent(paths[ paths.length - 1 ]) || '')
490
+ $.ajax({
491
+ url: routePath('preview'),
492
+ data: formData,
493
+ type: 'POST',
494
+ processData: false,
495
+ contentType: false,
496
+ success: function(data) {
497
+ var mainDiv = $('#wiki-wrapper', data);
498
+ $('.tabnav-div#preview-content').html(mainDiv);
499
+ preparePage();
500
+ injectOcticons();
501
+ enable_code_blocks();
502
+ if (sectionAnchor ) {
503
+ if ( sectionHeading = $('a' + '#' + sectionAnchor+'.anchor')[0] ) {
504
+ sectionHeading.scrollIntoView();
505
+ }
506
+ }
507
+ previewContent = $('.tabnav-div#preview-content')[0];
508
+ if (window.MathJax != null) {
509
+ MathJax.texReset();
510
+ MathJax.typesetClear();
511
+ MathJax.typesetPromise([previewContent]);
512
+ //MathJax.startup.defaultReady();
513
+ } else if (typeof(katex_conf) !== 'undefined') {
514
+ renderMathInElement(previewContent, katex_conf);
515
+ }
516
+ if (typeof(mermaid) !== 'undefined') {
517
+ mermaid.init();
518
+ }
519
+ },
520
+ error: function(data, textStatus, errorThrown) {
521
+ console.log('something went wrong: ' + textStatus + errorThrown);
522
+ }
523
+ });
524
+ }
525
+
526
+ function togglePreviewTab ( preview ) {
527
+ if (preview) {
528
+ active_div = '#preview-content'
529
+ active_tab = '#preview.tabnav-tab';
530
+ } else {
531
+ active_div = '#edit-content'
532
+ active_tab = '#edit.tabnav-tab';
533
+ }
534
+
535
+ $('.tabnav-tab.selected').removeAttr('aria-current');
536
+ $('.tabnav-tab.selected').removeClass('selected');
537
+
538
+ $(active_tab).attr('aria-current', 'page');
539
+ $(active_tab).addClass('selected');
540
+
541
+ $('.tabnav-div').hide();
542
+ $(active_div).show();
543
+ }
544
+
545
+ if( $('.tabnav-tabs').length ){
546
+ $(".tabnav-tab").click( function(e) {
547
+ e.preventDefault();
548
+ if( !$(this).hasClass('selected') ) {
549
+ preview = $(this).attr('id') == 'preview';
550
+ if (preview) {
551
+ getPreview();
552
+ }
553
+ togglePreviewTab(preview);
554
+ };
555
+ });
556
+ };
557
+
558
+ var previewHotkey = function () {
559
+ $('.tabnav-tab').not('.selected').click();
560
+ return false;
561
+ };
562
+
563
+ var editorHotkeys = [
564
+ {
565
+ name: "saveContents",
566
+ bindKey: {win: "Ctrl-s", mac: "Command-s"},
567
+ exec: function() {
568
+ $("#gollum-editor-submit").trigger("click");
569
+ }
570
+ },
571
+ {
572
+ name: "togglePreview", // Ace's hotkeys override Mousetrap, so add the preview hotkey to the editor, too.
573
+ bindKey: {win: "ctrl-shift-p", mac: "ctrl-shift-p"},
574
+ exec: previewHotkey
575
+ }
576
+ ];
577
+
578
+ if ( $('#wiki-wrapper.edit').length || $('#wiki-wrapper.create').length ) {
579
+ // Hotkey for moving between Edit and Preview tab
580
+ Mousetrap.bind(['ctrl+shift+p'], previewHotkey);
581
+ }
582
+
583
+ if( $('#wiki-wrapper.edit').length ){
584
+ $("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
585
+ $("#gollum-editor-body").one('change', function(){
586
+ window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
587
+ });
588
+
589
+ $.GollumEditor({
590
+ section: window.location.hash.substr(1),
591
+ commands: editorHotkeys // Ace's keybindings overrule mousetrap, so add some of gollum's keyboard shortcuts to the editor, as well.
592
+ });
593
+
594
+ $("#gollum-editor-submit").click( function(e) {
595
+ e.preventDefault();
596
+ // Prevent button from being clicked again
597
+ $(this).attr('disabled', true);
598
+
599
+ var formData = new FormData($('#gollum-editor-form').get(0));
600
+ var selected = basicSelectGetSelection($('#wiki_format'));
601
+ var newExt = selected.attr('data-ext');
602
+ var newPath = cleanPath(prefixBaseUrl(pagePath() + '/' + pageName() + '.' + newExt));
603
+ var endpoint = $('#gollum-editor-form').attr("action");
604
+
605
+ $.ajax({
606
+ url: endpoint,
607
+ type: 'POST',
608
+ data: formData,
609
+ processData: false,
610
+ contentType: false,
611
+ success: function(data) {
612
+ window.location = newPath;
613
+ },
614
+ error: function(data, textStatus, errorThrown) {
615
+ if (data.status == 412) {
616
+ $('#gollum-editor-submit').attr('disabled', false)
617
+ alert('Someone else has modified this page while you were editing it. Please store your version on disk outside of the browser, reload this page and reapply your modifications.');
618
+ } else {
619
+ alert('Error updating page: ' + data.responseText);
620
+ }
621
+ }
622
+ });
623
+
624
+ });
625
+ }
626
+
627
+ if( $("#page-history").length) {
628
+ if( $("#page-history #pagination").length) {
629
+
630
+ var maxSelected = 2;
631
+ var selectionColors = ["color-bg-open", "color-bg-closed"];
632
+
633
+ var toggleInputs = function () {
634
+ var numSelected = 0;
635
+ $("#selection-form input").each(function (index, element) {
636
+ var value = $(element).val();
637
+ var input = $('#version-form input[value="' + value + '"]');
638
+ input.prop('checked', true);
639
+ if (index == 0) {
640
+ input.closest("li").removeClass(selectionColors[1]).addClass(selectionColors[index]);
641
+ } else if (index == 1) {
642
+ input.closest("li").addClass(selectionColors[index]);
643
+ }
644
+ numSelected = numSelected + 1;
645
+ });
646
+ if (numSelected < 1) {
647
+ $('.history button.action-compare-revision').prop('disabled', true);
648
+ } else if (numSelected < maxSelected) {
649
+ $('.history button.action-compare-revision').prop('disabled', false);
650
+ $('#version-form input').prop('disabled', false);
651
+ } else {
652
+ $('#version-form input:not(:checked)').prop('disabled', true);
653
+ }
654
+ };
655
+
656
+ var onCheckboxSelect = function ( box ) {
657
+ $('<input>').attr({
658
+ type: 'hidden',
659
+ id: $(box).val(),
660
+ name: 'versions[]',
661
+ value: $(box).val()
662
+ }).appendTo($("#selection-form"));
663
+ toggleInputs();
664
+ };
665
+
666
+ var onCheckboxUnselect = function( box ) {
667
+ $('#selection-form #' + $(box).val()).remove();
668
+ $(box).closest("li").removeClass(selectionColors.join(" "));
669
+ toggleInputs();
670
+ };
671
+
672
+ var setCheckboxEvents = function () {
673
+ $("#version-form input").on('change', function () {
674
+ if (this.checked) {
675
+ onCheckboxSelect(this);
676
+ } else {
677
+ onCheckboxUnselect(this);
678
+ }
679
+ });
680
+ };
681
+ setCheckboxEvents();
682
+ toggleInputs();
683
+
684
+ var clickPageNav = function (e) {
685
+ e.preventDefault();
686
+ if ( !$(this).hasClass('disabled') ) {
687
+ $.ajax({
688
+ url: $(this).attr('href'),
689
+ type: 'GET',
690
+ success: function(data) {
691
+ var rowDiv = $('#page-history-list', data);
692
+ var new_pagination = $('#pagination', data);
693
+
694
+ ['#next', '#prev'].forEach( function (nav_item) {
695
+ old_btn = $('#pagination ' + nav_item);
696
+ new_btn = new_pagination.find(nav_item);
697
+ old_btn.attr('href', new_btn.attr('href'));
698
+ if (new_btn.hasClass('disabled')) {
699
+ old_btn.addClass('disabled');
700
+ } else {
701
+ old_btn.removeClass('disabled');
702
+ }
703
+ });
704
+
705
+ $('#page-history-list').replaceWith(rowDiv);
706
+
707
+ setCheckboxEvents();
708
+ toggleInputs();
709
+ },
710
+ error: function(data, textStatus, errorThrown) {
711
+ console.log('something went wrong: ' + textStatus + errorThrown)
712
+ }
713
+ });
714
+ }
715
+ this.blur();
716
+ };
717
+
718
+ $("#pagination #next, #pagination #prev").each(function(index, element) {
719
+ $(element).on("click", clickPageNav);
720
+ });
721
+ }
722
+ }
723
+
724
+ if( $("#last-edit").length ) {
725
+ $("#page-info-toggle").click ( function () {
726
+ $.ajax({
727
+ url: routePath('last_commit_info'),
728
+ data: {path: $("#page-info-toggle").data('pagepath')},
729
+ success: function ( data ) {
730
+ var date = showLocalTime ? getLocalTime(data.date) : data.date;
731
+ $("#last-edit").next(".dotted-spinner").toggleClass('hidden');
732
+ $("#last-edit-in-progress").html('Last edited by <b>' + data.author + '</b>, ' + date);
733
+ }
734
+ });
735
+ $("#last-edit").next(".dotted-spinner").toggleClass('hidden')
736
+ $("#page-info-toggle").before('<span id="last-edit-in-progress">&nbsp;Getting commit info...</span>').remove();
737
+ })
738
+ }
739
+
740
+ if( $('#wiki-wrapper.create').length ){
741
+ $("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
742
+ $("#gollum-editor-body").one('change', function(){
743
+ window.onbeforeunload = function(){ return "Leaving will not create a new page!" };
744
+ });
745
+ $.GollumEditor({ NewFile: true, MarkupType: default_markup, commands: editorHotkeys });
746
+ }
747
+
748
+ if($('#search-results').length ){
749
+ $('.toggle-context').each(function () {
750
+ var hiddenContext = $(this).parent().next('div.search-context').find('li:hidden');
751
+ if ( !hiddenContext.length ) {
752
+ $(this).toggle();
753
+ } else {
754
+ $(this).click(function () {
755
+ hiddenContext.toggle();
756
+ $(this).toggle();
757
+ });
758
+ }
759
+ });
760
+
761
+ var searchQuery = new RegExp(searchTerms.join('|'), 'gi'); //searchTerms provided by the layout template.
762
+ $('div.search-context li span').each(function () {
763
+ var curText = $(this).html().replace(/"/g, '&quot;').replace(/'/g, '&#39;');
764
+ var newText = curText.replace(searchQuery, function (match) {
765
+ return '<span class="color-bg-success">' + match + '</span>';
766
+ });
767
+
768
+ $(this).html(newText);
769
+ });
770
+ }
771
+
772
+ if($('.markdown-body').length ){
773
+ // Set text direction (LTR or RTL)
774
+ preparePage();
775
+ // Check if there was a redirect here
776
+ if (match = new RegExp(/[?&]redirected\_from=([^?]*)/).exec(window.location.href)) {
777
+ notice = "The page you requested was renamed or moved. You've been successfully redirected to its new location.";
778
+ flashNotice('success', notice);
779
+ }
780
+ // Set the 'e' hotkey for editing pages.
781
+ Mousetrap.bind(['e'], function( e ) {
782
+ e.preventDefault();
783
+ window.location = routePath('edit') + '/' + pageFullPath;
784
+ return false;
785
+ });
786
+
787
+ if ($.markupSupportsEditableSections(pageFormat)){
788
+ // Copy anchors for each editable header and give the new anchor the 'edit' class, to display an "edit section" link
789
+ $('a.anchor').each(function (index, anchor) {
790
+ header = $(anchor).closest(':header');
791
+ if (header.hasClass('editable')){
792
+ var newUrl = routePath('edit') + '/' + pageFullPath + $(anchor).attr('href');
793
+ $(anchor).clone().addClass('edit').attr('href', newUrl).appendTo(header);
794
+ }
795
+ });
796
+ }
797
+
798
+ enable_code_blocks();
799
+ }
800
+
801
+ if( $('#wiki-history').length || $('#page-history').length){
802
+ var options = {
803
+ format: 'svg',
804
+ background: [255, 255, 255, 255] // rgba white
805
+ };
806
+ $('img.identicon').each(function(index, element){
807
+ var item = $(element);
808
+ var code = item.data('identicon');
809
+ var img_bin = new Identicon(code, options).toString();
810
+ img_bin = 'data:image/svg+xml;base64,' + img_bin;
811
+ item.attr('src', img_bin);
812
+ });
813
+ }
814
+ });