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,301 @@
1
+ #!/usr/bin/env -S ruby -Eutf-8
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
5
+ require 'optparse'
6
+ require 'rubygems'
7
+ require 'gollum'
8
+ require 'erb'
9
+ require 'sprockets'
10
+
11
+ exec = {}
12
+ options = {
13
+ :port => 4567,
14
+ :bind => '0.0.0.0',
15
+ }
16
+ wiki_options = {
17
+ :allow_uploads => false,
18
+ :allow_editing => true
19
+ }
20
+
21
+ default_math_config = 'math.config.js'
22
+
23
+ opts = OptionParser.new do |opts|
24
+ # define program name (although this defaults to the name of the file, just in case...)
25
+ opts.program_name = 'gollum'
26
+
27
+ # set basic info for the '--help' command (options will be appended automatically from the below definitions)
28
+ opts.banner = '
29
+ Gollum is a multi-format Wiki Engine/API/Frontend.
30
+
31
+ Usage:
32
+ gollum [options] [git-repo]
33
+
34
+ Arguments:
35
+ [git-repo] Path to the git repository being served. If not specified, current working directory is used.
36
+
37
+ Notes:
38
+ Paths for all options are relative to <git-repo> unless absolute.
39
+ This message is only a basic description. For more information, please visit:
40
+ https://github.com/gollum/gollum
41
+
42
+ OPTIONS'
43
+
44
+ # define gollum options
45
+ opts.separator ''
46
+ opts.separator ' Major:'
47
+
48
+ opts.on('-h', '--host [HOST]', 'Specify the hostname or IP address to listen on. Default: \'0.0.0.0\'.') do |host|
49
+ options[:bind] = host
50
+ end
51
+ opts.on('-p', '--port [PORT]', 'Specify the port to bind Gollum with. Default: \'4567\'.') do |port|
52
+ begin
53
+ # don't use 'port.to_i' here... it doesn't raise errors which might result in a nice confusion later on
54
+ options[:port] = Integer(port)
55
+ rescue ArgumentError
56
+ puts "Error: '#{port}' is not a valid port number."
57
+ exit 1
58
+ end
59
+ end
60
+ opts.on('-c', '--config [FILE]', 'Specify path to the Gollum\'s configuration file.') do |file|
61
+ options[:config] = file
62
+ end
63
+ opts.on('-r', '--ref [REF]', 'Specify the branch to serve. Default: \'master\'.') do |ref|
64
+ wiki_options[:ref] = ref
65
+ end
66
+ opts.on("--bare", "Declare '<git-repo>' to be bare.") do
67
+ wiki_options[:repo_is_bare] = true
68
+ end
69
+ opts.on('-a', '--adapter [ADAPTER]', 'Launch Gollum using a specific git adapter. Default: \'rugged\'.') do |adapter|
70
+ Gollum::GIT_ADAPTER = adapter
71
+ end
72
+ opts.on('-b', '--base-path [PATH]', 'Specify the leading portion of all Gollum URLs (path info). Default: \'/\'.',
73
+ 'Example: setting this to \'/wiki\' will make the wiki accessible under \'http://localhost:4567/wiki/\'.') do |base_path|
74
+
75
+ # first trim a leading slash, if any
76
+ base_path.sub!(/^\/+/, '')
77
+
78
+ # make a backup of the option and sanitize it
79
+ base_path_original = base_path.dup
80
+ base_path = ERB::Util.url_encode(base_path)
81
+ base_path.gsub!('%2F', '/')
82
+
83
+ # then let the user know if we changed the URL
84
+ unless base_path_original == base_path
85
+ puts <<MSG
86
+ Warning: your base-path has been sanitized:
87
+ - original: "#{base_path_original}"
88
+ - sanitized: "#{base_path}"
89
+ MSG
90
+ end
91
+
92
+ # and finally, let others enjoy our hard work:
93
+ wiki_options[:base_path] = base_path unless base_path.empty?
94
+ end
95
+ opts.on('--page-file-dir [PATH]', 'Specify the subdirectory for all pages. Default: repository root.',
96
+ 'Example: setting this to \'pages\' will make Gollum serve only pages at \'<git-repo>/pages/*\'.') do |path|
97
+ wiki_options[:page_file_dir] = path
98
+ end
99
+ opts.on('--assets [PATH]', 'Set the path to look for stylesheets and javascript. Only used if environment is production/staging. Default: ./public/assets') do |path|
100
+ wiki_options[:static_assets_path] = path
101
+ end
102
+ opts.on('--css', 'Inject custom CSS into each page. The \'<wiki-root>/custom.css\' file is used (must be committed).') do
103
+ wiki_options[:css] = true
104
+ end
105
+ opts.on('--js', 'Inject custom JavaScript into each page. The \'<wiki-root>/custom.js\' file is used (must be committed).') do
106
+ wiki_options[:js] = true
107
+ end
108
+ opts.on('--no-edit', 'Disable the feature of editing pages.') do
109
+ wiki_options[:allow_editing] = false
110
+ end
111
+ opts.on('--allow-uploads [MODE]', [:dir, :page], 'Enable file uploads.',
112
+ 'If set to \'dir\', Gollum will store all uploads in the \'<git-repo>/uploads/\' directory.',
113
+ 'If set to \'page\', Gollum will store uploads per page in \'<git-repo>/uploads/[pagename]\'.') do |mode|
114
+ wiki_options[:allow_uploads] = true
115
+ wiki_options[:per_page_uploads] = true if mode == :page
116
+ end
117
+ opts.on('--math [RENDERER]', [:mathjax, :katex], 'Enable rendering of mathematical equations.',
118
+ 'Valid renderers: mathjax, katex. Default: katex.') do |mode|
119
+ wiki_options[:math] = mode.nil? ? :katex : mode.to_sym
120
+ wiki_options[:math_config] = default_math_config
121
+ puts "To set a custom configuration for #{wiki_options[:math]} please add it to \'#{default_math_config}\' and commit it to the repo."
122
+ end
123
+ opts.on('--mathjax', 'Enable rendering of mathematical equations via mathjax.') do |mode|
124
+ puts 'DEPRECATION WARNING: --mathjax. This switch will be removed in the future. Please use: "--math mathjax".'
125
+ puts "If you are using a custom mathjax.config.js, please remame it to #{default_math_config}."
126
+ wiki_options[:math] = :mathjax
127
+ wiki_options[:math_config] = default_math_config
128
+ end
129
+ opts.on('--critic-markup', 'Enable support for annotations using CriticMarkup.') do
130
+ wiki_options[:critic_markup] = true
131
+ end
132
+ opts.on('--irb', 'Launch Gollum in \'console mode\', with a predefined API.') do
133
+ options[:irb] = true
134
+ end
135
+
136
+ opts.separator ''
137
+ opts.separator ' Minor:'
138
+
139
+ opts.on('--h1-title', 'Use the first \'<h1>\' as page title.') do
140
+ wiki_options[:h1_title] = true
141
+ end
142
+ opts.on('--no-display-metadata', 'Do not render metadata tables in pages.') do
143
+ wiki_options[:display_metadata] = false
144
+ end
145
+ opts.on('--user-icons [MODE]', [:gravatar, :identicon], 'Use specific user-icons for history view.',
146
+ 'Can be set to \'gravatar\' or \'identicon\'. Default: standard avatar.') do |mode|
147
+ wiki_options[:user_icons] = mode.to_s
148
+ end
149
+ opts.on('--template-dir [PATH]', 'Specify custom mustache template directory. Only overrides templates that exist in this directory.') do |path|
150
+ wiki_options[:template_dir] = path
151
+ end
152
+ opts.on('--template-page', 'Use _Template.{ext} as a template for new pages.') do
153
+ wiki_options[:template_page] = true
154
+ end
155
+ opts.on('--lenient-tag-lookup', 'Internal links resolve case-insensitively, will treat spaces as hyphens, and will match the first page found with a certain filename, anywhere in the repository. Provides compatibility with Gollum 4.x.') do
156
+ puts 'DEPRECATION WARNING: --lenient-tag-lookup. This switch will be removed in the future. You will still be able to set the option via config.rb.'
157
+ wiki_options[:case_insensitive_tag_lookup] = true
158
+ wiki_options[:global_tag_lookup] = true
159
+ wiki_options[:hyphened_tag_lookup] = true
160
+ end
161
+ opts.on('--emoji', 'Parse and interpret emoji tags (e.g. :heart:) except when the leading colon is backslashed (e.g. \\:heart:).') do
162
+ wiki_options[:emoji] = true
163
+ end
164
+ opts.separator ''
165
+ opts.separator ' Common:'
166
+
167
+ opts.on('--help', 'Display this message.') do
168
+ puts opts
169
+ exit 0
170
+ end
171
+ opts.on('--version', 'Display the current version of Gollum.') do
172
+ puts 'Gollum ' + Gollum::VERSION
173
+ exit 0
174
+ end
175
+ opts.on('--versions', 'Display the current version of Gollum and auxiliary gems.') do
176
+ require 'gollum-lib'
177
+ puts 'Gollum ' + Gollum::VERSION
178
+ puts "Running on: #{RUBY_PLATFORM} with Ruby version #{RUBY_VERSION}"
179
+ puts 'Using:'
180
+ loaded_gemspecs = Gem.loaded_specs
181
+ gollum_gems = ['gollum-lib', 'gollum-rjgit_adapter', 'rjgit', 'gollum-rugged_adapter', 'rugged']
182
+ puts Gem.loaded_specs.select{|name, spec| gollum_gems.include?(name)}.map {|name, spec| "#{name} #{spec.version}"}
183
+ puts "Markdown rendering gem: #{GitHub::Markup::Markdown.implementation_name}"
184
+ puts 'Other rendering gems:'
185
+ renderer_gems = ['RedCloth', 'org-ruby', 'creole', 'asciidoctor', 'wikicloth']
186
+ renderer_gems.each do |renderer|
187
+ begin
188
+ require renderer
189
+ rescue LoadError
190
+ end
191
+ end
192
+ results = Gem.loaded_specs.select{|name, spec| renderer_gems.include?(name)}.map {|name, spec| "#{name} #{spec.version}"}
193
+ puts results.empty? ? 'none' : results
194
+ exit 0
195
+ end
196
+
197
+ opts.separator ''
198
+ opts.separator ' Development:'
199
+
200
+ opts.on('--development-assets', 'For development purposes only. Use local instead of packaged assets.') do
201
+ wiki_options[:static] = false
202
+ end
203
+ end
204
+
205
+ # Read command line options into `options` hash
206
+ begin
207
+ opts.parse!
208
+ rescue OptionParser::InvalidOption => e
209
+ puts "gollum: #{e.message}"
210
+ puts 'gollum: try \'gollum --help\' for more information'
211
+ exit 1
212
+ end
213
+
214
+ # --gollum-path wins over ARGV[0]
215
+ gollum_path = ARGV[0] || Dir.pwd
216
+
217
+ if options[:irb]
218
+ require 'irb'
219
+ # http://jameskilton.com/2009/04/02/embedding-irb-into-your-ruby-application/
220
+ module IRB # :nodoc:
221
+ def self.start_session(binding)
222
+ unless @__initialized
223
+ args = ARGV
224
+ ARGV.replace(ARGV.dup)
225
+ IRB.setup(nil)
226
+ ARGV.replace(args)
227
+ @__initialized = true
228
+ end
229
+
230
+ ws = WorkSpace.new(binding)
231
+ irb = Irb.new(ws)
232
+
233
+ @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
234
+ @CONF[:MAIN_CONTEXT] = irb.context
235
+
236
+ catch(:IRB_EXIT) do
237
+ irb.eval_input
238
+ end
239
+ end
240
+ end
241
+
242
+ begin
243
+ require 'gollum-lib'
244
+ wiki = Gollum::Wiki.new(gollum_path, wiki_options)
245
+ if !wiki.exist? then
246
+ raise Gollum::InvalidGitRepositoryError
247
+ end
248
+
249
+ puts
250
+ puts 'Loaded Gollum wiki at:'
251
+ puts "#{File.expand_path(gollum_path).inspect}"
252
+ puts
253
+ puts 'Example API calls:'
254
+ puts %( page = wiki.page('page-name'))
255
+ puts %( # => <Gollum::Page>)
256
+ puts
257
+ puts %( page.raw_data)
258
+ puts %( # => '# My wiki page')
259
+ puts
260
+ puts %( page.formatted_data)
261
+ puts %( # => '<h1>My wiki page</h1>')
262
+ puts
263
+ puts 'Full API documentation at:'
264
+ puts 'https://github.com/gollum/gollum-lib'
265
+ puts
266
+ IRB.start_session(binding)
267
+ rescue Gollum::InvalidGitRepositoryError, Gollum::NoSuchPathError
268
+ puts "Invalid Gollum wiki at #{File.expand_path(gollum_path).inspect}"
269
+ exit 0
270
+ end
271
+ else
272
+ require 'gollum/app'
273
+ # TODO: Remove RACK_ENV fallback once gollum-7 is released (4 lines)
274
+ if ENV['RACK_ENV'] && !ENV['APP_ENV']
275
+ warn "[DEPRECATION] RACK_ENV will be ignored as of gollum-6.0.0, please use APP_ENV instead."
276
+ ENV['APP_ENV'] = ENV['RACK_ENV']
277
+ end
278
+ Precious::App.set(:environment, ENV.fetch('APP_ENV', :production).to_sym)
279
+ Precious::App.set(:gollum_path, gollum_path)
280
+ Precious::App.set(:wiki_options, wiki_options)
281
+
282
+ if cfg = options[:config]
283
+ # If the path begins with a '/' it will be considered an absolute path,
284
+ # otherwise it will be relative to the CWD
285
+ cfg = File.join(Dir.getwd, cfg) unless cfg.slice(0) == File::SEPARATOR
286
+ require cfg
287
+ # The options may have been updated. Reload them.
288
+ wiki_options = Precious::App.wiki_options
289
+ end
290
+
291
+ base_path = wiki_options[:base_path]
292
+
293
+ if base_path.nil?
294
+ Precious::App.run!(options)
295
+ else
296
+ require 'rackup'
297
+
298
+ # Rackup::Handler does not work with Ctrl + C. Use Rackup::Server instead.
299
+ Rackup::Server.new(:app => Precious::MapGollum.new(base_path), :Port => options[:port], :Host => options[:bind]).start
300
+ end
301
+ end
@@ -0,0 +1,283 @@
1
+ #!/usr/bin/env ruby
2
+ #coding:utf-8
3
+ require 'optparse'
4
+ require 'pathname'
5
+ require 'rubygems'
6
+
7
+ wiki_options = {}
8
+ options = {}
9
+
10
+ migrate_options = {
11
+ :hyphenate => true
12
+ }
13
+
14
+ def setting(variable_name)
15
+ class_variable_name = :"@@#{variable_name.to_s}"
16
+
17
+ Object.class_variable_defined?(class_variable_name) &&
18
+ Object.class_variable_get(class_variable_name)
19
+ end
20
+
21
+ opts = OptionParser.new do |opts|
22
+ opts.banner = <<EOF
23
+ Use this tool to migrate a wiki repository created under Gollum versions 4.x or earlier to a 5.x compatible repo.
24
+ It finds and repairs Gollum link tags that no longer work under 5.x for three reasons:
25
+
26
+ * 5.x wiki internal links may contain spaces. [[Bilbo Baggins]] and [[Bilbo-Baggins]] therefore link to distinct pages.
27
+ * 5.x wiki internal links are case sensitive
28
+ * 5.x wiki internal links are no longer 'global'.
29
+
30
+ * NB: you can use the --lenient-tag-lookup option in gollum >= 5.x to enable 4.x-backwards compatible tags.
31
+
32
+ See https://github.com/gollum/gollum/wiki/5.0-release-notes#filename-handling for more information.
33
+ Usage of this script comes without any warranty.
34
+
35
+ Usage: gollum-migrate-tags /path/to/repo
36
+
37
+ NB: without the --write flag, this will be a 'dry run' that doesn't actually make any changes, but outputs the changes that would be made.
38
+
39
+ You can use the --page-file-dir and --config options as you would normally with gollum.
40
+
41
+ Requires a non-bare repository. Recommended usage:
42
+
43
+ 1. Clone your wiki's repository to create a backup.
44
+ 2. Run this script on your cloned repo.
45
+ 3. If all looks sane, run the script with the --write option. This will overwrite files in your working directory, but not commit the changes, so you have time to review them.
46
+ 4. Do a 'git diff' to inspect the changes.
47
+ 5. Commit the changes if all looks sane, and push/pull them back into your original repo.
48
+
49
+ Options:
50
+ EOF
51
+ opts.on('-c', '--config [FILE]', 'Specify path to the Gollum\'s configuration file.') do |file|
52
+ options[:config] = file
53
+ end
54
+
55
+ opts.on('--page-file-dir [PATH]', 'Specify the subdirectory for all pages. Default: repository root.') do |path|
56
+ wiki_options[:page_file_dir] = path
57
+ end
58
+
59
+ opts.on('--prefer-relative-links', 'When specified, will try to replace broken links with relative links (\'[[Foo/Bar]]\' instead of \'[[/Subdir/Foo/Bar]]\') where possible.') do
60
+ migrate_options[:prefer_relative] = true
61
+ end
62
+
63
+ opts.on('--hyphenate', 'Default. Repair links that use spaces instead of hyphens: [[Bilbo Baggins]] -> [[Bilbo-Baggins]]') do
64
+ migrate_options[:hyphenate] = true
65
+ end
66
+
67
+ opts.on('--no-hyphenate', 'Turn off the --hyphenate option.') do
68
+ migrate_options[:hyphenate] = false
69
+ end
70
+
71
+ opts.on('--run-silent', 'Don\'t output anything.') do
72
+ migrate_options[:run_silent] = true
73
+ end
74
+
75
+ opts.on('--write', 'No dry run: actually perform the substitutions.') do
76
+ migrate_options[:no_dry_run] = true
77
+ end
78
+ end
79
+
80
+ # Read command line options into `options` hash
81
+ begin
82
+ opts.parse!
83
+ migrate_options.each do |setting, value|
84
+ variable_name = :"@@#{setting.to_s}"
85
+
86
+ unless Object.class_variable_defined?(variable_name)
87
+ Object.class_variable_set(variable_name, value)
88
+ end
89
+ end
90
+ wiki_options[:page_file_dir] = setting(:page_file_dir) ? setting(:page_file_dir) : wiki_options[:page_file_dir] # Allow settings :page_file_dir through PAGE_FILE_DIR constant.
91
+ rescue OptionParser::InvalidOption
92
+ puts "gollum-migrate-tags: #{$!.message}"
93
+ puts "gollum-migrate-tags: try 'gollum-migrate-tags --help' for more information"
94
+ exit
95
+ end
96
+
97
+ wiki_directory = ARGV[0] || Dir.pwd
98
+
99
+ require 'gollum-lib'
100
+
101
+ if cfg = options[:config]
102
+ # If the path begins with a '/' it will be considered an absolute path,
103
+ # otherwise it will be relative to the CWD
104
+ cfg = File.join(Dir.getwd, cfg) unless cfg.slice(0) == File::SEPARATOR
105
+ require cfg
106
+ end
107
+
108
+ class Gollum::Filter::CodeMigrator < Gollum::Filter::Code
109
+ def extract(data)
110
+ case @markup.format
111
+ when :asciidoc
112
+ data.gsub!(/^(\[source,([^\r\n]*)\]\n)?----\n(.+?)\n----$/m) do
113
+ cache_codeblock($~.to_s)
114
+ end
115
+ when :org
116
+ org_headers = %r{([ \t]*#\+HEADER[S]?:[^\r\n]*\n)*}
117
+ org_name = %r{([ \t]*#\+NAME:[^\r\n]*\n)?}
118
+ org_lang = %r{[ ]*([^\n \r]*)[ ]*[^\r\n]*}
119
+ org_begin = %r{([ \t]*)#\+BEGIN_SRC#{org_lang}\r?\n}
120
+ org_end = %r{\r?\n[ \t]*#\+END_SRC[ \t\r]*}
121
+ data.gsub!(/^#{org_headers}#{org_name}#{org_begin}(.+?)#{org_end}$/mi) do
122
+ cache_codeblock($~.to_s)
123
+ end
124
+ when :markdown
125
+ data.gsub!(/^([ ]{0,3})(~~~+) ?([^\r\n]+)?\r?\n(.+?)\r?\n[ ]{0,3}(~~~+)[ \t\r]*$/m) do
126
+ m_indent = Regexp.last_match[1]
127
+ m_start = Regexp.last_match[2] # ~~~
128
+ m_lang = Regexp.last_match[3]
129
+ m_code = Regexp.last_match[4]
130
+ m_end = Regexp.last_match[5] # ~~~
131
+ # The closing code fence must be at least as long as the opening fence
132
+ next '' if m_end.length < m_start.length
133
+ lang = m_lang ? m_lang.strip.split.first : nil
134
+ cache_codeblock($~.to_s)
135
+ end
136
+ end
137
+
138
+ data.gsub!(/^([ ]{0,3})``` ?([^\r\n]+)?\r?\n(.+?)\r?\n[ ]{0,3}```[ \t]*\r?$/m) do
139
+ cache_codeblock($~.to_s)
140
+ end
141
+ data
142
+ end
143
+
144
+ def process(data)
145
+ return data if data.nil? || data.size.zero? || @map.size.zero?
146
+ @map.each do |id, block| ## Just put the code blocks back in verbatim
147
+ data.gsub!(id, block)
148
+ end
149
+ data
150
+ end
151
+
152
+ def cache_codeblock(block)
153
+ id = "#{open_pattern}#{Digest::SHA1.hexdigest(block)}#{close_pattern}"
154
+ @map[id] = block
155
+ id
156
+ end
157
+ end
158
+
159
+ class ::Gollum::Filter::TagMigrator < Gollum::Filter::Tags
160
+ def process_tag(tag)
161
+ link_part, extra = parse_tag_parts(tag)
162
+ orig_tag = %{[[#{tag}]]}
163
+ return orig_tag if link_part.nil?
164
+
165
+ img_args = extra ? [extra, link_part] : [link_part]
166
+ mime = MIME::Types.type_for(::File.extname(img_args.first.to_s)).first
167
+
168
+ # For any kind of tag other than an internal link: just return the tag.
169
+ if tag =~ /^_TOC_/ || link_part =~ /^_$/ || link_part =~ /^#{INCLUDE_TAG}/ || (mime && mime.content_type =~ /^image/) || process_external_link_tag(link_part, extra) || process_file_link_tag(link_part, extra)
170
+ return orig_tag
171
+ end
172
+
173
+ # Try to resolve it as an internal Page link tag.
174
+ link = link_part
175
+ page = find_page_or_file_from_path(link)
176
+ anchor = nil
177
+
178
+ if page.nil? # No match yet, now try finding the page with anchor removed
179
+ if pos = link.rindex('#')
180
+ anchor = link[pos..-1]
181
+ link = link[0...pos]
182
+ end
183
+
184
+ if link.empty? && anchor # Internal anchor link, don't search for the page but return the original tag
185
+ return orig_tag
186
+ end
187
+
188
+ page = find_page_or_file_from_path(link)
189
+ end
190
+
191
+ if page
192
+ # Great, the link is not broken. Return the original tag.
193
+ return orig_tag
194
+ else
195
+ possibles = find_linked(link)
196
+ if possibles.empty?
197
+ log(:info, "Found no candidates for broken link: #{orig_tag}")
198
+ return orig_tag
199
+ else
200
+ if possibles.size > 1
201
+ log(:empty)
202
+ log(:warn, "Found multiple possibilities for the link '#{orig_tag}':")
203
+ possibles.map! {|p| Pathname.new(p)}
204
+ possibles.sort!
205
+ possibles.each{|p| log(:none, "* #{p}")}
206
+ log(:warn,"Picking #{possibles.first}")
207
+ log(:empty)
208
+ end
209
+ pick = possibles.first
210
+ return tag_for_pick(pick, orig_tag, extra, anchor, @markup.page.path)
211
+ end
212
+
213
+ end
214
+ end
215
+
216
+ private
217
+
218
+ def tag_for_pick(pick, orig_tag, extra, anchor, linking_page_path)
219
+ pick = if setting(:prefer_relative)
220
+ overlapping_path = Pathname.new(linking_page_path).dirname.to_s
221
+ overlapping_path = overlapping_path == '.' ? '' : ::File.join('/', overlapping_path)
222
+ relative_path = pick.to_s.match(/^#{overlapping_path}\/(.+)/)
223
+ relative_path ? relative_path[1] : pick
224
+ else
225
+ pick
226
+ end
227
+ new_tag = extra.nil? ? %{[[#{pick}#{anchor}]]} : %{[[#{extra}|#{pick}#{anchor}]]}
228
+ log(:info, "#{@markup.page.path}: Changing #{orig_tag} -> #{new_tag}")
229
+ new_tag
230
+ end
231
+ end
232
+
233
+ class ::Gollum::Filter::PlainTextMigrator < Gollum::Filter::PlainText
234
+ def extract(data)
235
+ data
236
+ end
237
+ end
238
+
239
+ filter_chain = [:PlainTextMigrator, :CodeMigrator, :TagMigrator]
240
+
241
+ wiki = ::Gollum::Wiki.new(wiki_directory, wiki_options.merge({:filter_chain => filter_chain}))
242
+
243
+ Object.class_variable_set(
244
+ :"@@wiki_tree",
245
+ wiki.tree_list(wiki.ref, true, true).map {|file| ::File.join('/', file.path)}
246
+ )
247
+
248
+ def find_linked(link)
249
+ link.gsub!(' ', '-') if setting(:hyphenate) # Match paths containing dashes instead of spaces
250
+ # If the link has no explicit file extension, test against the link + the '.' character.
251
+ # This is to avoid that 'Samwi' matches 'Samwise.md'
252
+ # If it has an explicit file extension ('Samwi.md'), just test against that.
253
+ test_path = ::File.extname(link).empty? ? /#{link}\..+/ : link
254
+ # Select pages from the wiki whose path =~ 'Foo/Bar/Samwi.*'
255
+ # Match case-insensitively to mimic 4.x behavior!
256
+ Object.class_variable_get(:"@@wiki_tree").select { |path|
257
+ path =~ /^\/(.*\/)?#{test_path}/i
258
+ }
259
+ end
260
+
261
+ def log(kind, msg = nil)
262
+ unless setting(:run_silent)
263
+ if kind == :none
264
+ puts msg
265
+ elsif kind == :empty
266
+ puts
267
+ else
268
+ puts "[#{kind.to_s.upcase}] #{msg}"
269
+ end
270
+ end
271
+ end
272
+
273
+ wiki.pages.each do |page|
274
+ log(:info,"Page #{page.path}")
275
+ new_data = page.formatted_data
276
+ if setting(:no_dry_run)
277
+ path = ::File.join(wiki.path, page.path)
278
+ f = File.new(path, 'w')
279
+ f.write(new_data)
280
+ f.close
281
+ end
282
+ log(:none, '====')
283
+ end
@@ -0,0 +1,12 @@
1
+ =begin
2
+ This file can be used to (e.g.):
3
+ - alter certain inner parts of Gollum,
4
+ - extend it with your stuff.
5
+
6
+ It is especially useful for customizing supported formats/markups. For more information and examples:
7
+ - https://github.com/gollum/gollum#config-file
8
+ - https://github.com/gollum/gollum/wiki/Sample-config.rb
9
+
10
+ =end
11
+
12
+ # enter your Ruby code here ...
@@ -0,0 +1,12 @@
1
+ =begin
2
+ You should use this file, if you wish to:
3
+ - launch Gollum as a Rack app,
4
+ - alter certain startup behaviour of Gollum.
5
+
6
+ For more information and examples:
7
+ - https://github.com/gollum/gollum/wiki/Gollum-via-Rack
8
+ - https://github.com/gollum/gollum#config-file
9
+
10
+ =end
11
+
12
+ # enter your Ruby code here ...
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Distributed under the terms of the MIT License.
4
+ #
5
+ # Author: Sam Baskinger <basking2@yahoo.com>
6
+ #
7
+ # Description: gollum-post is an example script that shows how
8
+ # to post a file to Gollum. This may be used
9
+ # to build scripts around CI/CD pipelines that
10
+ # publish their documentation to Gollum.
11
+ #
12
+
13
+ require 'uri'
14
+ require 'mechanize'
15
+ require 'digest'
16
+
17
+ GOLLUM=URI('https://mygollum.server')
18
+
19
+ m = Mechanize.new()
20
+
21
+ page="TestPage"
22
+ path="/automated/docs"
23
+ format="asciidoc"
24
+ content="""
25
+ = This is #{page}
26
+
27
+ This page is automatically generated.
28
+ """
29
+ message='Posting current documentation.'
30
+
31
+ # Check if the page exists.
32
+ p = m.get("#{GOLLUM}#{path}/#{page}")
33
+
34
+ # If we were redirected to the creat page...
35
+ if p.uri.to_s =~ /\/gollum\/create/
36
+
37
+ # ... then create the page.
38
+ p = m.post("#{GOLLUM}/gollum/create",
39
+ 'keybinding' => 'default',
40
+ 'page' => page,
41
+ 'path' => path,
42
+ 'format' => 'asciidoc',
43
+ 'message' => 'Publish bot.',
44
+ 'content' => content)
45
+ else
46
+ # ... else, get the previous content and update it.
47
+ p = m.get("#{GOLLUM}/gollum/edit#{path}/#{page}")
48
+
49
+ # Get the previous content. You _could_ check if this is unchanged at this
50
+ # step and post nothing.
51
+ previous_content = p.xpath('//textarea[@id="gollum-editor-body"]')[0].text
52
+
53
+ # The previous ETag is the Git SHA-1. We need this to replace the previous contents.
54
+ prev_etag = Digest::SHA1.hexdigest("blob #{previous_content.length}\0#{previous_content}")
55
+
56
+ # Post the updated document using the ETag of the previous document to avoid collisions.
57
+ p = m.post("#{GOLLUM}/gollum/edit#{path}/#{page}",
58
+ 'keybinding' => 'default',
59
+ 'page' => page,
60
+ 'path' => path,
61
+ 'format' => 'asciidoc',
62
+ 'message' => message,
63
+ 'etag' => prev_etag,
64
+ 'content' => content)
65
+ end
66
+
@@ -0,0 +1,3 @@
1
+ GOLLUM_USER=gollum
2
+ GOLLUM_BASE=/home/gollum/wiki
3
+ GOLLUM_OPTS="--config /home/gollum/config.rb"