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.
- checksums.yaml +7 -0
- data/gollum-6.1.0/CONTRIBUTING.md +221 -0
- data/gollum-6.1.0/Dockerfile +57 -0
- data/gollum-6.1.0/Gemfile +30 -0
- data/gollum-6.1.0/HISTORY.md +229 -0
- data/gollum-6.1.0/LATEST_CHANGES.md +6 -0
- data/gollum-6.1.0/LICENSE +21 -0
- data/gollum-6.1.0/README.md +177 -0
- data/gollum-6.1.0/Rakefile +297 -0
- data/gollum-6.1.0/bin/gollum +301 -0
- data/gollum-6.1.0/bin/gollum-migrate-tags +283 -0
- data/gollum-6.1.0/config.rb +12 -0
- data/gollum-6.1.0/config.ru +12 -0
- data/gollum-6.1.0/contrib/automation/gollum-post +66 -0
- data/gollum-6.1.0/contrib/openrc/conf.d/gollum +3 -0
- data/gollum-6.1.0/contrib/openrc/init.d/gollum +36 -0
- data/gollum-6.1.0/contrib/systemd/gollum@.service +12 -0
- data/gollum-6.1.0/contrib/sysv-debian/init.d/gollum +79 -0
- data/gollum-6.1.0/docker-run.sh +24 -0
- data/gollum-6.1.0/gollum.gemspec +305 -0
- data/gollum-6.1.0/lib/gollum/app.rb +747 -0
- data/gollum-6.1.0/lib/gollum/assets.rb +33 -0
- data/gollum-6.1.0/lib/gollum/helpers.rb +74 -0
- data/gollum-6.1.0/lib/gollum/locales/cn.yml +103 -0
- data/gollum-6.1.0/lib/gollum/locales/en.yml +103 -0
- data/gollum-6.1.0/lib/gollum/public/assets/app-05adca32f8f4f3effe10f8f4cf26dfd6a419ba986bce60d3f51a97e4055d4113.js +30 -0
- data/gollum-6.1.0/lib/gollum/public/assets/app-05adca32f8f4f3effe10f8f4cf26dfd6a419ba986bce60d3f51a97e4055d4113.js.gz +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/app-e224b375d824f0171fc926d624dc0887bf453db83f485b1992bc0859c4110e3e.css +11 -0
- data/gollum-6.1.0/lib/gollum/public/assets/app-e224b375d824f0171fc926d624dc0887bf453db83f485b1992bc0859c4110e3e.css.gz +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/criticmarkup-7b66f7a53b854bc9e4168be5b4725ca38e2bc6e9c41d5c050a9f60d9a94cb405.css +1 -0
- data/gollum-6.1.0/lib/gollum/public/assets/criticmarkup-7b66f7a53b854bc9e4168be5b4725ca38e2bc6e9c41d5c050a9f60d9a94cb405.css.gz +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/editor-9bef5462bb5dae2db84d6d8d534b55c5bb5a430e11344b3c23f9ea4410312f52.js +165 -0
- data/gollum-6.1.0/lib/gollum/public/assets/editor-9bef5462bb5dae2db84d6d8d534b55c5bb5a430e11344b3c23f9ea4410312f52.js.gz +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/gollum.katex-e70c1d51a08ebfe759eecbb33fbed54f300ccd7fb8d0e86e251caaf4e50f6b68.js +9 -0
- data/gollum-6.1.0/lib/gollum/public/assets/gollum.katex-e70c1d51a08ebfe759eecbb33fbed54f300ccd7fb8d0e86e251caaf4e50f6b68.js.gz +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/gollum.mermaid-06fd2f5494199db250618043312c27770720504b50c3f6ca99d2d2df529c7da3.js +118 -0
- data/gollum-6.1.0/lib/gollum/public/assets/gollum.mermaid-06fd2f5494199db250618043312c27770720504b50c3f6ca99d2d2df529c7da3.js.gz +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/katex-709d4191c4f005516a709377f79e468d343f4e6c91a29a6ff188d13d124ba55f.css +1 -0
- data/gollum-6.1.0/lib/gollum/public/assets/katex/dist/katex-709d4191c4f005516a709377f79e468d343f4e6c91a29a6ff188d13d124ba55f.css.gz +0 -0
- data/gollum-6.1.0/lib/gollum/public/assets/print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css +1 -0
- data/gollum-6.1.0/lib/gollum/public/assets/print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css.gz +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/HOWTO_UPDATE_MATHJAX.md +21 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/a11y/assistive-mml.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/a11y/complexity.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/a11y/explorer.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/a11y/semantic-enrich.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/a11y/sre.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/adaptors/liteDOM.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/core.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/asciimath.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/mml/entities.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/mml/extensions/mml3.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/mml/extensions/mml3.sef.json +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/mml.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/action.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/all-packages.js +34 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/ams.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/amscd.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/autoload.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/bbox.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/boldsymbol.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/braket.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/bussproofs.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/cancel.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/cases.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/centernot.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/color.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/colortbl.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/colorv2.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/configmacros.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/empheq.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/enclose.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/extpfeil.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/gensymb.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/html.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/mathtools.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/mhchem.js +34 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/newcommand.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/noerrors.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/noundefined.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/physics.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/require.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/setoptions.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/tagformat.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/textcomp.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/textmacros.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/unicode.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/upgreek.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex/extensions/verb.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex-base.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex-full.js +34 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/input/tex.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/latest.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/loader.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/node-main.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/tex.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/chtml.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/svg/fonts/tex.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/output/svg.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/base.json +29 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/ca.json +140 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/da.json +140 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/de.json +146 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/en.json +158 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/es.json +140 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/fr.json +146 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/hi.json +146 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/it.json +146 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/nb.json +146 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/nemeth.json +125 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/nn.json +146 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/sre/mathmaps/sv.json +146 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/startup.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/tex-chtml-full-speech.js +34 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/tex-mml-chtml.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/ui/lazy.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/ui/menu.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/MathJax/ui/safe.js +1 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/app.js +15 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/clipboard.min.js +7 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/date.min.js +123 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/gollum.editor.js +1277 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/asciidoc.js +117 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/bib.js +8 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/creole.js +70 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/default.js +201 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/markdown.js +119 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/mediawiki.js +122 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/org.js +128 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/plaintext.js +8 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/pod.js +93 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/rdoc.js +23 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/rest.js +187 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/langs/textile.js +133 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/modes.js.erb +252 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor/sections.js +87 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/editor.js +30 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.behaviors.js +40 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.dialog.js +263 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.js.erb +814 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.katex.js +3 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.mermaid.js +2 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/gollum.placeholder.js +54 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/identicon.js +205 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/jquery-1.9.1.min.js +5 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/jquery.resize.js +164 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/javascript/polyfills.js +6 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/_base.scss +13 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/_breakpoint.scss +22 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/_features.scss +84 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/_spinners.scss +245 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/app.scss +16 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/criticmarkup.scss +42 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/dialog.scss +140 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/editor.scss +217 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/emoji.scss +5 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/highlights.scss +196 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/print.scss +16 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/spinner.scss +9 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/tables.scss +47 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/template.scss.erb +204 -0
- data/gollum-6.1.0/lib/gollum/public/gollum/stylesheets/wiki_content.scss +144 -0
- data/gollum-6.1.0/lib/gollum/templates/commit.mustache +29 -0
- data/gollum-6.1.0/lib/gollum/templates/compare.mustache +84 -0
- data/gollum-6.1.0/lib/gollum/templates/create.mustache +26 -0
- data/gollum-6.1.0/lib/gollum/templates/edit.mustache +24 -0
- data/gollum-6.1.0/lib/gollum/templates/editor.mustache +215 -0
- data/gollum-6.1.0/lib/gollum/templates/error.mustache +8 -0
- data/gollum-6.1.0/lib/gollum/templates/history.mustache +51 -0
- data/gollum-6.1.0/lib/gollum/templates/history_authors/gravatar.mustache +2 -0
- data/gollum-6.1.0/lib/gollum/templates/history_authors/identicon.mustache +2 -0
- data/gollum-6.1.0/lib/gollum/templates/history_authors/none.mustache +2 -0
- data/gollum-6.1.0/lib/gollum/templates/latest_changes.mustache +36 -0
- data/gollum-6.1.0/lib/gollum/templates/layout.mustache +140 -0
- data/gollum-6.1.0/lib/gollum/templates/mobilenav.mustache +72 -0
- data/gollum-6.1.0/lib/gollum/templates/navbar.mustache +110 -0
- data/gollum-6.1.0/lib/gollum/templates/overview.mustache +55 -0
- data/gollum-6.1.0/lib/gollum/templates/page.mustache +13 -0
- data/gollum-6.1.0/lib/gollum/templates/pagination.mustache +23 -0
- data/gollum-6.1.0/lib/gollum/templates/search.mustache +51 -0
- data/gollum-6.1.0/lib/gollum/templates/searchbar.mustache +3 -0
- data/gollum-6.1.0/lib/gollum/templates/wiki_content.mustache +64 -0
- data/gollum-6.1.0/lib/gollum/uri_encode_component.rb +212 -0
- data/gollum-6.1.0/lib/gollum/views/commit.rb +49 -0
- data/gollum-6.1.0/lib/gollum/views/compare.rb +109 -0
- data/gollum-6.1.0/lib/gollum/views/create.rb +53 -0
- data/gollum-6.1.0/lib/gollum/views/edit.rb +78 -0
- data/gollum-6.1.0/lib/gollum/views/editable.rb +31 -0
- data/gollum-6.1.0/lib/gollum/views/error.rb +7 -0
- data/gollum-6.1.0/lib/gollum/views/has_math.rb +15 -0
- data/gollum-6.1.0/lib/gollum/views/has_page.rb +19 -0
- data/gollum-6.1.0/lib/gollum/views/has_user_icons.rb +15 -0
- data/gollum-6.1.0/lib/gollum/views/helpers/locale_helpers.rb +89 -0
- data/gollum-6.1.0/lib/gollum/views/helpers.rb +132 -0
- data/gollum-6.1.0/lib/gollum/views/history.rb +56 -0
- data/gollum-6.1.0/lib/gollum/views/latest_changes.rb +44 -0
- data/gollum-6.1.0/lib/gollum/views/layout.rb +103 -0
- data/gollum-6.1.0/lib/gollum/views/overview.rb +81 -0
- data/gollum-6.1.0/lib/gollum/views/page.rb +277 -0
- data/gollum-6.1.0/lib/gollum/views/pagination.rb +13 -0
- data/gollum-6.1.0/lib/gollum/views/rss.rb +84 -0
- data/gollum-6.1.0/lib/gollum/views/search.rb +47 -0
- data/gollum-6.1.0/lib/gollum/views/template_cascade.rb +29 -0
- data/gollum-6.1.0/lib/gollum.rb +42 -0
- data/gollum-6.1.0/licenses/licenses.txt +31 -0
- data/gollum-6.1.0/package.json +12 -0
- data/gollum-6.1.0/yarn.lock +1025 -0
- data/super-pro-rb.gemspec +11 -0
- metadata +290 -0
|
@@ -0,0 +1,1277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gollum.editor.js
|
|
3
|
+
* A jQuery plugin that creates the Gollum Editor.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* $.GollumEditor(); on DOM ready.
|
|
7
|
+
*/
|
|
8
|
+
(function($) {
|
|
9
|
+
|
|
10
|
+
// Editor options
|
|
11
|
+
var DefaultOptions = {
|
|
12
|
+
MarkupType: 'markdown',
|
|
13
|
+
EditorMode: 'code',
|
|
14
|
+
NewFile: false,
|
|
15
|
+
HasFunctionBar: true,
|
|
16
|
+
Debug: false,
|
|
17
|
+
NoDefinitionsFor: []
|
|
18
|
+
};
|
|
19
|
+
var ActiveOptions = {};
|
|
20
|
+
var autoSaveTimer = null;
|
|
21
|
+
var storageKey = 'gollum_autorecover_' + window.location;
|
|
22
|
+
|
|
23
|
+
function isRTL(s){
|
|
24
|
+
var ltrChars = 'A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF'+'\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF',
|
|
25
|
+
rtlChars = '\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC',
|
|
26
|
+
rtlDirCheck = new RegExp('^[^'+ltrChars+']*['+rtlChars+']');
|
|
27
|
+
|
|
28
|
+
return rtlDirCheck.test(s);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function switchRtl(b){
|
|
32
|
+
window.ace_editor.session.$bidiHandler.$isRtl = b;
|
|
33
|
+
window.ace_editor.session.$bidiHandler.updateBidiMap();
|
|
34
|
+
window.ace_editor.renderer.updateFull();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function autoSaveHandler() {
|
|
38
|
+
// Autosave
|
|
39
|
+
if (autoSaveTimer) {
|
|
40
|
+
// Reset the timer because we just changed the text
|
|
41
|
+
clearTimeout(autoSaveTimer);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
$('#gollum-saved-msg').text('Saving...');
|
|
45
|
+
|
|
46
|
+
// Wait 2 seconds, then actually save the text to local storage
|
|
47
|
+
autoSaveTimer = setTimeout(function() {
|
|
48
|
+
localStorage.setItem(storageKey, window.ace_editor.getSession().getValue());
|
|
49
|
+
// Save any subpage editor text that might exist
|
|
50
|
+
$('#gollum-editor-header, #gollum-editor-footer, #gollum-editor-sidebar').each(function(_, el) {
|
|
51
|
+
var spStorageKey = storageKey + el.id.replace('gollum-editor-', '_');
|
|
52
|
+
localStorage.setItem(spStorageKey, el.value);
|
|
53
|
+
});
|
|
54
|
+
$('#gollum-saved-msg').text('Saved recovery text');
|
|
55
|
+
}, 2000);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function setEditorKeyboardHandler(mode) {
|
|
59
|
+
var editor = window.ace_editor;
|
|
60
|
+
var storage = window.localStorage;
|
|
61
|
+
storage.setItem('gollum-kbm', mode)
|
|
62
|
+
if (mode == "default") {
|
|
63
|
+
editor.setKeyboardHandler();
|
|
64
|
+
} else if (mode == "vim" || mode == "emacs") {
|
|
65
|
+
editor.setKeyboardHandler("ace/keyboard/" + mode);
|
|
66
|
+
} else {
|
|
67
|
+
editor.setKeyboardHandler();
|
|
68
|
+
}
|
|
69
|
+
editor.focus();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* $.GollumEditor
|
|
74
|
+
*
|
|
75
|
+
* You don't need to do anything. Just run this on DOM ready.
|
|
76
|
+
*/
|
|
77
|
+
$.GollumEditor = function( IncomingOptions ) {
|
|
78
|
+
ActiveOptions = $.extend( DefaultOptions, IncomingOptions );
|
|
79
|
+
|
|
80
|
+
$('textarea[id="gollum-editor-body"]').each(function () {
|
|
81
|
+
var textarea = $(this);
|
|
82
|
+
var mode = textarea.attr("data-markup-lang") ? textarea.attr("data-markup-lang") : "markdown"
|
|
83
|
+
var editDiv = $('<div>', {
|
|
84
|
+
position: 'absolute',
|
|
85
|
+
height: textarea.height(),
|
|
86
|
+
'class': textarea.attr('class'),
|
|
87
|
+
'id': 'gollum-editor-body-ace'
|
|
88
|
+
}).insertAfter(textarea);
|
|
89
|
+
textarea.css('display', 'none');
|
|
90
|
+
|
|
91
|
+
// NOTE: This requires the page to have only one 'gollum-editor-body'.
|
|
92
|
+
var editor = ace.edit(editDiv[0], {rtlText: true});
|
|
93
|
+
window.ace_editor = editor;
|
|
94
|
+
|
|
95
|
+
// Check to see if we have any autosaved text and show a message to
|
|
96
|
+
// restore it if present.
|
|
97
|
+
var savedText = localStorage.getItem(storageKey);
|
|
98
|
+
|
|
99
|
+
if (savedText) {
|
|
100
|
+
$('#gollum-autorecover-button').click(function(e) {
|
|
101
|
+
editor.getSession().setValue(savedText);
|
|
102
|
+
// Restore subpage editor values too, if they exist
|
|
103
|
+
['header', 'footer', 'sidebar'].forEach(function(i) {
|
|
104
|
+
var sbSavedText = localStorage.getItem(storageKey + '_' + i);
|
|
105
|
+
if (sbSavedText) {
|
|
106
|
+
$('#gollum-editor-' + i).val(sbSavedText);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
$('#gollum-autorecover-msg')[0].hidden = true;
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
});
|
|
112
|
+
$('#gollum-autorecover-msg')[0].hidden = false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Check for user last keybind and ensure ui is correct
|
|
116
|
+
var storage = window.localStorage;
|
|
117
|
+
var userDefaultKeybind = storage.getItem('gollum-kbm');
|
|
118
|
+
if (userDefaultKeybind) {
|
|
119
|
+
default_keybinding = userDefaultKeybind;
|
|
120
|
+
}
|
|
121
|
+
basicSelectSetSelection($('#keybinding'), default_keybinding);
|
|
122
|
+
|
|
123
|
+
editor.setTheme("ace/theme/tomorrow");
|
|
124
|
+
setEditorKeyboardHandler(default_keybinding);
|
|
125
|
+
editor.renderer.setShowGutter(false);
|
|
126
|
+
editor.getSession().setUseWrapMode(true);
|
|
127
|
+
editor.getSession().setValue(textarea.val());
|
|
128
|
+
editor.getSession().setMode($.getEditorMode(mode));
|
|
129
|
+
|
|
130
|
+
editor.getSession().on('change', function(){
|
|
131
|
+
textarea.val(editor.getSession().getValue());
|
|
132
|
+
autoSaveHandler();
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Autosave for the header, footer and sidebar
|
|
136
|
+
$('#gollum-editor-header, #gollum-editor-footer, #gollum-editor-sidebar')
|
|
137
|
+
.on('change keyup paste', autoSaveHandler);
|
|
138
|
+
|
|
139
|
+
if (isRTL(editor.getSession().getLine(0))) {
|
|
140
|
+
switchRtl(true);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
editor.commands.addCommand({
|
|
144
|
+
name: "showKeyboardShortcuts",
|
|
145
|
+
bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
|
|
146
|
+
exec: function(editor) {
|
|
147
|
+
ace.config.loadModule("ace/ext/keybinding_menu", function(module) {
|
|
148
|
+
module.init(editor);
|
|
149
|
+
editor.showKeyboardShortcuts();
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
if ( ActiveOptions.commands ) {
|
|
155
|
+
$.each(ActiveOptions.commands, function ( index, cmd ) {
|
|
156
|
+
editor.commands.addCommand(cmd);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
$("#gollum-editor-body-ace").resize(function(){
|
|
163
|
+
window.ace_editor.resize();
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
$("#wiki_format").on('change', function(event, selected_value) {
|
|
167
|
+
// Set hidden form field 'format'
|
|
168
|
+
$('#format').attr('value', selected_value);
|
|
169
|
+
// Update editor session
|
|
170
|
+
var mode = selected_value;
|
|
171
|
+
var editor = window.ace_editor;
|
|
172
|
+
window.ace_editor.getSession().setMode($.getEditorMode(mode));
|
|
173
|
+
FormatSelector.updateCommitMessage(mode);
|
|
174
|
+
editor.focus();
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
$("#keybinding").on('change', function(event, selected_value) {
|
|
178
|
+
setEditorKeyboardHandler(selected_value);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Remove any autosaved text when we hit save or cancel
|
|
182
|
+
$("#gollum-editor-submit, #gollum-editor-cancel").click(function() {
|
|
183
|
+
var storageKey = 'gollum_autorecover_' + window.location;
|
|
184
|
+
localStorage.removeItem(storageKey);
|
|
185
|
+
// Clear subpage editor values too, if they exist
|
|
186
|
+
['header', 'footer', 'sidebar'].forEach(function(i) {
|
|
187
|
+
localStorage.removeItem(storageKey + '_' + i);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
debug('GollumEditor loading');
|
|
192
|
+
|
|
193
|
+
if ( EditorHas.baseEditorMarkup() ) {
|
|
194
|
+
|
|
195
|
+
if ( EditorHas.titleDisplayed() ) {
|
|
196
|
+
$('#gollum-editor-title-field').addClass('active');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if ( EditorHas.editSummaryMarkup() ) {
|
|
200
|
+
$.GollumEditor.Placeholder.add($('#gollum-editor-edit-summary input'));
|
|
201
|
+
$('#gollum-editor form[name="gollum-editor"]').submit(function( e ) {
|
|
202
|
+
e.preventDefault();
|
|
203
|
+
// Do not clear default place holder text
|
|
204
|
+
// Updated home (markdown)
|
|
205
|
+
// $.GollumEditor.Placeholder.clearAll();
|
|
206
|
+
debug('submitting');
|
|
207
|
+
$(this).unbind('submit');
|
|
208
|
+
$(this).submit();
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if ( EditorHas.collapsibleInputs() ) {
|
|
213
|
+
$('#gollum-editor .collapsed button.collapsable, ' +
|
|
214
|
+
'#gollum-editor .expanded button.collapsable').click(function( e ) {
|
|
215
|
+
e.preventDefault();
|
|
216
|
+
$(this).parent().toggleClass('expanded');
|
|
217
|
+
$(this).parent().toggleClass('collapsed');
|
|
218
|
+
|
|
219
|
+
buttons = $(this).parent().children("button");
|
|
220
|
+
hidden_button = buttons.filter(':hidden')[0];
|
|
221
|
+
shown_button = buttons.not(':hidden')[0];
|
|
222
|
+
hidden_button.hidden = false;
|
|
223
|
+
shown_button.hidden = true;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if ( EditorHas.previewButton() ) {
|
|
228
|
+
var formAction =
|
|
229
|
+
$('#gollum-editor #gollum-editor-preview').click(function() {
|
|
230
|
+
// make a dummy form, submit to new target window
|
|
231
|
+
// get form fields
|
|
232
|
+
var oldAction = $('#gollum-editor form').attr('action');
|
|
233
|
+
var $form = $($('#gollum-editor form').get(0));
|
|
234
|
+
$form.attr('action', this.href || routePath('preview'));
|
|
235
|
+
$form.attr('target', '_blank');
|
|
236
|
+
var paths = window.location.pathname.split('/');
|
|
237
|
+
$form.attr('page', decodeURIComponent(paths[ paths.length - 1 ]) || '')
|
|
238
|
+
$form.submit();
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
$form.attr('action', oldAction);
|
|
242
|
+
$form.removeAttr('target');
|
|
243
|
+
return false;
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Initialize the function bar by loading proper definitions
|
|
248
|
+
if ( EditorHas.functionBar() ) {
|
|
249
|
+
|
|
250
|
+
var htmlSetMarkupLang =
|
|
251
|
+
$('#gollum-editor-body').attr('data-markup-lang');
|
|
252
|
+
|
|
253
|
+
if ( htmlSetMarkupLang ) {
|
|
254
|
+
ActiveOptions.MarkupType = htmlSetMarkupLang;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// load language definition
|
|
258
|
+
LanguageDefinition.setActiveLanguage( ActiveOptions.MarkupType );
|
|
259
|
+
if ( EditorHas.formatSelector() ) {
|
|
260
|
+
FormatSelector.init(
|
|
261
|
+
$('#wiki_format') );
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if ( EditorHas.dir() ) {
|
|
265
|
+
$('#function-text-direction').click(function( e ) {
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
switchRtl(!window.ace_editor.session.$bidiHandler.$isRtl);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if ( EditorHas.help() ) {
|
|
272
|
+
$('#gollum-editor-help').hide();
|
|
273
|
+
$('#gollum-editor-help').removeClass('jaws');
|
|
274
|
+
}
|
|
275
|
+
} // EditorHas.functionBar
|
|
276
|
+
|
|
277
|
+
if (ActiveOptions['section'] && $.markupSupportsEditableSections ( ActiveOptions.MarkupType )) {
|
|
278
|
+
var sectionLine = $.findSection(ActiveOptions['section'], LanguageDefinition.getDefinitionFor('gollum-helpers'));
|
|
279
|
+
if (sectionLine) {
|
|
280
|
+
window.ace_editor.gotoLine(sectionLine+1, 0, animate=false);
|
|
281
|
+
window.ace_editor.scrollToLine(sectionLine, center = false, animate = false);
|
|
282
|
+
window.ace_editor.focus();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if ( EditorHas.dragDropUpload() ) {
|
|
287
|
+
var $editorBody = $('#gollum-editor-body-ace');
|
|
288
|
+
var editorBody = $('#gollum-editor-body-ace')[0];
|
|
289
|
+
editorBody.ondragover = function(e) {
|
|
290
|
+
$editorBody.addClass('dragging');
|
|
291
|
+
return false;
|
|
292
|
+
};
|
|
293
|
+
editorBody.ondragleave = function() {
|
|
294
|
+
$editorBody.removeClass('dragging');
|
|
295
|
+
return false;
|
|
296
|
+
};
|
|
297
|
+
editorBody.ondrop = function(e) {
|
|
298
|
+
debug("dropped file");
|
|
299
|
+
e.preventDefault();
|
|
300
|
+
$editorBody.removeClass('dragging').addClass('uploading');
|
|
301
|
+
|
|
302
|
+
var file = e.dataTransfer.files[0],
|
|
303
|
+
formData = new FormData();
|
|
304
|
+
formData.append('file', file);
|
|
305
|
+
|
|
306
|
+
if (Object.prototype.toString.call(file) != '[object File]') {
|
|
307
|
+
$editorBody.removeClass('uploading');
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
$.ajax({
|
|
312
|
+
url: routePath('upload_file'),
|
|
313
|
+
data: formData,
|
|
314
|
+
cache: false,
|
|
315
|
+
contentType: false,
|
|
316
|
+
processData: false,
|
|
317
|
+
type: 'POST',
|
|
318
|
+
success: function(){
|
|
319
|
+
$editorBody.removeClass('uploading');
|
|
320
|
+
var ext = file.name.split('.').pop().toLowerCase()
|
|
321
|
+
var image_ext = ['jpg', 'jpeg', 'tif', 'tiff', 'png', 'gif', 'svg', 'bmp']
|
|
322
|
+
// Link directly to image files
|
|
323
|
+
uploadDest = uploadDest.replace(/%20/g, ' ');
|
|
324
|
+
if ((image_ext.indexOf(ext) > -1)) {
|
|
325
|
+
var text = '[[/' + uploadDest + '/' + file.name + ']]';
|
|
326
|
+
} else {
|
|
327
|
+
// Add file name to tag for non-image files, to avoid broken image thumbnail
|
|
328
|
+
var text = '[[' + file.name + '|/' + uploadDest + '/' + file.name + ']]';
|
|
329
|
+
}
|
|
330
|
+
window.ace_editor.insert(text);
|
|
331
|
+
},
|
|
332
|
+
error: function(data, textStatus, errorThrown) {
|
|
333
|
+
if (data.status == 409) {
|
|
334
|
+
alert('This file already exists.');
|
|
335
|
+
} else {
|
|
336
|
+
alert('Error uploading file: ' + textStatus + ' ' + errorThrown);
|
|
337
|
+
}
|
|
338
|
+
$editorBody.removeClass('uploading');
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
return false;
|
|
343
|
+
};
|
|
344
|
+
} // EditorHas.dragDropUpload
|
|
345
|
+
} // EditorHas.baseEditorMarkup
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* $.GollumEditor.defineLanguage
|
|
352
|
+
* Defines a set of language actions that Gollum can use.
|
|
353
|
+
* Used by the definitions in langs/ to register language definitions.
|
|
354
|
+
*/
|
|
355
|
+
$.GollumEditor.defineLanguage = function( language_name, languageObject ) {
|
|
356
|
+
if ( typeof languageObject == 'object' ) {
|
|
357
|
+
LanguageDefinition.define( language_name, languageObject );
|
|
358
|
+
} else {
|
|
359
|
+
debug('GollumEditor.defineLanguage: definition for ' + language_name +
|
|
360
|
+
' is not an object');
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* debug
|
|
367
|
+
* Prints debug information to console.log if debug output is enabled.
|
|
368
|
+
*
|
|
369
|
+
* @param mixed Whatever you want to dump to console.log
|
|
370
|
+
* @return void
|
|
371
|
+
*/
|
|
372
|
+
var debug = function(m) {
|
|
373
|
+
if ( ActiveOptions.Debug &&
|
|
374
|
+
typeof console != 'undefined' ) {
|
|
375
|
+
console.log( m );
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* LanguageDefinition
|
|
383
|
+
* Language definition file handler
|
|
384
|
+
* Loads language definition files as necessary.
|
|
385
|
+
*/
|
|
386
|
+
var LanguageDefinition = {
|
|
387
|
+
|
|
388
|
+
_ACTIVE_LANG: '',
|
|
389
|
+
_LOADED_LANGS: [],
|
|
390
|
+
_LANG: {},
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Defines a language
|
|
394
|
+
*
|
|
395
|
+
* @param name string The name of the language
|
|
396
|
+
* @param name object The definition object
|
|
397
|
+
*/
|
|
398
|
+
define: function( name, definitionObject ) {
|
|
399
|
+
LanguageDefinition._ACTIVE_LANG = name;
|
|
400
|
+
LanguageDefinition._LOADED_LANGS.push( name );
|
|
401
|
+
if ( typeof $.GollumEditor.WikiLanguage == 'object' ) {
|
|
402
|
+
var definition = {};
|
|
403
|
+
$.extend(definition, $.GollumEditor.WikiLanguage, definitionObject);
|
|
404
|
+
LanguageDefinition._LANG[name] = definition;
|
|
405
|
+
} else {
|
|
406
|
+
LanguageDefinition._LANG[name] = definitionObject;
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
|
|
410
|
+
getActiveLanguage: function() {
|
|
411
|
+
return LanguageDefinition._ACTIVE_LANG;
|
|
412
|
+
},
|
|
413
|
+
|
|
414
|
+
setActiveLanguage: function( name ) {
|
|
415
|
+
// On first load _ACTIVE_LANG.length is 0 and evtChangeFormat isn't called.
|
|
416
|
+
if ( LanguageDefinition._ACTIVE_LANG != null && LanguageDefinition._ACTIVE_LANG.length <= 0 ) {
|
|
417
|
+
FormatSelector.updateCommitMessage( name );
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if(LanguageDefinition.getHookFunctionFor("deactivate")) {
|
|
421
|
+
LanguageDefinition.getHookFunctionFor("deactivate")();
|
|
422
|
+
}
|
|
423
|
+
if ( !LanguageDefinition.isLoadedFor(name) ) {
|
|
424
|
+
LanguageDefinition._ACTIVE_LANG = null;
|
|
425
|
+
|
|
426
|
+
// update features that rely on the language definition
|
|
427
|
+
if ( EditorHas.functionBar() ) {
|
|
428
|
+
FunctionBar.refresh();
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
if ( LanguageDefinition.isValid() && EditorHas.formatSelector() ) {
|
|
432
|
+
FormatSelector.updateSelected();
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if(LanguageDefinition.getHookFunctionFor("activate")) {
|
|
436
|
+
LanguageDefinition.getHookFunctionFor("activate")();
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
} else {
|
|
440
|
+
LanguageDefinition._ACTIVE_LANG = name;
|
|
441
|
+
FunctionBar.refresh();
|
|
442
|
+
|
|
443
|
+
if(LanguageDefinition.getHookFunctionFor("activate")) {
|
|
444
|
+
LanguageDefinition.getHookFunctionFor("activate")();
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function hotkey( cmd ) {
|
|
449
|
+
return function () {
|
|
450
|
+
var def = LanguageDefinition.getDefinitionFor( cmd );
|
|
451
|
+
if ( typeof def == 'object' ) {
|
|
452
|
+
FunctionBar.executeAction( def );
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
window.ace_editor.commands.addCommand({
|
|
458
|
+
name: "header-1",
|
|
459
|
+
bindKey: {win: "Ctrl-1", mac: "Command-1"},
|
|
460
|
+
exec: hotkey('function-h1')
|
|
461
|
+
});
|
|
462
|
+
window.ace_editor.commands.addCommand({
|
|
463
|
+
name: "header-2",
|
|
464
|
+
bindKey: {win: "Ctrl-2", mac: "Command-2"},
|
|
465
|
+
exec: hotkey('function-h2')
|
|
466
|
+
});
|
|
467
|
+
window.ace_editor.commands.addCommand({
|
|
468
|
+
name: "header-3",
|
|
469
|
+
bindKey: {win: "Ctrl-3", mac: "Command-3"},
|
|
470
|
+
exec: hotkey('function-h3')
|
|
471
|
+
});
|
|
472
|
+
window.ace_editor.commands.addCommand({
|
|
473
|
+
name: "bold-text",
|
|
474
|
+
bindKey: {win: "Ctrl-b", mac: "Command-b"},
|
|
475
|
+
exec: hotkey('function-bold')
|
|
476
|
+
});
|
|
477
|
+
window.ace_editor.commands.addCommand({
|
|
478
|
+
name: "italic-text",
|
|
479
|
+
bindKey: {win: "Ctrl-i", mac: "Command-i"},
|
|
480
|
+
exec: hotkey('function-italic')
|
|
481
|
+
});
|
|
482
|
+
},
|
|
483
|
+
|
|
484
|
+
getHookFunctionFor: function(attr, specified_lang) {
|
|
485
|
+
if ( !specified_lang ) {
|
|
486
|
+
specified_lang = LanguageDefinition._ACTIVE_LANG;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
if ( LanguageDefinition.isLoadedFor(specified_lang) &&
|
|
490
|
+
LanguageDefinition._LANG[specified_lang][attr] &&
|
|
491
|
+
typeof LanguageDefinition._LANG[specified_lang][attr] == 'function' ) {
|
|
492
|
+
return LanguageDefinition._LANG[specified_lang][attr];
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
return null;
|
|
496
|
+
},
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* gets a definition object for a specified attribute
|
|
500
|
+
*
|
|
501
|
+
* @param string attr The specified attribute.
|
|
502
|
+
* @param string specified_lang The language to pull a definition for.
|
|
503
|
+
* @return object if exists, null otherwise
|
|
504
|
+
*/
|
|
505
|
+
getDefinitionFor: function( attr, specified_lang ) {
|
|
506
|
+
if ( !specified_lang ) {
|
|
507
|
+
specified_lang = LanguageDefinition._ACTIVE_LANG;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if ( LanguageDefinition.isLoadedFor(specified_lang) &&
|
|
511
|
+
LanguageDefinition._LANG[specified_lang][attr] &&
|
|
512
|
+
typeof LanguageDefinition._LANG[specified_lang][attr] == 'object' ) {
|
|
513
|
+
return LanguageDefinition._LANG[specified_lang][attr];
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
return null;
|
|
517
|
+
},
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* isLoadedFor
|
|
521
|
+
* Checks to see if a definition file has been loaded for the
|
|
522
|
+
* specified markup language.
|
|
523
|
+
*
|
|
524
|
+
* @param string markup_name The name of the markup.
|
|
525
|
+
* @return boolean
|
|
526
|
+
*/
|
|
527
|
+
isLoadedFor: function( markup_name ) {
|
|
528
|
+
if ( LanguageDefinition._LOADED_LANGS.length === 0 ) {
|
|
529
|
+
return false;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
for ( var i=0; i < LanguageDefinition._LOADED_LANGS.length; i++ ) {
|
|
533
|
+
if ( LanguageDefinition._LOADED_LANGS[i] == markup_name ) {
|
|
534
|
+
return true;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
return false;
|
|
538
|
+
},
|
|
539
|
+
|
|
540
|
+
isValid: function() {
|
|
541
|
+
return ( LanguageDefinition._ACTIVE_LANG &&
|
|
542
|
+
typeof LanguageDefinition._LANG[LanguageDefinition._ACTIVE_LANG] ==
|
|
543
|
+
'object' );
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* EditorHas
|
|
551
|
+
* Various conditionals to check what features of the Gollum Editor are
|
|
552
|
+
* active/operational.
|
|
553
|
+
*/
|
|
554
|
+
var EditorHas = {
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* EditorHas.baseEditorMarkup
|
|
559
|
+
* True if the basic editor form is in place.
|
|
560
|
+
*
|
|
561
|
+
* @return boolean
|
|
562
|
+
*/
|
|
563
|
+
baseEditorMarkup: function() {
|
|
564
|
+
return ( $('#gollum-editor').length &&
|
|
565
|
+
$('#gollum-editor-body').length );
|
|
566
|
+
},
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* EditorHas.collapsibleInputs
|
|
571
|
+
* True if the editor contains collapsible inputs for things like the
|
|
572
|
+
* sidebar or footer, false otherwise.
|
|
573
|
+
*
|
|
574
|
+
* @return boolean
|
|
575
|
+
*/
|
|
576
|
+
collapsibleInputs: function() {
|
|
577
|
+
return $('#gollum-editor .collapsed, #gollum-editor .expanded').length;
|
|
578
|
+
},
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* EditorHas.formatSelector
|
|
583
|
+
* True if the editor has a format selector (for switching between
|
|
584
|
+
* language types), false otherwise.
|
|
585
|
+
*
|
|
586
|
+
* @return boolean
|
|
587
|
+
*/
|
|
588
|
+
formatSelector: function() {
|
|
589
|
+
return $('#wiki_format').length;
|
|
590
|
+
},
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* EditorHas.functionBar
|
|
595
|
+
* True if the Function Bar markup exists.
|
|
596
|
+
*
|
|
597
|
+
* @return boolean
|
|
598
|
+
*/
|
|
599
|
+
functionBar: function() {
|
|
600
|
+
return ( ActiveOptions.HasFunctionBar &&
|
|
601
|
+
$('#gollum-editor-function-bar').length );
|
|
602
|
+
},
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* EditorHas.ff4Environment
|
|
607
|
+
* True if in a Firefox 4.0 Beta environment.
|
|
608
|
+
*
|
|
609
|
+
* @return boolean
|
|
610
|
+
*/
|
|
611
|
+
ff4Environment: function() {
|
|
612
|
+
var ua = new RegExp(/Firefox\/4.0b/);
|
|
613
|
+
return ( ua.test( navigator.userAgent ) );
|
|
614
|
+
},
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* EditorHas.editSummaryMarkup
|
|
619
|
+
* True if the editor has a summary field (Gollum's commit message),
|
|
620
|
+
* false otherwise.
|
|
621
|
+
*
|
|
622
|
+
* @return boolean
|
|
623
|
+
*/
|
|
624
|
+
editSummaryMarkup: function() {
|
|
625
|
+
return ( $('input#gollum-editor-message-field').length > 0 );
|
|
626
|
+
},
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* EditorHas.help
|
|
631
|
+
* True if the editor contains the inline help sector, false otherwise.
|
|
632
|
+
*
|
|
633
|
+
* @return boolean
|
|
634
|
+
*/
|
|
635
|
+
help: function() {
|
|
636
|
+
return ( $('#gollum-editor #gollum-editor-help').length &&
|
|
637
|
+
$('#gollum-editor #function-help').length );
|
|
638
|
+
},
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* EditorHas.dir
|
|
642
|
+
* True if the editor contains the inline text direction button.
|
|
643
|
+
*
|
|
644
|
+
* @return boolean
|
|
645
|
+
*/
|
|
646
|
+
dir: function() {
|
|
647
|
+
return ($('#gollum-editor #function-text-direction').length );
|
|
648
|
+
},
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* EditorHas.previewButton
|
|
653
|
+
* True if the editor has a preview button, false otherwise.
|
|
654
|
+
*
|
|
655
|
+
* @return boolean
|
|
656
|
+
*/
|
|
657
|
+
previewButton: function() {
|
|
658
|
+
return ( $('#gollum-editor #gollum-editor-preview').length );
|
|
659
|
+
},
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* EditorHas.titleDisplayed
|
|
664
|
+
* True if the editor is displaying a title field, false otherwise.
|
|
665
|
+
*
|
|
666
|
+
* @return boolean
|
|
667
|
+
*/
|
|
668
|
+
titleDisplayed: function() {
|
|
669
|
+
return ( ActiveOptions.NewFile );
|
|
670
|
+
},
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* EditorHas.dragDropUpload
|
|
675
|
+
* True if the editor is supports drag and drop file uploads, false otherwise.
|
|
676
|
+
*
|
|
677
|
+
* @return boolean
|
|
678
|
+
*/
|
|
679
|
+
dragDropUpload: function() {
|
|
680
|
+
return $('#gollum-editor.uploads-allowed').length;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* FunctionBar
|
|
688
|
+
*
|
|
689
|
+
* Things the function bar does.
|
|
690
|
+
*/
|
|
691
|
+
var FunctionBar = {
|
|
692
|
+
|
|
693
|
+
isActive: false,
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* FunctionBar.activate
|
|
697
|
+
* Activates the function bar, attaching all click events
|
|
698
|
+
* and displaying the bar.
|
|
699
|
+
*
|
|
700
|
+
*/
|
|
701
|
+
activate: function() {
|
|
702
|
+
debug('Activating function bar');
|
|
703
|
+
|
|
704
|
+
// check these out
|
|
705
|
+
$('#gollum-editor-function-bar button.function-button').each(function() {
|
|
706
|
+
if ( LanguageDefinition.getDefinitionFor( $(this).attr('id') ) ) {
|
|
707
|
+
$(this).click( FunctionBar.evtFunctionButtonClick );
|
|
708
|
+
$(this).attr('disabled', false);
|
|
709
|
+
}
|
|
710
|
+
else if ( !['function-help', 'function-text-direction'].includes( $(this).attr('id') ) ) {
|
|
711
|
+
$(this).attr('disabled', true);
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
// show bar as active
|
|
716
|
+
$('#gollum-editor-function-bar').addClass( 'active' );
|
|
717
|
+
FunctionBar.isActive = true;
|
|
718
|
+
},
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
deactivate: function() {
|
|
722
|
+
// When we switch markup language, unbind all buttons *except* for the text direction (LTR/RTL) switching button
|
|
723
|
+
$('#gollum-editor-function-bar button.function-button').not('#function-text-direction').unbind('click');
|
|
724
|
+
$('#gollum-editor-function-bar').removeClass( 'active' );
|
|
725
|
+
FunctionBar.isActive = false;
|
|
726
|
+
},
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* FunctionBar.evtFunctionButtonClick
|
|
731
|
+
* Event handler for the function buttons. Traps the click and
|
|
732
|
+
* executes the proper language action.
|
|
733
|
+
*
|
|
734
|
+
* @param jQuery.Event jQuery event object.
|
|
735
|
+
*/
|
|
736
|
+
evtFunctionButtonClick: function(e) {
|
|
737
|
+
e.preventDefault();
|
|
738
|
+
var def = LanguageDefinition.getDefinitionFor( $(this).attr('id') );
|
|
739
|
+
if ( typeof def == 'object' ) {
|
|
740
|
+
FunctionBar.executeAction( def );
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* FunctionBar.executeAction
|
|
747
|
+
* Executes a language-specific defined action for a function button.
|
|
748
|
+
*
|
|
749
|
+
*/
|
|
750
|
+
executeAction: function( definitionObject ) {
|
|
751
|
+
// get the selected text from the textarea
|
|
752
|
+
var editor = window.ace_editor;
|
|
753
|
+
var txt = editor.getValue();
|
|
754
|
+
var breakBefore = false;
|
|
755
|
+
var breakAfter = false;
|
|
756
|
+
var selRange = editor.getSelectionRange();
|
|
757
|
+
var selText = editor.getSelectedText();
|
|
758
|
+
var selTextLength = selText.length;
|
|
759
|
+
var wholeLine = false;
|
|
760
|
+
if (selText == '' ) {
|
|
761
|
+
if (definitionObject.whole_line && definitionObject.whole_line == true) {
|
|
762
|
+
wholeLine = true;
|
|
763
|
+
var line = selRange.start.row;
|
|
764
|
+
selText = editor.session.getLine(line);
|
|
765
|
+
var Range = ace.require('ace/range').Range;
|
|
766
|
+
selRange = new Range(line, 0, line, selText.length);
|
|
767
|
+
} else if (definitionObject.break_line && definitionObject.break_line == true) {
|
|
768
|
+
breakBefore = true;
|
|
769
|
+
breakAfter = true;
|
|
770
|
+
}
|
|
771
|
+
} else if (definitionObject.break_line && definitionObject.break_line == true) {
|
|
772
|
+
breakBefore = true;
|
|
773
|
+
breakAfter = true;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
var repText = selText;
|
|
777
|
+
|
|
778
|
+
// execute a replacement function if one exists
|
|
779
|
+
if ( definitionObject.exec &&
|
|
780
|
+
typeof definitionObject.exec == 'function' ) {
|
|
781
|
+
// FIXME: In case of Ace Editor, the function shall not operate on
|
|
782
|
+
// the text area, but on the editor. But since a lot functions
|
|
783
|
+
// does not use the third args, this works in these cases. But
|
|
784
|
+
// we shall fix it.
|
|
785
|
+
definitionObject.exec( txt, selText, $('#gollum-editor-body'), selRange );
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
// execute a search/replace if they exist
|
|
790
|
+
var searchExp = /([^\n]+)/gi;
|
|
791
|
+
if ( definitionObject.search &&
|
|
792
|
+
typeof definitionObject.search == 'object' ) {
|
|
793
|
+
debug('Replacing search Regex');
|
|
794
|
+
searchExp = null;
|
|
795
|
+
searchExp = new RegExp ( definitionObject.search );
|
|
796
|
+
debug( searchExp );
|
|
797
|
+
}
|
|
798
|
+
debug('repText is ' + '"' + repText + '"');
|
|
799
|
+
// replace text
|
|
800
|
+
if ( definitionObject.replace &&
|
|
801
|
+
typeof definitionObject.replace == 'string' ) {
|
|
802
|
+
debug('Running replacement - using ' + definitionObject.replace);
|
|
803
|
+
var rt = definitionObject.replace;
|
|
804
|
+
|
|
805
|
+
repText = escape( repText );
|
|
806
|
+
repText = repText.replace( searchExp, rt );
|
|
807
|
+
// remove backreferences
|
|
808
|
+
repText = repText.replace( /\$[\d]/g, '' );
|
|
809
|
+
repText = unescape( repText );
|
|
810
|
+
if ( repText === '' ) {
|
|
811
|
+
debug('Search string is empty');
|
|
812
|
+
repText = rt.replace( /\$[\d]/g, '' );
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
var cursorOffset = undefined;
|
|
816
|
+
if (wholeLine == false) {
|
|
817
|
+
// find position of $1 - this is where we will place the cursor
|
|
818
|
+
repPosition = rt.indexOf('$1');
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
// if the position of $1 doesn't exist, stick the cursor in
|
|
822
|
+
// the middle
|
|
823
|
+
if ( repPosition == -1 ) {
|
|
824
|
+
repPosition = Math.floor( rt.length / 2 );
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
var tempString = rt.substring(0, repPosition);
|
|
828
|
+
var verticalOffset = tempString.split('\n').length - 1;
|
|
829
|
+
var horizontalOffset = repPosition;
|
|
830
|
+
if ( verticalOffset > 0 ) {
|
|
831
|
+
horizontalOffset = horizontalOffset - tempString.lastIndexOf('\n')
|
|
832
|
+
}
|
|
833
|
+
horizontalOffset = horizontalOffset + selTextLength;
|
|
834
|
+
cursorOffset = [verticalOffset, horizontalOffset]
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
// append if necessary
|
|
839
|
+
if ( definitionObject.append &&
|
|
840
|
+
typeof definitionObject.append == 'string' ) {
|
|
841
|
+
repText += definitionObject.append;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
if ( repText ) {
|
|
845
|
+
$.GollumEditor.replaceSelection(repText, breakBefore, breakAfter, selRange, cursorOffset)
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
},
|
|
849
|
+
|
|
850
|
+
isShown: function() {
|
|
851
|
+
return ($('#gollum-editor-function-bar').is(':visible'));
|
|
852
|
+
},
|
|
853
|
+
|
|
854
|
+
refresh: function() {
|
|
855
|
+
if ( EditorHas.functionBar() ) {
|
|
856
|
+
debug('Refreshing function bar');
|
|
857
|
+
if ( LanguageDefinition.isValid() ) {
|
|
858
|
+
FunctionBar.deactivate();
|
|
859
|
+
FunctionBar.activate();
|
|
860
|
+
if ( Help ) {
|
|
861
|
+
Help.setActiveHelp( LanguageDefinition.getActiveLanguage() );
|
|
862
|
+
}
|
|
863
|
+
} else {
|
|
864
|
+
debug('Language definition is invalid.');
|
|
865
|
+
if ( FunctionBar.isShown() ) {
|
|
866
|
+
// deactivate the function bar; it's not gonna work now
|
|
867
|
+
FunctionBar.deactivate();
|
|
868
|
+
}
|
|
869
|
+
if ( Help.isShown() ) {
|
|
870
|
+
Help.hide();
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* FormatSelector
|
|
880
|
+
*
|
|
881
|
+
* Functions relating to the format selector (if it exists)
|
|
882
|
+
*/
|
|
883
|
+
var FormatSelector = {
|
|
884
|
+
|
|
885
|
+
$_SELECTOR: null,
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* FormatSelector.evtChangeFormat
|
|
889
|
+
* Event handler for when a format has been changed by the format
|
|
890
|
+
* selector. Will automatically load a new language definition
|
|
891
|
+
* via JS if necessary.
|
|
892
|
+
*
|
|
893
|
+
* @return void
|
|
894
|
+
*/
|
|
895
|
+
evtChangeFormat: function( evt, format ) {
|
|
896
|
+
var newMarkup = format;
|
|
897
|
+
FormatSelector.updateCommitMessage( newMarkup );
|
|
898
|
+
LanguageDefinition.setActiveLanguage( newMarkup );
|
|
899
|
+
},
|
|
900
|
+
|
|
901
|
+
updateCommitMessage: function( newMarkup ) {
|
|
902
|
+
var msg = document.getElementById( "gollum-editor-message-field" );
|
|
903
|
+
var val = msg.value;
|
|
904
|
+
// Must start with created or updated.
|
|
905
|
+
if (/^(?:created|updated)/i.test(val)) {
|
|
906
|
+
msg.value = val.replace( /\([^\)]*\)$/, "(" + newMarkup + ")" );
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* FormatSelector.init
|
|
912
|
+
* Initializes the format selector.
|
|
913
|
+
*
|
|
914
|
+
* @return void
|
|
915
|
+
*/
|
|
916
|
+
init: function( $sel ) {
|
|
917
|
+
debug('Initializing format selector');
|
|
918
|
+
|
|
919
|
+
// unbind events if init is being called twice for some reason
|
|
920
|
+
if ( FormatSelector.$_SELECTOR &&
|
|
921
|
+
typeof FormatSelector.$_SELECTOR == 'object' ) {
|
|
922
|
+
FormatSelector.$_SELECTOR.unbind( 'change' );
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
FormatSelector.$_SELECTOR = $sel;
|
|
926
|
+
|
|
927
|
+
// set format selector to the current language
|
|
928
|
+
FormatSelector.updateSelected();
|
|
929
|
+
FormatSelector.$_SELECTOR.change( FormatSelector.evtChangeFormat );
|
|
930
|
+
},
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* FormatSelector.update
|
|
935
|
+
*/
|
|
936
|
+
updateSelected: function() {
|
|
937
|
+
var currentLang = LanguageDefinition.getActiveLanguage();
|
|
938
|
+
FormatSelector.$_SELECTOR.val( currentLang );
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Help
|
|
947
|
+
*
|
|
948
|
+
* Functions that manage the display and loading of inline help files.
|
|
949
|
+
*/
|
|
950
|
+
var Help = {
|
|
951
|
+
|
|
952
|
+
_ACTIVE_HELP: '',
|
|
953
|
+
_LOADED_HELP_LANGS: [],
|
|
954
|
+
_HELP: {},
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Help.define
|
|
958
|
+
*
|
|
959
|
+
* Defines a new help context and enables the help function if it
|
|
960
|
+
* exists in the Gollum Function Bar.
|
|
961
|
+
*
|
|
962
|
+
* @param string name The name you're giving to this help context.
|
|
963
|
+
* Generally, this should match the language name.
|
|
964
|
+
* @param object definitionObject The definition object being loaded from a
|
|
965
|
+
* language / help definition file.
|
|
966
|
+
* @return void
|
|
967
|
+
*/
|
|
968
|
+
define: function( name, definitionObject ) {
|
|
969
|
+
if ( Help.isValidHelpFormat( definitionObject ) ) {
|
|
970
|
+
debug('help is a valid format');
|
|
971
|
+
|
|
972
|
+
Help._ACTIVE_HELP_LANG = name;
|
|
973
|
+
Help._LOADED_HELP_LANGS.push( name );
|
|
974
|
+
Help._HELP[name] = definitionObject;
|
|
975
|
+
|
|
976
|
+
if ( $("#function-help").length ) {
|
|
977
|
+
if ( $('#function-help').attr('disabled') ) {
|
|
978
|
+
$('#function-help').attr('disabled', false);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
$('#function-help').unbind('click');
|
|
982
|
+
$('#function-help').click( Help.evtHelpButtonClick );
|
|
983
|
+
|
|
984
|
+
// generate help menus
|
|
985
|
+
Help.generateHelpMenuFor( name );
|
|
986
|
+
|
|
987
|
+
if ( $('#gollum-editor-help').length &&
|
|
988
|
+
typeof $('#gollum-editor-help').attr('data-autodisplay') !== 'undefined' &&
|
|
989
|
+
$('#gollum-editor-help').attr('data-autodisplay') === 'true' ) {
|
|
990
|
+
Help.show();
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
} else {
|
|
994
|
+
if ( $('#function-help').length ) {
|
|
995
|
+
$('#function-help').attr('disabled', true);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
|
|
1000
|
+
/**
|
|
1001
|
+
* Help.generateHelpMenuFor
|
|
1002
|
+
* Generates the markup for the main help menu given a context name.
|
|
1003
|
+
*
|
|
1004
|
+
* @param string name The context name.
|
|
1005
|
+
* @return void
|
|
1006
|
+
*/
|
|
1007
|
+
generateHelpMenuFor: function( name ) {
|
|
1008
|
+
if ( !Help._HELP[name] ) {
|
|
1009
|
+
debug('Help is not defined for ' + name.toString());
|
|
1010
|
+
return false;
|
|
1011
|
+
}
|
|
1012
|
+
var helpData = Help._HELP[name];
|
|
1013
|
+
|
|
1014
|
+
// clear out help elements
|
|
1015
|
+
$('#gollum-editor-help-parent').html('');
|
|
1016
|
+
$('#gollum-editor-help-list').html('');
|
|
1017
|
+
$('#gollum-editor-help-content').html('');
|
|
1018
|
+
|
|
1019
|
+
// go go inefficient algorithm
|
|
1020
|
+
for ( var i=0; i < helpData.length; i++ ) {
|
|
1021
|
+
if ( typeof helpData[i] != 'object' ) {
|
|
1022
|
+
break;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
var $newLi = $('<li><a href="#" rel="' + i + '">' +
|
|
1026
|
+
helpData[i].menuName + '</a></li>');
|
|
1027
|
+
$('#gollum-editor-help-parent').append( $newLi );
|
|
1028
|
+
if ( i === 0 ) {
|
|
1029
|
+
// select on first run
|
|
1030
|
+
$newLi.children('a').addClass('selected');
|
|
1031
|
+
}
|
|
1032
|
+
$newLi.children('a').click( Help.evtParentMenuClick );
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// generate parent submenu on first run
|
|
1036
|
+
Help.generateSubMenu( helpData[0], 0 );
|
|
1037
|
+
$($('#gollum-editor-help-list li a').get(0)).click();
|
|
1038
|
+
|
|
1039
|
+
},
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Help.generateSubMenu
|
|
1043
|
+
* Generates the markup for the inline help sub-menu given the data
|
|
1044
|
+
* object for the submenu and the array index to start at.
|
|
1045
|
+
*
|
|
1046
|
+
* @param object subData The data for the sub-menu.
|
|
1047
|
+
* @param integer index The index clicked on (parent menu index).
|
|
1048
|
+
* @return void
|
|
1049
|
+
*/
|
|
1050
|
+
generateSubMenu: function( subData, index ) {
|
|
1051
|
+
$('#gollum-editor-help-list').html('');
|
|
1052
|
+
$('#gollum-editor-help-content').html('');
|
|
1053
|
+
for ( var i=0; i < subData.content.length; i++ ) {
|
|
1054
|
+
if ( typeof subData.content[i] != 'object' ) {
|
|
1055
|
+
break;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
var $subLi = $('<li><a href="#" rel="' + index + ':' + i + '">' +
|
|
1059
|
+
subData.content[i].menuName + '</a></li>');
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
$('#gollum-editor-help-list').append( $subLi );
|
|
1063
|
+
$subLi.children('a').click( Help.evtSubMenuClick );
|
|
1064
|
+
}
|
|
1065
|
+
},
|
|
1066
|
+
|
|
1067
|
+
hide: function() {
|
|
1068
|
+
$('#gollum-editor-help').animate({
|
|
1069
|
+
opacity: 0
|
|
1070
|
+
}, 200, function() {
|
|
1071
|
+
$('#gollum-editor-help')
|
|
1072
|
+
.animate({ height: 'hide' }, 200);
|
|
1073
|
+
});
|
|
1074
|
+
},
|
|
1075
|
+
|
|
1076
|
+
show: function() {
|
|
1077
|
+
$('#gollum-editor-help').animate({
|
|
1078
|
+
height: 'show'
|
|
1079
|
+
}, 200, function() {
|
|
1080
|
+
$('#gollum-editor-help')
|
|
1081
|
+
.animate({ opacity: 1 }, 300);
|
|
1082
|
+
});
|
|
1083
|
+
},
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Help.showHelpFor
|
|
1087
|
+
* Displays the actual help content given the two menu indexes, which are
|
|
1088
|
+
* rendered in the rel="" attributes of the help menus
|
|
1089
|
+
*
|
|
1090
|
+
* @param integer index1 parent index
|
|
1091
|
+
* @param integer index2 submenu index
|
|
1092
|
+
* @return void
|
|
1093
|
+
*/
|
|
1094
|
+
showHelpFor: function( index1, index2 ) {
|
|
1095
|
+
var html =
|
|
1096
|
+
Help._HELP[Help._ACTIVE_HELP_LANG][index1].content[index2].data;
|
|
1097
|
+
$('#gollum-editor-help-content').html(html);
|
|
1098
|
+
},
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Help.isLoadedFor
|
|
1102
|
+
* Returns true if help is loaded for a specific markup language,
|
|
1103
|
+
* false otherwise.
|
|
1104
|
+
*
|
|
1105
|
+
* @param string name The name of the markup language.
|
|
1106
|
+
* @return boolean
|
|
1107
|
+
*/
|
|
1108
|
+
isLoadedFor: function( name ) {
|
|
1109
|
+
for ( var i=0; i < Help._LOADED_HELP_LANGS.length; i++ ) {
|
|
1110
|
+
if ( name == Help._LOADED_HELP_LANGS[i] ) {
|
|
1111
|
+
return true;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
return false;
|
|
1115
|
+
},
|
|
1116
|
+
|
|
1117
|
+
isShown: function() {
|
|
1118
|
+
return ($('#gollum-editor-help').is(':visible'));
|
|
1119
|
+
},
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* Help.isValidHelpFormat
|
|
1123
|
+
* Does a quick check to make sure that the help definition isn't in a
|
|
1124
|
+
* completely messed-up format.
|
|
1125
|
+
*
|
|
1126
|
+
* @param object (Array) helpArr The help definition array.
|
|
1127
|
+
* @return boolean
|
|
1128
|
+
*/
|
|
1129
|
+
isValidHelpFormat: function( helpArr ) {
|
|
1130
|
+
return ( typeof helpArr == 'object' &&
|
|
1131
|
+
helpArr.length &&
|
|
1132
|
+
typeof helpArr[0].menuName == 'string' &&
|
|
1133
|
+
typeof helpArr[0].content == 'object' &&
|
|
1134
|
+
helpArr[0].content.length );
|
|
1135
|
+
},
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Help.setActiveHelp
|
|
1139
|
+
* Sets the active help definition to the one defined in the argument,
|
|
1140
|
+
* re-rendering the help menu to match the new definition.
|
|
1141
|
+
*
|
|
1142
|
+
* @param string name The name of the help definition.
|
|
1143
|
+
* @return void
|
|
1144
|
+
*/
|
|
1145
|
+
setActiveHelp: function( name ) {
|
|
1146
|
+
if ( !Help.isLoadedFor( name ) ) {
|
|
1147
|
+
if ( $('#function-help').length ) {
|
|
1148
|
+
$('#function-help').attr('disabled', true);
|
|
1149
|
+
}
|
|
1150
|
+
if ( Help.isShown() ) {
|
|
1151
|
+
Help.hide();
|
|
1152
|
+
}
|
|
1153
|
+
} else {
|
|
1154
|
+
Help._ACTIVE_HELP_LANG = name;
|
|
1155
|
+
if ( $("#function-help").length ) {
|
|
1156
|
+
if ( $('#function-help').attr('disabled') ) {
|
|
1157
|
+
$('#function-help').attr('disabled', false);
|
|
1158
|
+
}
|
|
1159
|
+
$('#function-help').unbind('click');
|
|
1160
|
+
$('#function-help').click( Help.evtHelpButtonClick );
|
|
1161
|
+
Help.generateHelpMenuFor( name );
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
},
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* Help.evtHelpButtonClick
|
|
1168
|
+
* Event handler for clicking the help button in the function bar.
|
|
1169
|
+
*
|
|
1170
|
+
* @param jQuery.Event e The jQuery event object.
|
|
1171
|
+
* @return void
|
|
1172
|
+
*/
|
|
1173
|
+
evtHelpButtonClick: function( e ) {
|
|
1174
|
+
e.preventDefault();
|
|
1175
|
+
if ( Help.isShown() ) {
|
|
1176
|
+
// turn off autodisplay if it's on
|
|
1177
|
+
if ( $('#gollum-editor-help').length &&
|
|
1178
|
+
$('#gollum-editor-help').attr('data-autodisplay') !== 'undefined' &&
|
|
1179
|
+
$('#gollum-editor-help').attr('data-autodisplay') === 'true' ) {
|
|
1180
|
+
$.post('/wiki/help?_method=delete');
|
|
1181
|
+
$('#gollum-editor-help').attr('data-autodisplay', '');
|
|
1182
|
+
}
|
|
1183
|
+
Help.hide(); }
|
|
1184
|
+
else { Help.show(); }
|
|
1185
|
+
},
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* Help.evtParentMenuClick
|
|
1189
|
+
* Event handler for clicking on an item in the parent menu. Automatically
|
|
1190
|
+
* renders the submenu for the parent menu as well as the first result for
|
|
1191
|
+
* the actual plain text.
|
|
1192
|
+
*
|
|
1193
|
+
* @param jQuery.Event e The jQuery event object.
|
|
1194
|
+
* @return void
|
|
1195
|
+
*/
|
|
1196
|
+
evtParentMenuClick: function( e ) {
|
|
1197
|
+
e.preventDefault();
|
|
1198
|
+
// short circuit if we've selected this already
|
|
1199
|
+
if ( $(this).hasClass('selected') ) { return; }
|
|
1200
|
+
|
|
1201
|
+
// populate from help data for this
|
|
1202
|
+
var helpIndex = $(this).attr('rel');
|
|
1203
|
+
var subData = Help._HELP[Help._ACTIVE_HELP_LANG][helpIndex];
|
|
1204
|
+
|
|
1205
|
+
$('#gollum-editor-help-parent li a').removeClass('selected');
|
|
1206
|
+
$(this).addClass('selected');
|
|
1207
|
+
Help.generateSubMenu( subData, helpIndex );
|
|
1208
|
+
$($('#gollum-editor-help-list li a').get(0)).click();
|
|
1209
|
+
},
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* Help.evtSubMenuClick
|
|
1213
|
+
* Event handler for clicking an item in a help submenu. Renders the
|
|
1214
|
+
* appropriate text for the submenu link.
|
|
1215
|
+
*
|
|
1216
|
+
* @param jQuery.Event e The jQuery event object.
|
|
1217
|
+
* @return void
|
|
1218
|
+
*/
|
|
1219
|
+
evtSubMenuClick: function( e ) {
|
|
1220
|
+
e.preventDefault();
|
|
1221
|
+
if ( $(this).hasClass('selected') ) { return; }
|
|
1222
|
+
|
|
1223
|
+
// split index rel data
|
|
1224
|
+
var rawIndex = $(this).attr('rel').split(':');
|
|
1225
|
+
$('#gollum-editor-help-list li a').removeClass('selected');
|
|
1226
|
+
$(this).addClass('selected');
|
|
1227
|
+
Help.showHelpFor( rawIndex[0], rawIndex[1] );
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
// Publicly-accessible function to Help.define
|
|
1232
|
+
$.GollumEditor.defineHelp = Help.define;
|
|
1233
|
+
|
|
1234
|
+
// Dialog exists as its own thing now
|
|
1235
|
+
$.GollumEditor.Dialog = $.GollumDialog;
|
|
1236
|
+
$.GollumEditor.replaceSelection = function( repText, breakBefore, breakAfter, selRange, cursorOffset ) {
|
|
1237
|
+
var editor = window.ace_editor;
|
|
1238
|
+
var newlinesPrefixed = 0;
|
|
1239
|
+
if (selRange == undefined ) {
|
|
1240
|
+
var selRange = editor.selection.getRange();
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
if ( breakBefore == true ) {
|
|
1244
|
+
var previousLine = editor.session.doc.getLine(selRange.start.row-1);
|
|
1245
|
+
if (selRange.start.column > 0) {
|
|
1246
|
+
repText = "\n\n" + repText
|
|
1247
|
+
newlinesPrefixed = 2;
|
|
1248
|
+
}
|
|
1249
|
+
else if (previousLine != "") {
|
|
1250
|
+
repText = "\n" + repText
|
|
1251
|
+
newlinesPrefixed = 1;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
if ( breakAfter == true ) {
|
|
1256
|
+
var nextLine = editor.session.doc.getLine(selRange.end.row+1);
|
|
1257
|
+
if (selRange.end.column < editor.session.doc.getLine(selRange.end.row).length) {
|
|
1258
|
+
repText = repText + "\n\n"
|
|
1259
|
+
}
|
|
1260
|
+
else if (nextLine != "") {
|
|
1261
|
+
repText = repText + "\n"
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
editor.session.replace(selRange, repText);
|
|
1266
|
+
if (cursorOffset != undefined) {
|
|
1267
|
+
totalVerticalOffset = cursorOffset[0] + newlinesPrefixed + selRange.start.row;
|
|
1268
|
+
totalHorizontalOffset = cursorOffset[1] + selRange.start.column;
|
|
1269
|
+
editor.navigateTo(totalVerticalOffset, totalHorizontalOffset);
|
|
1270
|
+
}
|
|
1271
|
+
editor.focus();
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
// Placeholder exists as its own thing now
|
|
1275
|
+
$.GollumEditor.Placeholder = $.GollumPlaceholder;
|
|
1276
|
+
|
|
1277
|
+
})(jQuery);
|