Compare commits

...

858 Commits

Author SHA1 Message Date
bootstraponline 9c714e7687 Release 2.5.0 2013-07-21 07:22:46 -04:00
bootstraponline 6c3523d61c Merge pull request #725 from amenonsen/upload
Add a file Upload button
2013-07-21 04:19:58 -07:00
Abhijit Menon-Sen 183840b793 Add file upload functionality
Adds an :allow_uploads wiki option, an --allow-uploads flag to
bin/gollum, an "Upload" button with a file upload dialog, and a
handler to commit uploaded files into the repository.

:allow_uploads defaults to false, to prevent unauthenticated users
from uploading arbitrary files into the repository (albeit only in
the uploads directory).

This code is based on the patch from @l3iggs at
https://github.com/gollum/gollum/issues/694, but the handling on the
backend is completely rewritten to use the Committer infrastructure.
2013-07-21 16:28:15 +05:30
bootstraponline 4e2856aa64 Update gollum-lib to 1.0.4 2013-07-20 19:24:26 -04:00
Abhijit Menon-Sen 4627a39165 Merge pull request #727 from amenonsen/no-live-preview
Disable live preview by default, because it's broken (closes #718)
2013-07-18 05:39:48 -07:00
bootstraponline c87cbe83d2 Fix #709
Require Ruby >= 1.9
2013-07-18 08:17:17 -04:00
bootstraponline f05282badf Drop 1.8.7 support on Travis (It's broken)
Don't email me on fail
2013-07-18 08:16:01 -04:00
Abhijit Menon-Sen 957879346e Merge pull request #726 from amenonsen/fixes
Trivial fix: set label.for to the input's id
2013-07-17 18:53:37 -07:00
Abhijit Menon-Sen 87e64f67f3 A tiny patch to disable live preview (#718) 2013-07-17 14:24:36 +05:30
Abhijit Menon-Sen 43840d246d Trivial fix: set label.for to the input's id 2013-07-17 13:31:46 +05:30
bootstraponline 4aeb9af8a7 Release 2.4.15 2013-06-18 22:19:34 -04:00
dekimsey b37acb8bc6 Merge pull request #711 from cpence/master
Add support for file streaming
2013-06-18 19:15:57 -07:00
Charles Pence 433865e927 Require newer gollum-lib. 2013-06-18 22:10:02 -04:00
Charles Pence 5428161e0f Add support for on-disk file streaming. 2013-06-18 21:49:38 -04:00
Jamie Oliver db0b536b5b Release 2.4.14 2013-06-15 17:20:48 +01:00
Jamie Oliver a4e50908fb Upgrade gollum-lib 2013-06-15 17:12:46 +01:00
bootstraponline 96b89fe83d Add version badge 2013-05-31 22:05:23 -03:00
Jamie Oliver adb131f131 Upgrade gollum-lib 2013-05-31 10:04:01 +01:00
bootstraponline 757ab87e8a Fix shoulda version
Gem::InstallError: shoulda-matchers requires Ruby version >= 1.9.2

Gollum is stuck on 1.8 so use the old version of shoulda.
2013-05-27 16:16:17 -03:00
bootstraponline f1d1db1159 Update useragent and shoulda 2013-05-27 16:07:24 -03:00
bootstraponline 3942bf60a6 Merge pull request #698 from ddeyoung/improve-page-create
Leaving off the leading slash in a page name with a subdirectory will corrupt the repository
2013-05-27 10:47:31 -07:00
Dustin DeYoung e2c0dcc0da Ruby 1.8.7 compatible double slash gsub 2013-05-26 16:14:56 -04:00
Dustin DeYoung f63180d8d8 Correct 1.8.7 negative match assertion. 2013-05-26 11:16:43 -04:00
Dustin DeYoung 999bbf3d50 Regex is 1.8.7 compatible for subpage create tests 2013-05-26 11:10:50 -04:00
Dustin DeYoung eab612bdd0 Remove temporary change in app test. 2013-05-26 11:03:40 -04:00
Dustin DeYoung 1147186b4c Page create with a relative path forces an absolute path. 2013-05-26 10:03:23 -04:00
Sunny Ripert a88314e061 Merge pull request #697 from bitmorse/master
Typo in page.mustache
2013-05-17 10:48:56 -07:00
Sam Sulaimanov 9221f5528d Fix form tag typo in page template. 2013-05-17 18:23:50 +02:00
bootstraponline 520f60cd65 Merge pull request #693 from alecperkins/patch-1
Add bottom margin to hr elements
2013-05-08 15:00:55 -07:00
Alec Perkins 84c85774e8 Add bottom margin to hr elements
This gives some more consistent spacing.
2013-05-08 18:09:39 -03:00
bootstraponline 1f118deed9 Merge pull request #687 from DirtYiCE/gravatar-fix
Fix gravatar url generation
2013-04-13 14:04:20 -07:00
Kővágó, Zoltán 55ce07ae73 Fix gravatar url generation 2013-04-13 22:18:04 +02:00
Sunny Ripert 85677d5e91 README trimming to point to the wiki
-> gollum/gollum#1
2013-04-08 20:32:11 +03:00
Jamie Oliver 04f9be15b8 Upgrade minitest-reporters. Fixes #684 2013-04-08 07:24:05 +01:00
Jamie Oliver 09cd72a829 Add license to gemspec. Fixes #681 2013-04-05 17:57:17 +01:00
Jamie Oliver f5f5ad70e3 Downgrade minitest-reporters. Temporary fix for #684 2013-04-05 16:03:20 +01:00
Jamie Oliver a0774b320a Update useragent 2013-04-05 15:00:41 +01:00
bootstraponline 4feea6051a Release 2.4.13 2013-04-03 19:28:29 -04:00
dekimsey f548ea757b Merge pull request #682 from dekimsey/missing-buttons
Fix missing new/rename buttons
2013-04-03 08:21:12 -07:00
Daniel Kimsey abc8ea5280 Fix missing new/rename buttons 2013-04-03 10:41:36 -04:00
bootstraponline bacd2313fb Release 2.4.12 2013-04-02 19:56:01 -04:00
bootstraponline 63295d3f9b Update gollum lib 2013-04-02 20:55:12 -03:00
Daniel Kimsey 9c25eb20cf Add a title attr to show full date on history log 2013-04-01 15:53:08 -04:00
bootstraponline 7f533f33ae Merge pull request #677 from uk-ar/fix-dependancy
Fix library dependancy issue when running with config.ru
2013-03-29 15:39:35 -07:00
uk-ar 352b4e1ed8 Fix NoMethodError when running with sample config.ru 2013-03-30 05:59:36 +09:00
Sunny Ripert 9a4252b579 Merge pull request #676 from crisman/master
Class duplication issues in frontend
2013-03-28 01:37:10 -07:00
Daniel Crisman ed7011c229 Deduplicate button action-* class names 2013-03-27 14:23:28 -04:00
Daniel Crisman 4ddd6a5207 Merge duplicate class attributes (class="jaws") 2013-03-26 13:47:21 -04:00
bootstraponline 0a74c7cfd2 Merge pull request #675 from uk-ar/fix-error-in-irb
Fix error when running with --irb option
2013-03-25 18:18:21 -07:00
uk-ar d84fdc7599 Fix error when running with --irb option
uninitialized constant Gollum::Wiki (NameError)
2013-03-26 04:49:29 +09:00
uk-ar dac1268266 Update the example of config.ru in the README 2013-03-26 04:25:53 +09:00
bootstraponline b42db1c7c1 Fix #668 2013-03-22 22:07:57 -03:00
bootstraponline 7a7a27c5c7 Merge pull request #672 from bootstraponline/master
Try removing dependencies
2013-03-22 18:06:25 -07:00
bootstraponline af83186b10 Try removing deps 2013-03-22 21:03:05 -04:00
bootstraponline a8646f8fe7 Update shoulda 2013-03-22 20:59:40 -03:00
bootstraponline 01c1e30284 Use latest sinatra 2013-03-22 20:49:40 -03:00
bootstraponline b3980f9e39 Merge pull request #669 from gollum/sinatra1.4
Upgrade to sinatra 1.4
2013-03-22 15:26:27 -07:00
Sunny Ripert c9fd50d23e Upgrade to sinatra 1.4 2013-03-22 13:45:08 +01:00
Sunny Ripert ea3544f46d Syntax highlighting in README 2013-03-22 13:18:30 +01:00
Sunny Ripert 4e04f5f540 README mention of gollum-lib and whitespace fixes 2013-03-22 12:27:20 +01:00
bootstraponline b1021cf233 Update MathJax docs 2013-03-21 23:23:42 -03:00
bootstraponline 8fa3529123 Merge pull request #667 from cpence/master
Tweak TeX math delimiters
2013-03-21 19:13:34 -07:00
Charles Pence 3b494c235a Tweak TeX math delimiters. 2013-03-21 22:09:01 -04:00
bootstraponline 1641c3e3e8 Update gemspec 2013-03-21 21:53:48 -04:00
bootstraponline ccd5d850ac Merge pull request #664 from jamieoliver/feature/gollum-lib
Move gollum back end to gollum-lib #647
2013-03-20 16:54:57 -07:00
Jamie Oliver b989f160cf Merge branch 'master' into feature/gollum-lib
Conflicts:
	lib/gollum/markup.rb
	test/test_gitcode.rb
2013-03-20 07:46:11 +00:00
bootstraponline 54e144564c Merge pull request #660 from simonista/fix-github-links
Fix for embedding code from github
2013-03-19 17:25:36 -07:00
bootstraponline ab8599da6d Update README.md 2013-03-19 21:11:41 -03:00
bootstraponline 0885702873 Update README.md 2013-03-19 21:10:22 -03:00
bootstraponline 0083bc9302 Merge pull request #661 from simonista/custom-js
Add option for custom js (like custom css)
2013-03-19 17:06:38 -07:00
Jamie Oliver cbc0821928 Merge branch 'master' into feature/gollum-lib
Conflicts:
	lib/gollum/markup.rb
2013-03-19 23:54:27 +00:00
bootstraponline 7a70169d06 Fix style 2013-03-19 19:35:54 -03:00
bootstraponline bf2377ac11 Merge pull request #662 from lemonsqueeze/clearfloats
[[_]] float clearing tag experiment
2013-03-19 15:35:18 -07:00
Jamie Oliver 1f79126b27 Move gollum back end to gollum-lib #647 2013-03-19 22:11:09 +00:00
lemonsqueeze 624e324383 [[_]] float clearing tag experiment 2013-03-19 18:15:01 +01:00
Simon Williams 846ebb285e Add option for custom js (like custom css)
* Add a new 'js' flag to indicate you want to embed a file named 'custom.js'
  which should exist at the root of the wiki
2013-03-17 18:42:01 -06:00
Simon Williams e567759935 Fix for embedding code from github 2013-03-17 18:27:40 -06:00
bootstraponline fe706c184e Merge pull request #659 from cpence/master
Fix symlink base path, don't allow in bare repos
2013-03-16 20:39:00 -07:00
Charles Pence 90bbb8e348 Fix symlink base path, don't allow symlinks in bare repos. 2013-03-16 22:00:19 -04:00
bootstraponline e21ec540c2 Merge pull request #658 from cpence/master
Basic support for symbolic links
2013-03-16 18:08:40 -07:00
Charles Pence 2a4517ced4 Add basic support for symbolic links. 2013-03-16 21:07:05 -04:00
bootstraponline 8c8d151b3e Update README.md 2013-03-16 20:39:31 -03:00
bootstraponline 44a3cf1934 Merge pull request #652 from simonista/update-references
Update references to new project location
2013-03-15 15:04:33 -07:00
Jamie Oliver 5dcd3c8c8f Merge pull request #651 from simonista/fix-specs
Fix tests that depended on old github location
2013-03-15 01:52:46 -07:00
Simon Williams 251bd7cd3d Update references to new project location
* Change 'github/gollum' references to 'gollum/gollum'
2013-03-14 23:22:51 -06:00
Simon Williams 02dfb0a8c1 Fix tests that depended on old github location
* Two tests depended on the following file existing:
  github/gollum/master/test/file_view/1_file.txt
2013-03-14 23:14:39 -06:00
bootstraponline 544d499ab1 Merge pull request #646 from bootstraponline/master
Fix #645
2013-03-04 19:39:07 -08:00
bootstraponline 8ebc2f7079 Fix #645 2013-03-04 19:32:55 -05:00
bootstraponline a31ba16070 Merge pull request #644 from dekimsey/empty-commit-612
Fix empty commits and non-descript revert messages (For #612)
2013-03-04 15:31:46 -08:00
Daniel Kimsey 60e3baad8a Fix empty commits and non-descript revert messages
* Empty commits via editor now have the message: "[no message]"
  * Reverts now have the slightly more useful message: "Revert commit #1234567"
2013-03-04 12:37:16 -05:00
bootstraponline f720a84831 Merge pull request #643 from mattr-/master
Update the GFM link in the README
2013-02-28 05:05:33 -08:00
Matt Rogers b74b2c4399 Update the GFM link in the README
github.github.com/github-flavored-markdown shows a different version of
the page for a split second, and then redirects to
https://help.github.com/articles/github-flavored-markdown so let's just
point there directly.
2013-02-27 22:39:06 -06:00
bootstraponline 252aa10d75 Update gemspec 2013-02-26 19:25:58 -05:00
bootstraponline 6f3d362920 Update Gemfile 2013-02-26 19:25:11 -05:00
bootstraponline 9b54e4c79f Update gollum.gemspec 2013-02-26 19:24:43 -05:00
bootstraponline f908d0d170 Document how to run the tests 2013-02-26 19:22:44 -05:00
bootstraponline 852ecdd1a9 Update pygments.rb. Fixes #639 2013-02-26 18:57:34 -05:00
bootstraponline 78f5df5e56 Update org-ruby. Fixes #640 2013-02-26 18:25:00 -05:00
bootstraponline 580a61a515 Merge pull request #641 from jamieoliver/bug/new-page-subdirectory
Update working directory when creating new page in subdirectory
2013-02-26 15:16:47 -08:00
Jamie Oliver 4faf5a0150 Update working directory when creating new page in subdirectory 2013-02-26 22:43:27 +00:00
bootstraponline 1201d2434a Merge pull request #637 from jamesdabbs/custom-markup
Allow registering custom markup engines
2013-02-25 19:59:18 -08:00
bootstraponline e1ca392da6 Fix tests
0.4.1 and 0.4.2 break gollum's tests
2013-02-25 22:54:32 -05:00
bootstraponline 3ee6d22727 Fix tests
org-ruby 0.8.0+ break the tests
2013-02-25 22:48:46 -05:00
bootstraponline 28a0329f65 Notify me on build failure 2013-02-25 21:50:49 -05:00
bootstraponline 2dc696c940 Update pygments 2013-02-25 21:47:32 -05:00
James Dabbs e3acef0e91 Add test for custom markup engine
This required adding a file to the example repo, so some of the tests'
expected hash values changed accordingly.
2013-02-25 21:06:00 -05:00
James Dabbs 62601f1adc Add system for registering new page extensions / markup formats 2013-02-25 21:05:35 -05:00
bootstraponline 982915a22f Fix #636
https://github.com/github/gollum/issues/636
2013-02-23 15:04:29 -05:00
bootstraponline 9f1bbd097f Merge pull request #634 from jamieoliver/bug/new-rename-dialogs-redirect
Fix Create New Page and Rename Page dialogs redirect behaviour
2013-02-19 16:03:59 -08:00
bootstraponline 694bd6e74a Update gollum.gemspec 2013-02-19 17:43:56 -05:00
Jamie Oliver 394cf0bc8e Fix Create New Page and Rename Page dialogs redirect behaviour 2013-02-19 21:29:21 +00:00
bootstraponline 09257deaae Merge pull request #632 from arr2036/master
Specify the sidebar side
2013-02-11 15:19:04 -08:00
Arran Cudbard-Bell 21c4b0dd95 Allow the sidebar side to be specified 2013-02-11 17:57:45 -05:00
bootstraponline 3b4662b583 Merge pull request #631 from arr2036/master
Fix redirects to index_pages for subdirs
2013-02-06 22:11:11 -08:00
Arran Cudbard-Bell 2e2e6457c7 Add option to specify index_page
Fix redirect to index_page creation for subdirs

Redirect attempts to access directories to index_page

Add tests
2013-02-06 22:05:36 -05:00
bootstraponline 631a7cccd6 Merge pull request #628 from arr2036/fix_titles
Fix page titles for non markdown formats
2013-02-04 15:47:17 -08:00
Arran Cudbard-Bell 2a3d51c7dc Fix page titles for non markdown formats 2013-02-04 16:12:41 -05:00
bootstraponline e7e8a17b61 Merge pull request #598 from dekimsey/new-page-in-current-directory
New page button now respects current directory
2013-01-30 14:57:07 -08:00
Daniel Kimsey 8fd8a56893 New and Rename buttons now support directories
* Also fixes renaming a file from a subdirectory moves it to the root.
  * Add context info option to dialog, used in the new dialog
  * Added CSS to support new context option for dialogs
  * Fix /pages view messing up directory creation in new
  * Removed the Edit and Rename buttons from historic view
2013-01-30 11:03:00 -05:00
bootstraponline 443c453507 Apply font from #624
https://github.com/github/gollum/pull/624
2013-01-20 12:44:53 -05:00
bootstraponline 0495c89ba1 Update HISTORY.md 2013-01-10 18:46:24 -05:00
bootstraponline 78e4dfbece Fix metadata tests 2013-01-08 17:09:21 -05:00
bootstraponline 1c7a481ed9 Release 2.4.11 2013-01-08 16:59:47 -05:00
bootstraponline c3dedcbba5 Disable metadata 2013-01-08 16:58:21 -05:00
bootstraponline 1c767a0e9f Release 2.4.10 2012-12-20 19:43:48 -07:00
bootstraponline f3b0ba49e0 Fix #612 2012-12-20 19:41:28 -07:00
bootstraponline 31dfcbaa9e Release 2.4.9 2012-12-20 19:30:04 -07:00
bootstraponline 8e11c5f46d Fix create 2012-12-20 19:26:26 -07:00
bootstraponline 70793ff559 Release 2.4.8 2012-12-20 19:14:13 -07:00
bootstraponline 6621e71e6c Fix home #491 2012-12-20 19:12:02 -07:00
bootstraponline 2af164ee9e Release 2.4.7 2012-12-20 18:11:44 -07:00
bootstraponline 9227f0a195 Fix tests
File names do not have spaces.
2012-12-20 18:08:21 -07:00
bootstraponline f18330b494 Fix #611 2012-12-20 18:02:26 -07:00
bootstraponline bb32339ab4 Fix spaces in dir #611 2012-12-20 17:45:39 -07:00
bootstraponline ddf4378dfe More work on #491
@teohm pointed out that add_to_index in gollum/committer.rb already appends @wiki.page_file_dir
2012-12-18 20:07:24 -07:00
bootstraponline 2a607e209b Fix #491 2012-12-18 19:01:43 -07:00
bootstraponline a3d85ae8c3 Release 2.4.6 2012-12-18 18:30:17 -07:00
bootstraponline fef62b63cb ASCIIDOC tests don't run on Travis
Tests that use to be green now fail when rerun. The issue is with the travis configuration and asciidoc.

https://travis-ci.org/github/gollum/jobs/3603171
2012-12-18 18:25:41 -07:00
bootstraponline 93ec80f773 Fix #607 2012-12-18 17:41:57 -07:00
bootstraponline 8e3795c317 Update 2012-12-18 17:20:49 -07:00
bootstraponline cb1a633dc5 Fix #607 2012-12-14 19:16:19 -07:00
bootstraponline ace4db6938 Merge pull request #605 from dekimsey/pages-images-now-respect-baseurl
Fix /pages css to the correct path for images
2012-12-11 17:35:03 -08:00
Daniel Kimsey b770062788 Fix /pages css to the correct path for images 2012-12-11 13:00:55 -05:00
bootstraponline 4c4dc5398a Update 1.8 check 2012-12-10 18:41:01 -07:00
bootstraponline 091945152f Release 2.4.5 2012-12-10 18:05:38 -07:00
bootstraponline 4838611273 Fix #602 2012-12-07 17:16:25 -07:00
bootstraponline 144f9959c9 Update test #602 2012-12-07 17:02:50 -07:00
bootstraponline 291c6a8fa0 Add test for #602 2012-12-07 16:49:00 -07:00
bootstraponline d5d3581b78 Update gollum.gemspec 2012-12-06 18:17:41 -07:00
bootstraponline 64d90b027c Merge pull request #597 from shanebdavis/master
altered CSS to more closely match github's markdown css
2012-12-03 16:49:37 -08:00
Shane Brinkman-Davis a0e9989734 altered CSS to more closely match github's markdown css.
Main chaings:
Padding between LIs = 0px
Fixed page-width: 920px
H1, H2, H3: Margin-top: 20px; margin-bottom: 10px
2012-12-01 15:48:28 -08:00
bootstraponline b81aa923d6 Fix KCODE warning on 1.9 2012-11-30 23:35:01 -07:00
bootstraponline 610925bc5a Update Ace
https://github.com/ajaxorg/ace/commit/f887e6411222ed49683c477ca571460b99f8e59f
2012-11-30 23:34:55 -07:00
bootstraponline 86eda9bb10 Release 2.4.4 2012-11-30 17:28:53 -07:00
bootstraponline ca06aa9a6f Merge pull request #595 from jtietema/patch-1
Update lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
2012-11-30 16:11:47 -08:00
Jeroen Tietema ca57d9e83d Update lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
Adjusted the height of the preview window so that it doesn't flow 
offscreen. (It was impossible to read the last lines...)
2012-11-30 22:20:36 +01:00
bootstraponline 904f975f0c Fix comment 2012-11-30 00:02:24 -07:00
bootstraponline 9b9212cf4c Remove needless conversion
The fix for page.rb resolved UTF-8 in headers.
2012-11-30 00:00:28 -07:00
bootstraponline 404419d1c3 Release 2.4.3 2012-11-29 23:57:15 -07:00
bootstraponline 4ee94a6574 Fix UTF-8 header and add test 2012-11-29 23:47:25 -07:00
bootstraponline f929df0419 Update check_h1 2012-11-29 23:04:40 -07:00
bootstraponline 57587dafbe Fix UTF-8 in headers 2012-11-29 22:05:29 -07:00
bootstraponline 31a95e81b3 Fix test name 2012-11-29 21:36:04 -07:00
bootstraponline 70a4e9551b Improve h1 test 2012-11-29 21:27:45 -07:00
bootstraponline e1a705f975 Fix UTF-8
to_html uses source document encoding by default. Set UTF-8.

Add note about KCODE warning.
2012-11-29 20:05:41 -07:00
bootstraponline 9057ec82d8 Release 2.4.2 2012-11-29 19:49:15 -07:00
bootstraponline 1b53e36666 Fix UTF-8 2012-11-29 16:58:47 -07:00
bootstraponline 10fa5c7bd2 Upgrade to stringex 1.5 2012-11-29 16:50:52 -07:00
bootstraponline 06e72a5a60 Release 2.4.1 2012-11-19 17:22:28 -07:00
bootstraponline 8fa62fc300 @css is set in before 2012-11-19 17:16:53 -07:00
bootstraponline 6c345fc508 Update dependencies 2012-11-19 17:14:52 -07:00
bootstraponline a34eac4ecb Merge pull request #592 from dekimsey/global-custom-css
Fixed custom.css to apply to all views
2012-11-19 16:11:53 -08:00
bootstraponline 10c121e603 Merge pull request #585 from dekimsey/gitcode-embed-any-file
Modified gitcode to allow syntax highlighting of arbitrary files
2012-11-19 16:11:21 -08:00
Daniel Kimsey 2b910167f4 Fixed custom.css to apply to all views 2012-11-19 13:21:39 -05:00
Daniel Kimsey 7d5311a075 Modified gitcode to allow syntax highlighting of arbitrary files 2012-11-19 12:59:45 -05:00
bootstraponline f5581c4b49 Merge pull request #589 from shanebdavis/master
Fix #96
2012-11-18 19:25:05 -08:00
Shane Brinkman-Davis e09f7cd49c Proposed fix for https://github.com/github/gollum/issues/96
(statically hosted content in the images/ folder returns 404s)
(the problem was all content in javascript, css, and images folders was hard-coded to return 404s)
2012-11-18 09:53:27 -08:00
bootstraponline 4dab03b61b Merge pull request #588 from sunnyone/fix_host_option
Pass the value of --host parameter to Rack::Server
2012-11-17 13:04:38 -08:00
Yoichi Imai 2b5e017aa1 Pass the value of --host parameter to Rack::Server 2012-11-17 19:42:28 +09:00
bootstraponline 8b3d944fd2 Fix #586
Place ASCIIDOC test behind ENV var
2012-11-16 19:08:45 -07:00
bootstraponline 2d886fd38a Fix tests #587 2012-11-16 18:13:38 -07:00
bootstraponline 80088832b9 Fix #587
The default behavior prevented linking to header anchors. id_prefix
can still be set to 'wiki-' however it is no longer the default.
2012-11-16 17:45:56 -07:00
bootstraponline be1883f317 Use HTTPS rubygems
Update gemspec
2012-11-16 17:07:38 -07:00
bootstraponline 30119e0c77 Fix tests 2012-11-16 17:03:18 -07:00
bootstraponline c90c3b1544 Support git code syntax in live preview
Add autocrlf values for Windows, Linux, and OS X.
2012-11-16 16:57:39 -07:00
bootstraponline 578386f083 Add dir support to write_page 2012-11-16 16:43:43 -07:00
bootstraponline 3d21ed362e Add history view test 2012-11-14 21:03:24 -07:00
bootstraponline 9cf469b035 Fix ruby bits #574 2012-11-14 00:45:28 -07:00
bootstraponline 462c93ae43 Fix crash #574 2012-11-13 23:12:22 -07:00
bootstraponline bda3b7b24d Fix --user-icons 2012-11-13 22:56:30 -07:00
bootstraponline d861a22cdd Fix line endings 2012-11-13 22:55:57 -07:00
bootstraponline 0de1a182da Validate user_icons 2012-11-13 22:48:37 -07:00
bootstraponline b030554348 Fix default 2012-11-13 22:43:05 -07:00
bootstraponline 858bfa9ccd Merge pull request #574 from dekimsey/local-gravatar-identicons
Extendable user-icons with optional identicon js library.
2012-11-13 21:42:15 -08:00
Daniel Kimsey ee8ec78da7 Add --user-icons option: none, gravatar, and identicon. 2012-11-13 21:17:23 -05:00
bootstraponline c8f684895c Merge pull request #581 from dekimsey/log-opt-author
Changed history date to use authored date instead.
2012-11-13 16:54:14 -08:00
bootstraponline 138a155ba4 Merge pull request #582 from dekimsey/set-focus-buttons
On window popup, focus the first text-field, if any.
2012-11-13 16:53:34 -08:00
Daniel Kimsey ad749bf345 On window popup, focus the first text-field, if any. 2012-11-13 17:25:36 -05:00
Daniel Kimsey ff0d59c16b Changed history date to use authored date instead. 2012-11-13 15:02:55 -05:00
bootstraponline df75d2d60c Release 2.4.0 2012-11-11 15:08:45 -07:00
bootstraponline 2713aabeaf Update gemspec 2012-11-11 15:08:21 -07:00
bootstraponline 796d1b44c2 Update README.md 2012-11-11 14:46:58 -07:00
bootstraponline 470a7b8f52 Fix #579 2012-11-11 14:40:47 -07:00
bootstraponline f699b82a9f Fix #539 2012-11-11 14:18:14 -07:00
bootstraponline 44edb8c7da Merge pull request #576 from roman-zaharenkov/title_control
Page title control
2012-11-11 12:29:37 -08:00
bootstraponline bc4fc0edd9 Fix gitcode test 2012-11-11 13:14:25 -07:00
Roman Zaharenkov 6545fa691b Adjust page header / title generation.
Now page header can be generated by first h1 header from page content. But page title generated by URL is it was before.
2012-11-11 13:22:10 +03:00
Roman Zaharenkov 4954553927 Page title control
Allow to set page title by setting header inside page body. It will use header as title If header is present and page URL otherwise.
2012-11-11 13:20:14 +03:00
bootstraponline 9c50ba9eeb XSLT was never used 2012-11-10 17:02:27 -07:00
bootstraponline 9a67da145a Merge pull request #578 from github/fileview-hover-fix
Fileview hover fix
2012-11-10 15:59:28 -08:00
bootstraponline ca7d82278c Pretty print with nokogiri 2012-11-10 16:34:37 -07:00
bootstraponline f6245c53dd Add .gitattributes 2012-11-10 12:15:20 -07:00
bootstraponline 6888420cc6 Update file_view output 2012-11-10 12:15:19 -07:00
Daniel Kimsey c5631f5b7d Fixed a:hover not highlighting the a block correctly 2012-11-10 12:15:19 -07:00
Daniel Kimsey 34e0b49d72 Refactored the template generator to use new_page method 2012-11-10 12:15:19 -07:00
Daniel Kimsey bd072264ef Line-ending fix for _styles.css 2012-11-10 12:15:19 -07:00
bootstraponline cfb2d24c71 Merge pull request #577 from dekimsey/fix-page-metadata
Renamed page.meta_data => page.metadata
2012-11-09 18:03:12 -08:00
Daniel Kimsey fe0eb72fa3 Renamed page.meta_data to page.metadata for consistency with views 2012-11-09 18:29:49 -05:00
Daniel Kimsey 2783257f06 Added page.meta_data to tests 2012-11-09 18:25:33 -05:00
bootstraponline cc11cb866c Add css note
#572
2012-11-08 18:51:57 -07:00
bootstraponline 6a02643bda Merge pull request #573 from dekimsey/license-guidelines
Added bootstraponline's comment about licensing guidelines
2012-11-08 16:12:40 -08:00
Daniel Kimsey 7f269c8da3 Added bootstraponline's comment about licensing guidelines 2012-11-08 16:46:49 -05:00
bootstraponline ef7f7cebd1 Release 2.3.12 2012-11-07 20:37:50 -07:00
bootstraponline 05c24fd5e3 Fix #570
Fix #571
2012-11-07 20:35:57 -07:00
bootstraponline b08b97bd28 Release 2.3.11 2012-11-07 20:18:43 -07:00
bootstraponline dbb6ce2f71 Fix #570
Error in gollum.js broke new page button.
2012-11-07 20:17:50 -07:00
bootstraponline f66f14b593 Release 2.3.10 2012-11-07 19:47:09 -07:00
bootstraponline 8a52315dee Add base url to custom css 2012-11-07 19:46:27 -07:00
bootstraponline 7c4052906c Add custom css 2012-11-07 19:40:52 -07:00
bootstraponline 3a56f39f6a Fix readme 2012-11-07 19:17:49 -07:00
bootstraponline 6585ca5dd0 Fix space 2012-11-07 19:13:57 -07:00
bootstraponline 792abae07e Release 2.3.9 2012-11-07 19:11:04 -07:00
bootstraponline 74ce648c59 Options.fetch 2012-11-07 19:04:36 -07:00
bootstraponline 2686e96046 Release 2.3.8 2012-11-07 18:50:37 -07:00
bootstraponline 213e2bb432 Add config example 2012-11-07 18:48:07 -07:00
bootstraponline 79bb5c10ab Remove lib.so note 2012-11-07 18:46:36 -07:00
bootstraponline 7ea012d786 Fix code style 2012-11-07 18:45:20 -07:00
bootstraponline 43591f75de Merge pull request #570 from dekimsey/only-alert-on-changes
Only alert on changes
2012-11-07 17:39:30 -08:00
Daniel Kimsey 05d82c0569 Attach unsaved changes warning to trigger only after changes are made 2012-11-07 17:51:36 -05:00
Daniel Kimsey 76c8d3206c Consolidated create and edit page's javascript into the global gollum.js 2012-11-07 17:50:12 -05:00
bootstraponline 00751d05b4 Release 2.3.7 2012-11-06 18:27:05 -07:00
bootstraponline b5be5df11a Fix test name 2012-11-06 18:26:49 -07:00
bootstraponline 7d159273fc Merge pull request #569 from dekimsey/issue-568
Fixed #568, triple tilde without language causes Gollum to crash
2012-11-06 17:11:08 -08:00
Daniel Kimsey 70127922ab Added test for #568 2012-11-06 15:49:47 -05:00
Daniel Kimsey b95df93775 Fixes #568, triple-tilde without language causes crash 2012-11-06 15:39:39 -05:00
bootstraponline dc06edcf5b Add x.y.z 2012-11-05 17:30:01 -07:00
bootstraponline fdc437dcd5 Release 2.3.6 2012-11-05 17:28:51 -07:00
bootstraponline f6873c9612 Merge pull request #566 from dekimsey/deterministic-search
Gollum search results now displayed in a deterministic order
2012-11-05 16:17:40 -08:00
Daniel Kimsey 93754ab32d Sort by filename in addition to count 2012-11-05 18:01:50 -05:00
Daniel Kimsey 5759334635 Gollum search results are displayed in a deterministic order 2012-11-05 17:02:19 -05:00
bootstraponline f2f543b72d Release 2.3.5 2012-10-31 20:14:15 -06:00
bootstraponline 598b052be3 Fix clean
Duplicate slashes must be removed everywhere.
2012-10-31 20:11:23 -06:00
bootstraponline a746062422 Merge pull request #564 from nikitug/patch-1
Update README to new Sequence diagram markup style
2012-10-31 19:09:45 -07:00
Nikita Afanasenko c8868d369f Update README to new Sequence diagram markup style 2012-10-31 18:02:28 +04:00
bootstraponline 52c6e7474c Release 2.3.4 2012-10-28 20:59:06 -06:00
bootstraponline be81f09b0e Update gemspec 2012-10-28 12:43:51 -06:00
bootstraponline 6fa4504e31 Fix #551 2012-10-28 12:37:02 -06:00
bootstraponline 992ba01a12 Fix page file dir 2012-10-28 11:57:25 -06:00
bootstraponline 72c5a74cf1 Update test
The test passes when verified manually using bin/gollum. Without a running server the test
will fail so it has been commented out. If there's an easy way to mock Rack::Server
then the test can be restored.
2012-10-27 23:44:11 -06:00
bootstraponline 919f41a0f1 Fix #559 2012-10-27 23:44:11 -06:00
bootstraponline 785921cb0f Fix toc generation 2012-10-27 21:46:30 -06:00
bootstraponline 8c8cda5e7d Fix comment 2012-10-27 21:05:56 -06:00
bootstraponline 64ef74e7e9 Add preview button to live preview 2012-10-27 20:52:54 -06:00
bootstraponline 776df4e6ee Fix nokogiri rendering
https://github.com/sparklemotion/nokogiri/issues/782
2012-10-27 19:52:26 -06:00
bootstraponline 68465a8651 Set indent and encoding 2012-10-27 18:12:32 -06:00
bootstraponline fa16c8960c Fix #560 2012-10-27 17:58:14 -06:00
bootstraponline 2c57915781 Refactor fileview 2012-10-23 23:27:31 -06:00
bootstraponline d0527f1aeb Release 2.3.3 2012-10-23 22:58:41 -06:00
bootstraponline 75083c5b56 Fix collapse tree 2012-10-23 22:36:17 -06:00
bootstraponline 82526594db Add attr reader for collapse tree 2012-10-23 22:22:56 -06:00
bootstraponline 941d39800c Merge pull request #556 from adiknoth/fileview
Documentation and usability enhancement of recent fileview fix
2012-10-23 21:20:28 -07:00
bootstraponline a1ae2e8bc0 Fix #554 2012-10-23 22:14:45 -06:00
bootstraponline 4af6f366ca Fix show_all /pages 2012-10-23 22:09:27 -06:00
Adrian Knoth c7a9534ed9 Add --collapse-tree command line option 2012-10-23 14:27:15 +02:00
Adrian Knoth 00bcbbf72b File View: Add option to collapse file trees.
For potentially large repositories, starting with a collapsed tree may
be beneficial.
2012-10-23 14:27:12 +02:00
Adrian Knoth ed2254ff9f Add missing documentation for --show-all 2012-10-23 14:22:54 +02:00
bootstraponline b6633f0ecb Release 2.3.2 2012-10-22 19:21:10 -06:00
bootstraponline e08d2d3052 Enable show_all for /pages 2012-10-22 19:10:40 -06:00
bootstraponline fbc0548b43 Add --show-all
--show-all will show all files in file view (not just valid pages). Default is false.
2012-10-22 19:03:21 -06:00
bootstraponline a9807bd1e1 Update math note 2012-10-21 17:22:31 -06:00
bootstraponline 554b80b39d Add MathJax examples 2012-10-21 17:21:24 -06:00
bootstraponline 99e74bf00b Release 2.3.1 2012-10-21 17:16:40 -06:00
bootstraponline f48e923f28 Fix release 2012-10-21 17:15:09 -06:00
bootstraponline 5400b4bfdd Support inline and display math.
$$2^2$$

$2^2$

\\(2^2\\)

[2^2]
2012-10-21 17:15:09 -06:00
bootstraponline f68bebe0f6 Update math note 2012-10-21 16:26:35 -06:00
bootstraponline 4c6019b439 Update math note 2012-10-21 16:23:58 -06:00
bootstraponline 66e08a6b17 Release 2.3.0 2012-10-21 16:19:05 -06:00
bootstraponline 7898db70ed Auto load all MathJax extensions
Fix #549
2012-10-21 16:14:04 -06:00
bootstraponline 7c357116ff Remove TeX
As discussed with @vmg
MathJax is available via a flag for those self hosting gollum
2012-10-18 23:36:05 -06:00
bootstraponline 69ce0eb0d0 Update rake 2012-10-17 21:04:20 -06:00
bootstraponline 4db31a297b Update rake
Jekyll uses rake ~> 0.9
2012-10-17 21:03:29 -06:00
bootstraponline e1fca457e4 Restore gemnasium
Gemnasium fixed the missing pygments.rb issue.

https://github.com/laserlemon/gemnasium-parser/commit/c9b3e43c3021967d5c1bb115e7dd1555e01c6444
2012-10-17 20:54:01 -06:00
bootstraponline 7f8485ce80 Improve system requirements language 2012-10-16 22:31:25 -06:00
bootstraponline 290061fd11 Add system requirements to readme 2012-10-16 22:15:26 -06:00
bootstraponline a507836936 Update dependencies 2012-10-16 21:39:22 -06:00
bootstraponline 6524d20a96 Use pygments.rb 0.3.2 2012-10-16 21:36:37 -06:00
bootstraponline f1c523aa30 Release 2.2.9 2012-10-14 22:26:17 -06:00
bootstraponline 87c08f5613 Escape " in headers 2012-10-14 22:21:00 -06:00
bootstraponline 82913cea20 Improve base path note 2012-10-14 21:42:25 -06:00
bootstraponline 2ad743e4bd Release 2.2.8 2012-10-14 21:28:43 -06:00
bootstraponline fa97b57a96 Define default map as suggested on #460
Base path now sets a default map without having to use an external config.ru.
2012-10-14 20:57:27 -06:00
bootstraponline 1b952b6d56 Release 2.2.7 2012-10-14 17:24:33 -06:00
bootstraponline 90cc512bd1 Fix home loop with page-file-dir #491 2012-10-14 15:45:26 -06:00
bootstraponline b82556c9c0 Fix #460 2012-10-14 15:42:06 -06:00
bootstraponline fbe3b4bb3b Fix #460 2012-10-14 15:23:52 -06:00
bootstraponline 5ffd98ad31 Fix #491 2012-10-14 15:15:55 -06:00
bootstraponline cb9dd4d228 Fix formatting 2012-10-14 14:31:40 -06:00
bootstraponline cd823bf10c Add doc from wiki.rb 2012-10-14 14:31:00 -06:00
bootstraponline 5560ec52c2 Add base_path doc 2012-10-14 14:27:08 -06:00
bootstraponline 065151a77f Add base_path disclaimer 2012-10-14 14:25:27 -06:00
bootstraponline 23454f556c Release 2.2.6 2012-10-14 13:14:08 -06:00
bootstraponline a2b3ddf931 Update tests to XHTML 2012-10-14 13:07:18 -06:00
bootstraponline 44b0d2fcfc Remove old comment 2012-10-14 12:26:23 -06:00
bootstraponline aed4cc590a Fix unicode characters
Fix #547

Update test
2012-10-14 12:21:31 -06:00
bootstraponline 72ee08b5ab Release 2.2.5 2012-10-14 11:21:56 -06:00
bootstraponline 45547624e4 Improve tilde fence support
More than 3 tildes can be used. The code block must end with the same amount of tildes used to open the code block.

Fix #537

http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
2012-10-14 11:02:45 -06:00
bootstraponline f928cfa8be Don't ship Lorem ipsum in gem 2012-10-13 20:21:08 -06:00
bootstraponline 988984846a Release 2.2.4 2012-10-13 20:01:57 -06:00
bootstraponline 1149618653 Fix #537 2012-10-13 19:53:41 -06:00
bootstraponline 168a033903 Remove old comment 2012-10-13 14:59:42 -06:00
bootstraponline 6a765c9791 Fix #537 2012-10-13 14:52:28 -06:00
bootstraponline e16ae7b511 Travis is having a bad day
E: There are problems and -y was used without --force-yes
before_install: 'sudo apt-get install -y asciidoc' returned false.
Done. Build script exited with: 1
2012-10-13 14:07:15 -06:00
bootstraponline 174334ea44 Remove comment 2012-10-13 13:58:56 -06:00
bootstraponline dbdf06930d Fix 2012-10-13 13:55:20 -06:00
bootstraponline c93e65ddc3 Merge branch 'master' of github.com:github/gollum 2012-10-13 13:32:19 -06:00
bootstraponline 56101ed264 Fix #535 and add test 2012-10-13 13:32:08 -06:00
bootstraponline 8269c8e574 TOC doesn't require ' 2012-10-13 13:11:31 -06:00
bootstraponline 2246419d1e Fix spacing 2012-10-13 13:09:20 -06:00
bootstraponline 118a0c318b Update comment 2012-10-13 13:06:15 -06:00
bootstraponline 5401cf2910 Fix #542 2012-10-13 13:04:51 -06:00
bootstraponline 432f9b8d2f Add test for #542 2012-10-13 12:57:58 -06:00
bootstraponline 66fc8a2d31 Revert "Fix #542"
This reverts commit 2f3dd3d227.
2012-10-13 12:55:43 -06:00
bootstraponline 2f3dd3d227 Fix #542
Page link may contain duplicate starting forward slashes.
//page points to http://page/ when what we want is
/page pointing to http://localhost:1234/page
2012-10-13 09:53:25 -06:00
bootstraponline c43fd9fa6c Update language comment 2012-10-12 21:19:24 -06:00
bootstraponline 868518e0f5 Bash is Ace mode sh 2012-10-12 20:58:05 -06:00
bootstraponline 039b5cce98 Try to fix Travis
FFI is no longer used in the new pygments.rb.
apt-get update may resolve the asciidoc install failure.
2012-10-12 20:24:31 -06:00
bootstraponline 4a421842d5 https://github.com/travis-ci/travis-ci/issues/725
Modified README to trigger a Travis CI build. It's currently broken.
2012-10-12 20:22:10 -06:00
bootstraponline cfbb124f81 Update README.md 2012-10-12 20:16:43 -06:00
bootstraponline dcb147cde2 Ensure declaredLanguage is lower case 2012-10-10 20:20:33 -06:00
bootstraponline 8d06b5e67e Fix pygments language to Ace mode translation 2012-10-10 20:16:04 -06:00
bootstraponline 4776d0b422 Use rake release in readme 2012-10-10 19:45:42 -06:00
bootstraponline 58bb340c33 Release 2.2.3 2012-10-10 19:43:30 -06:00
bootstraponline ee790a9b7c Add rake bump to readme 2012-10-10 19:38:53 -06:00
bootstraponline ac432aad78 Add bump task to Rakefile 2012-10-10 19:35:04 -06:00
bootstraponline 30207e0a39 Merge pull request #533 from wrs/wrs_syntaxfixes
Two little syntax highlighting fixes
2012-10-10 16:56:37 -07:00
Walter Smith d98547a33c Fix lack of CoffeeScript livepreview
Pygments calls it coffeescript, but Ace calls it coffee.
2012-10-10 14:20:50 -07:00
Walter Smith b7cdeabbf6 Catch all Pygments errors
An unrecognized language was generating a MentosError rather than a
PythonError. Just catch anything that goes wrong in Pygments.
2012-10-10 14:20:50 -07:00
bootstraponline be9907a0cc v2.2.2 2012-10-04 18:17:24 -06:00
bootstraponline 30f42c50a9 Fix #528 2012-10-04 17:18:47 -06:00
bootstraponline 7cba65b138 Gemnasium is not including all deps.
pygments.rb is missing for example. Will restore once Gemnasium has fixed the issue.
2012-10-01 23:50:35 -06:00
bootstraponline f34a78b336 Proc.new instead of lambda. 2012-10-01 23:45:04 -06:00
bootstraponline e1942dda03 Merge pull request #513 from bootstraponline/embed_code
Embed code. #508.
2012-10-01 22:36:25 -07:00
bootstraponline 7142e284fa .call instead of .() for 1.8.7 2012-10-01 23:29:15 -06:00
bootstraponline 3c1c588953 Restore wiki_factory. 2012-10-01 23:23:40 -06:00
bootstraponline 52cc6bae34 Update dependencies. 2012-09-29 13:50:11 -06:00
bootstraponline 955c608115 Update rake. 2012-09-29 13:40:02 -06:00
bootstraponline 2e00cf312c Merge pull request #524 from osener/patch-1
Update org-ruby
2012-09-29 12:17:59 -07:00
Ozan Sener 09bbc144d1 Update org-ruby
Fixes #81
2012-09-29 11:19:09 +03:00
bootstraponline d02b63a434 Fix test. 2012-09-26 00:08:11 -06:00
bootstraponline 9b63c67d8c Try to fix tests. 2012-09-25 23:57:35 -06:00
bootstraponline 05c4bf3374 Add local file support.
Example of absolute path to local file.
```html:/home```

Example of relative path to local file.
```html:home```

1.8.7 string fix. 's'[0..0] instead of 's'[0]

Fix regex.

Add absolute and relative tests.
2012-09-25 23:31:58 -06:00
bootstraponline 424b4d3f4e Remove debug statements. 2012-09-25 23:31:25 -06:00
bootstraponline f9a6187fab Fix undefined method `[]' for nil:NilClass 2012-09-25 23:31:08 -06:00
Henrik d406472882 1.8.7 fixes 2012-09-25 23:29:11 -06:00
Henrik 749b5a5ff8 Adding functionality for fetching code from github
hack for 1.8.7

Don't miss test_markup's relative require

need some food now
2012-09-25 23:29:08 -06:00
bootstraponline 091d5fe750 Update multibyte caracters. 2012-09-25 22:58:07 -06:00
bootstraponline c8894fb465 New pygments.rb works correctly.
The expected output from the tests differs only in newlines.

git diff makes it seem like everything changed. bzr qdiff has a better default diff. git doesn't do per char diffs.

Revert "New pygments has issues."

This reverts commit 2dd41cbfac.
2012-09-25 22:45:57 -06:00
bootstraponline 2dd41cbfac New pygments has issues.
Revert "Update pygments. Solves #225 #490 #517"

This reverts commit c0c77c5ba7.

Revert "Fix pygments.rb tests."

This reverts commit 1f2165e68b.
2012-09-25 21:54:49 -06:00
bootstraponline 1f2165e68b Fix pygments.rb tests. 2012-09-25 21:47:24 -06:00
bootstraponline e9b6bdbdd7 Add dependency status. 2012-09-25 21:38:09 -06:00
bootstraponline c0c77c5ba7 Update pygments. Solves #225 #490 #517 2012-09-25 21:36:37 -06:00
Corey Donohoe 12403172ac Merge pull request #521 from Vanuan/update_nokogiri
Update nokogiri
2012-09-25 12:16:50 -07:00
John Yani 3b41ab8d75 Update nokogiri 2012-09-25 22:04:43 +03:00
bootstraponline 7bcf35f5b1 Fix #517. Thanks @roa 2012-09-23 16:26:48 -06:00
bootstraponline 9a7e1c94c7 Merge pull request #515 from realmacsoftware/master
Populate author details using the session.
2012-09-16 10:32:33 -07:00
Keith Duncan 30c2e675da Test that author details from the session are committed into the repository 2012-09-16 16:49:17 +01:00
Keith Duncan ac405803e8 Add notes on providing author details to the Rack documentation section 2012-09-16 16:25:09 +01:00
Keith Duncan 7dee787a92 Add documentation for where the commit_message parameters are passed and where they're source from 2012-09-16 15:59:49 +01:00
Keith Duncan ae4b1cdeca Add support for author parameters coming in from the session, to be set by rack middleware further up the stack 2012-09-15 21:06:08 +01:00
bootstraponline 572982cbf9 Use a professional right left button. 2012-09-09 21:11:16 -06:00
bootstraponline 74290874f9 Fix #383 test. 2012-09-09 14:05:10 -06:00
bootstraponline 847f08d952 Use block form of gsub to avoid regexp backref interpolation
The content of this commit message is from @kislyuk's comments on the below two issues.

Fix #383
Fix #511

`gsub!(pattern, replacement) interpolates` regexp backreferences
`gsub!(pattern) do block` doesn't

http://stackoverflow.com/questions/2082457/ruby-gsub-problem-when-using-backreference-and-hashes
2012-09-09 12:22:56 -06:00
Neal Pisenti 0bcd616668 fix mathjax option, fixes #509 2012-09-09 11:50:48 -06:00
bootstraponline 9dd701ccc4 Grit is broken. #508 #356 2012-09-04 17:52:56 -06:00
bootstraponline 56a5a7d92b Fix #507 2012-09-04 16:24:16 -06:00
bootstraponline 0cf0fad50e Finish removing MathJax from Live Preview. 2012-09-02 15:27:32 -06:00
bootstraponline 5f9e91656e Fix LaTeX tests. 2012-09-02 15:03:56 -06:00
Vicent Marti a7a2479f85 Release 2.2.1 2012-09-02 22:43:50 +02:00
Vicent Marti a8b230a490 Properly escape TeX data. 2012-09-02 22:27:04 +02:00
bootstraponline 041b01f171 Fix #490 2012-09-01 12:33:08 -06:00
Vicent Marti 1c475f3215 Release 2.2.0 2012-09-01 12:24:17 +02:00
Vicent Marti ab699d94b0 Do not render LaTeX locally
Offload the rendering service to MathTran.org, the free and open-source
LaTeX rendering engine.
2012-09-01 12:23:02 +02:00
bootstraponline 942d32c9b6 Fix uninstall command 2012-08-30 21:36:11 -06:00
bootstraponline 97f15f0b18 Add edit hotkey. #496 2012-08-30 21:07:57 -06:00
bootstraponline ed49358c50 Add h1-3 shortcuts. #496 2012-08-30 20:54:20 -06:00
bootstraponline 85eeecd140 Add save hotkey. 2012-08-30 20:48:44 -06:00
bootstraponline 30fd40fbe5 Fix #498
Ruby 1.8.7 and ri can't deal with <!-- appearing in documentation.
Please upgrade to the latest Ruby if you're able to.
2012-08-30 20:29:53 -06:00
bootstraponline 2ed262cacd v2.1.9 2012-08-30 20:12:28 -06:00
bootstraponline 29a1ef8f8a Skip doc on install 2012-08-30 20:04:20 -06:00
bootstraponline 772d18ee62 Fix uninstall command 2012-08-30 20:00:54 -06:00
bootstraponline dd604d9942 Fix #498 2012-08-30 19:57:20 -06:00
bootstraponline 85abc83427 v2.1.8 2012-08-30 19:41:54 -06:00
bootstraponline 6d8220629c Fix #500 2012-08-30 19:37:57 -06:00
bootstraponline 6ff7ada096 Fix #495 2012-08-30 18:31:35 -03:00
bootstraponline 8575049de5 Update get /data
Remove leading slash from page
Fix edge case with path set to '/'
2012-08-30 11:40:07 -03:00
bootstraponline bb6fb0c253 pathName is undefined when not found instead of 0 2012-08-30 11:18:02 -03:00
bootstraponline eb2ad9f840 Fix path
.key now returns undefined on failure so path can be 0.
If path is undefined then use an empty string.
2012-08-30 11:14:24 -03:00
bootstraponline d0dd23fc11 Fix path 2012-08-30 11:09:44 -03:00
bootstraponline 7ae4acbdb0 Fix #497 #492
Data url now includes path.
2012-08-30 11:03:11 -03:00
bootstraponline 881590ab37 Merge pull request #494 from releu/fix-requiring-uri-encoding-components
Move require "uri_encode_component"
2012-08-28 18:33:18 -07:00
Jan Bernacki 5e479dc5d9 move require 2012-08-28 22:44:09 +04:00
bootstraponline 7db9c2e762 Merge pull request #487 from jm/master
Fix bug with missing variable 'ext'
2012-08-27 11:08:19 -07:00
bootstraponline ce6b0ac095 v2.1.7 2012-08-25 19:21:13 -06:00
bootstraponline 420bb06988 Fix create test. 2012-08-25 18:58:20 -06:00
bootstraponline 20566f8acf Fix #484 2012-08-25 18:54:07 -06:00
bootstraponline 1d5f69704a Clean paths so they start with one slash. 2012-08-25 18:41:13 -06:00
bootstraponline 0da664299e Fix edit. 2012-08-24 13:47:17 -06:00
bootstraponline 6e8fb2b457 Disable exact on edit for now. 2012-08-24 13:38:34 -06:00
bootstraponline d1c72a4ff3 Fix #483 and #481
Exact matching of requested pages

- /page is no longer the same as /a/page
- Deleting /page only deletes /page (before it would delete /a/page instead of /page)
- Edit currently breaks the unit tests if exact matching is enabled
- Fix redirect on create
- Add @giga's checked_dir = '' fix https://github.com/giga/gollum/commit/936958b47324a09c683cb90a2560484b47e09529
- Fix create unit test
2012-08-24 13:35:37 -06:00
bootstraponline 0bf05392e4 Redirect to correct path. #481 2012-08-24 12:26:59 -06:00
bootstraponline 7ecef0c045 Fix #479 2012-08-23 14:11:28 -06:00
bootstraponline 33ca329253 Handle nil slash. 2012-08-23 12:30:08 -06:00
bootstraponline 01fa4770cb Fix page lookup. #473 2012-08-23 12:16:40 -06:00
bootstraponline b76257c49c Restore foward slash. 2012-08-23 11:59:56 -06:00
bootstraponline e2fbf22f38 Fix #473. 2012-08-23 11:51:20 -06:00
bootstraponline 134432d029 v2.1.6 2012-08-23 11:33:00 -06:00
bootstraponline 8d4d6e80b8 Fix #475. 2012-08-23 11:27:40 -06:00
bootstraponline 85e6ef3dca v2.1.5 2012-08-22 19:57:22 -06:00
bootstraponline 60f1467229 Fix encoding for 1.8. 2012-08-22 18:51:41 -06:00
bootstraponline 1757242382 Don't unpack Fixnum. 2012-08-22 17:40:53 -06:00
bootstraponline 55df7bb9c4 Use encodeURIComponent instead of CGI::escape when output is sent to browser. 2012-08-22 17:30:46 -06:00
bootstraponline 686b8acd38 Fix encodeURIComponent on Ruby 1.8.
Replace .ord with .unpack('U')[0]
2012-08-22 17:23:08 -06:00
bootstraponline a5f9df6170 Restore CGI::escape. 2012-08-22 16:57:24 -06:00
bootstraponline 27f61a870a Merge pull request #477 from LuminosoInsight/master
Fix titles created with the "New" button.
2012-08-22 15:54:23 -07:00
bootstraponline a48e8d1c5c New editor style.
Disable MathJax in live preview. Parser isn't MathJax aware.
Performance of MathJax in live preview is not great.
Auto hide editor overflow.
2012-08-22 16:50:57 -06:00
bootstraponline b80f74bccd Remove protocol and host. 2012-08-22 13:32:18 -06:00
bootstraponline 1e768734ef Disable MathJax by default.
GitHub.com doesn't support MathJax. The parser is not MathJax aware which causes problems.

--mathjax enables MathJax.
2012-08-22 13:31:21 -06:00
bootstraponline 11c9cabeb3 Fix edit baseUrl. 2012-08-22 13:21:01 -06:00
bootstraponline 3a14ab92f0 Fix new page when using map '/wiki' in config.ru. 2012-08-22 13:15:18 -06:00
bootstraponline 62d5f52398 Fix anchor for Firefox. 2012-08-22 13:10:11 -06:00
Rob Speer 2b4848566c Fix names created with the 'New' button.
Previously, a page created with the 'New' button would get all of its
spaces turned into the + symbol when submitted, which Gollum would then
convert into "-plus-" in the title. So, for example, a request to create
a page called "Test page" would instead get "test plus page".

This change changes + to - in the parameter received by /create/.
2012-08-22 14:15:20 -04:00
bootstraponline 7c825e877c Remove protocol + host. 2012-08-20 15:51:07 -06:00
bootstraponline 8417c277e6 Fix delete link when using baseUrl. 2012-08-20 15:23:07 -06:00
bootstraponline 9cef423908 Remove default value in new page. 2012-08-19 14:25:02 -06:00
bootstraponline e73c84490e Remove prefix. #470. 2012-08-16 12:01:03 -06:00
bootstraponline 6cfc807db0 Revert still broken in Grit. 2012-08-15 12:22:03 -06:00
bootstraponline be366f8103 v2.1.4 2012-08-15 12:06:12 -06:00
bootstraponline 2d13bd796f Improve #470 fix. 2012-08-15 12:03:48 -06:00
bootstraponline 523f8f80ca Fix #470. 2012-08-15 11:48:17 -06:00
bootstraponline b76fef9143 Update version to 2.1.3 2012-08-13 11:37:56 -06:00
bootstraponline e935af83d5 Update gemspec. 2012-08-13 11:35:15 -06:00
bootstraponline d4e019ef42 Merge pull request #331 from tjh/home-page-link-issue
Redirect from root to /Home, fixes #250
2012-08-09 10:41:31 -07:00
bootstraponline 2e738828c6 Merge pull request #467 from jamesduncombe/pygments_initialize
Added Pygments.start to initialize Pygments on startup, fixes #465
2012-08-09 10:21:59 -07:00
James Duncombe fd7dc93778 Added Pygments.start to initialize Pygments on startup 2012-08-09 09:14:55 +01:00
bootstraponline 3df407d9ee Merge pull request #464 from giga/master
Fix editor when base url is '/'
2012-08-08 10:53:45 -07:00
Jean-Philippe Garcia Ballester 6fbba84725 Revert "Base path is relative."
This reverts commit 69e453ea0b.
2012-08-08 13:49:11 +02:00
Jean-Philippe Garcia Ballester 37d20fa9cc Base url without trailing '/'
This will allow cleaner url in templates and javascripts.
2012-08-08 13:49:09 +02:00
bootstraponline 410cd912ac Fix releasing. 2012-08-06 18:31:36 -06:00
bootstraponline d234bbd861 Test get %r{/(.+?)/([0-9a-f]{40})} do 2012-08-06 18:27:12 -06:00
Corey Donohoe 3f68d96815 setup proper gem version numbers 2012-08-06 16:32:16 -07:00
bootstraponline 015cd895d2 Don't ignore version. 2012-08-06 17:18:30 -06:00
bootstraponline 5fa4b48d85 Fix new page default dir. 2012-08-06 15:57:46 -06:00
bootstraponline 88a3783bbc Remove wpage. 2012-08-06 15:55:05 -06:00
bootstraponline ea2254b9bd Fix #462.
Add test for 462.
2012-08-06 15:52:19 -06:00
bootstraponline 9a0c1f2605 Fix path. 2012-08-06 15:18:15 -06:00
bootstraponline 008f26bb7d Fix app. 2012-08-06 14:49:56 -06:00
bootstraponline 69e453ea0b Base path is relative. 2012-08-06 14:28:24 -06:00
bootstraponline 88b0b608f4 Add null guard. 2012-08-06 13:49:48 -06:00
bootstraponline 19e3987ae3 Fix path escaping. 2012-08-06 13:36:28 -06:00
bootstraponline c72e91ddaf Fix #462. 2012-08-06 13:16:31 -06:00
bootstraponline c789dd5067 Update org-ruby. 2012-08-02 19:45:06 -06:00
bootstraponline 551949de29 Fix #459. 2012-08-02 16:55:24 -06:00
bootstraponline 80730ee87a Merge pull request #419 from trans/metadata
Add support for embedded page metadata.
2012-08-01 16:05:10 -07:00
trans 71028adc9e Add support for embedded page metadata. 2012-08-01 18:35:53 -04:00
bootstraponline a2efebc06c Fix #453. 2012-08-01 13:04:04 -06:00
bootstraponline a4e277a86b Update gemspec. 2012-08-01 10:20:53 -06:00
bootstraponline 494c80d8b1 Add home button. 2012-08-01 01:53:30 -06:00
bootstraponline 02539bfdd3 Move new page dir logic to JS. 2012-08-01 01:49:38 -06:00
bootstraponline a0f05eaf67 More refactoring.
Fix delete.
2012-08-01 01:36:23 -06:00
bootstraponline 72e26fc90b Refactor app.rb to use paged.
Create new pages relative to current directory.
2012-08-01 00:37:34 -06:00
bootstraponline 2261cfabf3 Make wiki.page directory aware.
Remove scoped_page.
2012-07-31 23:24:37 -06:00
bootstraponline c1afa2a0e3 Path is now sent on rename. 2012-07-31 22:13:04 -06:00
bootstraponline d28f454c6e Send path when renaming pages.
Fix nil error on editing a non-existent page.
Use baseURL on delete.
2012-07-31 21:58:35 -06:00
bootstraponline f471c80ac0 Merge pull request #455 from ennova/scoped-page
Add a method that returns a given page name scoped to a directory.
2012-07-31 20:18:38 -07:00
Odin Dutton and Sebastian Korfmann be086d94b5 Add a method that returns a given page name scoped to a directory.
This is to allow access to non unique pages.
2012-08-01 09:15:25 +10:00
bootstraponline ff719510b6 Merge pull request #454 from kislyuk/master
Don't stop highlighting if one code block throws an exception.
2012-07-31 11:13:58 -07:00
Andrey Kislyuk 7b16116b67 Proceed with highlighting if one code block fails 2012-07-31 08:44:38 -07:00
bootstraponline 8422b71204 @arr2036's fix for #453. 2012-07-30 19:04:10 -06:00
bootstraponline c9bc2a89f6 Delete link now works with directories.
Fix #452.
2012-07-27 15:03:26 -06:00
bootstraponline 387a52a7ba Remove extra / in delete href. 2012-07-27 14:54:34 -06:00
bootstraponline 96842d9742 Refactor page url generation.
Avoid appending './' to urls.
2012-07-27 14:45:40 -06:00
bootstraponline 8fcef5401b Fix href in file view. 2012-07-27 12:27:16 -06:00
bootstraponline 804c4c678d Fix #446.
The old regex turns 'a/b/c/' into 'a/' which is not correct.
The new regex is directory aware.
2012-07-27 12:14:06 -06:00
bootstraponline 8558777ece Include full path in file view href. 2012-07-27 11:34:04 -06:00
bootstraponline 77bb608878 Fix #446. 2012-07-27 11:08:11 -06:00
bootstraponline 2f574261a7 Merge pull request #359 from sunny/base-url
Relative urls.
2012-07-25 09:55:26 -07:00
Sunny Ripert 28c4a2c39e Merge pull request #2 from giga/base-url
Fix relative url
2012-07-25 07:59:01 -07:00
Jean-Philippe Garcia Ballester bd36cb59b1 Fix relative url 2012-07-25 12:33:48 +02:00
Jean-Philippe Garcia Ballester 998358ada8 Fix relative url 2012-07-25 12:27:00 +02:00
Sunny Ripert 75a00e8821 baseUrl missing on page rename 2012-07-25 11:20:53 +02:00
Sunny Ripert b5653464d2 Merge branch 'master' into base-url
Conflicts:
	lib/gollum/frontend/public/gollum/css/_styles.css
	lib/gollum/frontend/public/gollum/javascript/gollum.js
	lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
	lib/gollum/frontend/templates/file_view.mustache
	lib/gollum/frontend/templates/layout.mustache
	lib/gollum/frontend/templates/page.mustache
2012-07-25 10:00:52 +02:00
Sunny Ripert 0269cd0b3b Merge pull request #1 from giga/base-url
Base url
2012-07-25 00:49:18 -07:00
Jean-Philippe Garcia Ballester 88ed662fd4 Fix editor to work with “base_url” 2012-07-24 23:51:49 +02:00
Jean-Philippe Garcia Ballester 7c180c86a4 Set wiki “base_path” option to fix “base_url”
If the “base_path” option of the wiki is not set, set it to the base url.
  It will make links work seamlessly when mounting to a relative url.
2012-07-24 23:46:22 +02:00
bootstraponline f811ac510e Improve names. Fix #447. 2012-07-22 21:04:02 -06:00
bootstraponline 3e5054f357 Call to_url on rename to prevent invalid renames.
Remove to_url on delete so invalid names can be deleted.
Handle nil in to_url.
Update tests.
2012-07-22 13:45:30 -06:00
bootstraponline 3424a424a7 Add /delete test. 2012-07-22 13:25:25 -06:00
bootstraponline 8eb8af8ef8 Use old name default text on rename. 2012-07-21 21:00:14 -06:00
bootstraponline 8eaf7fc497 Remove msg. 2012-07-21 16:57:20 -06:00
bootstraponline 3255709399 Don't mess with the commit message. 2012-07-21 16:52:18 -06:00
bootstraponline 2dbea36b81 Add rename button. Fix #444. 2012-07-21 16:31:38 -06:00
bootstraponline e0b7009bff Add delete this Page based on .com.
Match short sha commit message of .com for edit and delete.
Update tests.
2012-07-21 15:33:43 -06:00
Vicent Marti 77fb5ec3cb Fix parsing extra whitespace in code blocks 2012-07-21 15:34:56 +02:00
bootstraponline 7392bce5dc Restore livepreview.
Improvements include:
- UTF-8 aware
- Undo and redo support
- Code highlighting fixes
- New tests ensure output matches native sundown

Use jquery 1.7.2
2012-07-18 18:11:19 -06:00
bootstraponline 8188bbd35d Add mousetrap. 2012-07-18 18:03:26 -06:00
bootstraponline 80fdea7bfb Fix #437.
Add hotkey support using mousetrap.
2012-07-18 14:17:50 -06:00
bootstraponline dc9f6ac709 Display to_url name on create. 2012-07-18 12:29:03 -06:00
bootstraponline ba796bc23d Comment out test. See #363. 2012-07-18 10:35:53 -06:00
bootstraponline e0ecb4c44f Fix #435. 2012-07-17 15:29:34 -06:00
bootstraponline d4c05304e9 Fix #434. 2012-07-17 15:22:37 -06:00
bootstraponline ccdbd71517 Fix style. 2012-07-17 11:19:54 -06:00
bootstraponline 454fce09c6 Merge pull request #441 from haad/upstream-gollum-path
Add --gollum-path [PATH].
2012-07-17 10:15:32 -07:00
bootstraponline be4b12b4c8 Use .times.
Fix style.
2012-07-17 11:12:59 -06:00
bootstraponline 9fa629de31 Use range instead of upto. 2012-07-17 11:01:52 -06:00
bootstraponline 78dd5774b3 Fix code style. 2012-07-17 10:55:57 -06:00
bootstraponline bb9a9cd0db Merge pull request #440 from haad/upstream
Add support for multi-level directory setups, where files are under mult...
2012-07-17 09:46:34 -07:00
Adam Hamsik ab9d8fb3db Add option to define gollum path from command line. This way we can use different git repo for wiki files and different repo for
gollum.
2012-07-17 15:25:55 +02:00
Adam Hamsik 6ce76af2be Fix tests. 2012-07-17 12:00:42 +02:00
Adam Hamsik 3199a4b2cb Remove debug puts. 2012-07-17 11:10:09 +02:00
Adam Hamsik 6a2d153c3d Add support for multi-level directory setups, where files are under multiple directories.
Generate HTML for them properly.
2012-07-17 11:06:04 +02:00
bootstraponline bfd4ad9255 Async loading of MathJax.
http://calendar.perfplanet.com/2011/the-art-and-craft-of-the-async-snippet/
2012-07-13 14:25:53 -06:00
bootstraponline 30224515fd Update table style to match .com. 2012-07-13 14:11:10 -06:00
bootstraponline d7f3acfd05 Disable live preview until a robust JavaScript based markdown parser is found. 2012-07-13 00:42:26 -06:00
bootstraponline a9e9eeeb54 Another encoding fix from #387. 2012-07-12 12:06:47 -06:00
bootstraponline 76fa52b313 Merge pull request #387 from arr2036/fix_encoding
Work around Grit encoding issues.
2012-07-12 11:03:19 -07:00
bootstraponline 67de8e6a3a Fix to_url so it correctly handles _Header, _Footer, and _Sidebar. 2012-07-11 20:10:59 -06:00
bootstraponline ff78998829 30px height. 2012-07-11 16:12:27 -06:00
bootstraponline 55786e2d29 Uninstall old gollum before installing the new gem. 2012-07-11 10:35:37 -06:00
bootstraponline 20534a71b9 Remove New Page from file view. 2012-07-11 10:23:01 -06:00
bootstraponline 316b6feccb Write_page changes not yet merged. 2012-07-10 11:46:00 -06:00
bootstraponline 6c7417e0a2 Add transliteration test. 2012-07-10 11:40:36 -06:00
bootstraponline af89dc881e Merge pull request #424 from bootstraponline/unicode_to_ascii
Ensure page file names are ASCII.
2012-07-10 09:52:57 -07:00
bootstraponline 5714cef3de Page names are no longer case sensitive. 2012-07-10 10:47:15 -06:00
bootstraponline 3d2c8e7cc5 ASCII only filenames.
Fix test_unicode.
2012-07-10 10:41:55 -06:00
bootstraponline 772ffcc5e8 Ensure ascii only filenames. Fix #423. 2012-07-09 13:22:45 -06:00
bootstraponline 8c30bb3a9f Merge pull request #422 from nature/sidebar_rendering_in_subfolders
Sidebar rendering in subfolders.
2012-07-09 09:19:11 -07:00
bootstraponline 89bc121d3f Merge pull request #421 from nature/create_new_page_in_subdir
Make the 'New Page' button create pages in sub directories.
2012-07-09 09:15:42 -07:00
Darren Oakley 1cc9d7b647 Slight optimisations...
- only create a new GitAccess object if the wiki does not have a @page_file_dir directive
- memoize the new GitAccess object
2012-07-09 13:01:40 +01:00
Darren Oakley 50e494e8e9 Make pages inherit their sidebar/header/footer from parent directories regardless of the current 'page_file_dir' of the wiki. refs #413 (https://github.com/github/gollum/issues/413) 2012-07-09 12:10:41 +01:00
Darren Oakley 19325930a2 Add a new file and sub-directory - 'Rivendell/Elrond.md' so we can test Sidebar/Header/Footer inheritance from parent directory. 2012-07-09 11:50:08 +01:00
Darren Oakley ac97f7e9a2 Make the 'New Page' button create pages in sub directories if the user puts a slash in the path/page name. 2012-07-09 10:41:51 +01:00
bootstraponline 33f133b8b2 Livepreview is 102KB again.
java -jar compiler.jar --compilation_level WHITESPACE_ONLY --js sundown_o2_m0.js --js_output_file sundown_o2_wo.js

MKDEXT_SUPERSCRIPT extension disabled to match .com behavior (also fixes MathJax).
2012-07-06 23:26:12 -06:00
bootstraponline 2e9995e80a Use sundown_o2_m0. Fix #415. 2012-07-06 16:20:53 -06:00
bootstraponline 53f676bf2e Do not load data on github.com. 2012-07-06 12:21:55 -06:00
bootstraponline 874d658d2a Ace is broken on Safari 6. Fix #414. 2012-07-06 12:01:45 -06:00
bootstraponline d27c455ab7 Update sundown. 2012-07-05 12:01:09 -06:00
bootstraponline 9291431c61 Fix #413. 2012-07-04 12:24:35 -06:00
bootstraponline 2e5f51e9ae Update comment. 2012-07-04 11:20:38 -06:00
bootstraponline 2aa7e466ed File view links use '-' instead of %20. 2012-07-04 11:04:51 -06:00
Jeremy McAnally 3767a11d21 Rename variables to be more clear and fix reference to non-existent 'ext' variable 2012-07-04 12:33:09 -04:00
bootstraponline 8c8b72d482 Restore path support to livepreview.js. 2012-07-03 23:55:28 -06:00
bootstraponline bb9effa282 Prevent wrapping on long file names.
Fix formatting.
2012-07-03 20:41:14 -06:00
bootstraponline 52e96bfa0f Detect typed array support based on user agent.
http://caniuse.com/typedarrays
2012-07-03 15:26:40 -06:00
bootstraponline 00ded65b7f Fall back to old edit mode if typed arrays are not supported. 2012-07-03 14:47:27 -06:00
bootstraponline f738aa4234 Disable ie 9 live preview support for now. 2012-07-03 14:19:27 -06:00
bootstraponline 6ff939451c Update livepreview.
Update ace.
Replace pagedown with sundown. Live preview is now able to render markdown identical to regular gollum by leveraging the same library.

Thanks to @kripken for explaining how to best use emscripten for sundown.
2012-07-03 13:55:08 -06:00
bootstraponline 32930cee01 extract_path fails on nil paths. 2012-07-03 10:55:42 -06:00
bootstraponline 3f45c76f48 Extract path on edit. Fix #410. 2012-07-03 10:53:18 -06:00
bootstraponline 1511baf12d Restore Home.md. 2012-07-02 10:37:46 -06:00
bootstraponline 20dd0816a6 Revert "Merge pull request #379 from pipex/latex-dollar-sign"
This reverts commit b53c961db2, reversing
changes made to 9c40cbea76.
2012-07-02 10:27:30 -06:00
bootstraponline 41cd43ebc6 Updated Home (markdown) 2012-07-02 10:18:40 -06:00
Sunny Ripert 4a63899722 Livepreview JavaScript fix for base_url 2012-07-02 15:03:01 +02:00
Sunny Ripert c31ead493a Fixed tests to make up for base url 2012-06-28 17:31:19 +02:00
Sunny Ripert 7485733fba Sinatra base url to allow subdirectories 2012-06-28 17:31:19 +02:00
bootstraponline e930b5d07b Merge pull request #390 from arr2036/app_rest_fix
App rest fix.
2012-06-26 13:27:57 -07:00
Arran Cudbard-Bell 4543781153 Add tests to check page redirects to create 2012-06-24 22:41:27 +01:00
Arran Cudbard-Bell 1d5bfbb162 Add URL for page creation to allow preemption by extensions 2012-06-24 22:41:27 +01:00
bootstraponline 7045f7f92d Fix searching for page titles. 2012-06-22 16:04:57 -06:00
bootstraponline 5e7974f30b Fix file ext removal.
a = '/.md/home.md'

a.chomp(File.extname(a))
=> "/.md/home"

a.gsub(File.extname(a),'')
=> "//home"
2012-06-22 11:45:42 -06:00
bootstraponline 1079a888d3 nil.to_i == 0 2012-06-22 11:28:34 -06:00
bootstraponline b1837abbc2 Fix nil error in search. 2012-06-22 11:24:13 -06:00
bootstraponline 611e1a536c Merge pull request #403 from trans/file
Add Wiki#files for list of non-page files.
2012-06-22 09:59:31 -07:00
bootstraponline c152ae1557 Merge pull request #401 from nature/make_gollum_search_count_additive
Update the Wiki.search function to make the results counts 'additive'.
2012-06-22 09:49:04 -07:00
bootstraponline de3020c1aa Merge pull request #400 from nature/new_page_within_dir
Add a 'New Page' button to the /pages browser.
2012-06-22 09:48:23 -07:00
trans f12c3fe06f Fix docs for File#populate. 2012-06-22 08:45:57 -04:00
trans 754485c306 Add Wiki#files for list of non-page files. 2012-06-22 08:23:46 -04:00
Darren Oakley 088448a8a1 Update the Wiki.search function to make the results counts 'additive'.
i.e. so if we have a file named 'foo' that also contains the word 'foo' is should report 2 matches, not 1.
2012-06-22 12:01:39 +01:00
Darren Oakley 6e35a09abd Add a 'New Page' button to the /pages browser that allows users to create a new page within a subdirectory. 2012-06-22 11:41:42 +01:00
bootstraponline 8fd11e8fdb Fix #396.
Use ls-files to search file names (which define the page title).
2012-06-21 19:18:46 -06:00
bootstraponline 40855103ad Disable failing test. 2012-06-21 17:26:19 -06:00
bootstraponline 02041dbdb7 Work around #363 (grit is broken). 2012-06-21 16:45:38 -06:00
bootstraponline 18ccc01501 Remove #head boarder in /pages because it's now defined by .breadcrumb. 2012-06-21 13:16:34 -06:00
bootstraponline 1ff3f9c0da Merge pull request #393 from nature/dir_support
Add Directory Support.
2012-06-21 09:39:12 -07:00
Darren Oakley 7a251248f1 Re-work the compare URL matchers so that CGI escaping etc shouldn't be so needed. 2012-06-21 15:59:10 +01:00
Darren Oakley 971cbb94f6 Make the Sinatra app directory aware. 2012-06-21 15:59:01 +01:00
bootstraponline b53c961db2 Merge pull request #379 from pipex/latex-dollar-sign
[New] Support `$` and `$$` as formula delimiters.
2012-06-19 13:22:49 -07:00
bootstraponline 9c40cbea76 Merge pull request #377 from pipex/latex-align
[Fix] Inline latex formula alignment
2012-06-19 13:22:26 -07:00
bootstraponline a8ce7e93cd Enable MathJax for live preview. 2012-06-19 11:58:09 -06:00
bootstraponline 4b02b74d6f Fix #389.
Set page name correctly on preview.
2012-06-19 10:59:24 -06:00
Arran Cudbard-Bell 67dd3afd92 Fix for 1.8 versions of ruby 2012-06-19 15:33:47 +02:00
bootstraponline 7aca7fa0ec Update Ace. 2012-06-18 12:32:27 -06:00
bootstraponline c0564a1467 Update readme. 2012-06-18 12:32:14 -06:00
bootstraponline b0a8984d3b Update livepreview for new Ace. 2012-06-18 12:31:30 -06:00
bootstraponline 0f451d6833 Fix #386. File view defines its own layout. 2012-06-18 10:54:14 -06:00
Arran Cudbard-Bell c704d1f3b3 Hacky fix for encoding issues 2012-06-18 09:44:20 +02:00
bootstraponline e6d568fd49 Merge pull request #385 from bootstraponline/sequence_no_conflict
Fix #376.
2012-06-17 15:20:19 -07:00
bootstraponline ee56509302 Fix #376.
New syntax for sequence diagrams is {{{{{{ }}}}}}.
2012-06-17 16:11:59 -06:00
bootstraponline bc5896b51f Update readme. 2012-06-17 16:01:48 -06:00
bootstraponline 3224f5f422 Document building the gem from master.
[ci skip]
2012-06-16 12:17:13 -06:00
Felipe Lalanne f9cd97edaa [Fix] Replaced random escaping of $
The `$` symbol is now escaped by replacing it with a static string.
2012-06-11 20:18:22 +02:00
bootstraponline e1ce3d46de Fix location for live preview. 2012-06-11 10:07:17 -06:00
Felipe Lalanne 294a8e9642 [New] Support $ and $$ as formula delimiters.
Although the standard formula delimiters for latex formulas is currently
`\(` and `\[`, the `$` syntax has an advantage from the point of view of
writing speed, very important if we intend to use *gollum* as a writing
tool.

The code includes support for escaping of the `$` symbol by using the
gollum syntax `'`.
2012-06-11 12:06:54 +02:00
Felipe Lalanne 44fb6d9648 [Removed] Unnecessary require 'time' line. 2012-06-11 11:39:37 +02:00
Felipe Lalanne 74c1ba1653 [Fix] Inline latex formula alignment
Fixed an issue of latex inline formulas not aligning correctly with
the text. The fix is a ruby translation of the Perl code described in
http://tex.stackexchange.com/questions/44486/pixel-perfect-vertical-alignment-of-image-rendered-tex-snippets.
This code calculates the alignment of the generated image depending on
the image size and the size of the white space between the formula and
the margins of the image.

The alignment now is nearly perfect, however the new rendering comes
with a performance impact because of the increased number of operations.
To reduce this impact, the generated images and calculated values for
the alignment are now cached in `~/.cache/gollum`. The caching is done
per formula and not per page, thus avoiding caching the same formula
twice.

The Readme and tests have been modified accordingly with the new tool
requirements and expected markup.
2012-06-11 11:25:25 +02:00
bootstraponline 0cb39f049f Fix IE check. 2012-06-08 16:57:19 -06:00
bootstraponline f7a3a8aa55 Live preview supports IE 9. 2012-06-08 16:54:28 -06:00
bootstraponline cbc37eb006 Fix live_preview option #374. 2012-06-08 16:39:44 -06:00
bootstraponline 097f45eeb3 Use Ace for code highlighting.
Update Ace.
Fix CSS for new Ace.
Prevent flickering of toolpanel.
Add GitHub theme for Ace.
Remove gutter in static highlight ext.
Update languages for Ace.
2012-06-08 15:50:20 -06:00
bootstraponline 4c5b3dd76f Remove highlightjs.
Remove old Ace.
2012-06-08 15:49:05 -06:00
bootstraponline ccf70590a4 Merge pull request #374 from arr2036/optional_livepreview
Optional livepreview
2012-06-07 09:08:58 -07:00
Arran Cudbard-Bell 3c709a27ac Add commandline option for disabling livepreview 2012-06-07 18:05:15 +02:00
Arran Cudbard-Bell 8554654ee9 Add option to disable livepreview from settings 2012-06-07 11:30:30 +02:00
bootstraponline 59ac86cf6e Add header example to readme. 2012-06-05 15:56:02 -06:00
bootstraponline a4ecc9a187 Merge pull request #371 from bootstraponline/searchfix
Search fix (#348 with assert_not_match replacement).
2012-06-03 15:42:21 -07:00
bootstraponline cc67c8b68e Don't use assert_not_match. 2012-06-03 16:37:47 -06:00
bootstraponline b41f660fec Merge pull request #358 from blmarket/koreanfix
Use grit with force_encoding('ascii-8bit')
2012-06-03 15:00:37 -07:00
bootstraponline 00edcbbf64 Move build status to top of readme. 2012-06-03 15:56:29 -06:00
bootstraponline c530c70575 Add tests for file_view. 2012-06-03 15:53:11 -06:00
bootstraponline 21840bb344 Remove debug code. 2012-06-03 14:00:50 -06:00
bootstraponline 57bc23779d Merge pull request #370 from cholick/master
File View doesn't work when there's a single subdirectory
2012-06-03 12:41:23 -07:00
Matt Cholick (phenom2-desktop) 78e649f30a fix for broken file view when only a single directory 2012-06-03 11:56:18 -05:00
blmarket eaa7a61f71 Fixed 1.8.7 compatible issue 2012-05-31 21:27:27 +09:00
Neon 150a019b8d Added test cases to test Unicode handling issue.
these test cases will fail on non-unicode testing environment
2012-05-31 20:14:21 +09:00
Jeong, Heon 5dd1158025 Use grit with force_encoding('ascii-8bit') 2012-05-31 20:14:21 +09:00
bootstraponline c60ca4a8d2 Merge pull request #367 from bootstraponline/browser_fallback
Enable live preview only for supported user agents.
2012-05-29 17:35:01 -07:00
bootstraponline e1b28f0805 Rename is_supported to supported_useragent?. 2012-05-29 18:28:19 -06:00
bootstraponline aeeaeb1eae Fall back to old edit mode for browsers that are not officially supported by Ace. 2012-05-29 16:32:39 -06:00
Corey Donohoe 76f87f9094 stay on 1.8.7 for the foreseeable future
Settles #365 for now
2012-05-28 10:55:59 -07:00
bootstraponline 01e1c92813 Add --base-path option. 2012-05-24 20:45:33 -06:00
bootstraponline 22c0206451 Call page.versions once. 2012-05-24 18:32:45 -06:00
bootstraponline 5173c258b7 Merge pull request #354 from bootstraponline/mathjax
Add MathJax (only for gollum, not github.com).
2012-05-24 16:24:44 -07:00
bootstraponline ff8b892ebe Add mathjax using SSL CDN. 2012-05-24 17:18:55 -06:00
bootstraponline 7b0988cc19 Remove empty line. 2012-05-24 17:10:05 -06:00
bootstraponline a4c79f09f8 Gem uninstall does not require sudo (pointed out by @michaelklishin). 2012-05-24 16:48:54 -06:00
bootstraponline 7ec3d92215 Merge pull request #361 from github/travis-fixes
nuke the ffi gem on travis boxes
2012-05-24 15:43:21 -07:00
Corey Donohoe ac9fef784a nuke the ffi gem on travis boxes
/cc @bootstraponline @akzhan
2012-05-24 15:31:54 -07:00
bootstraponline 4822bad4fb Merge pull request #355 from bootstraponline/author_fix
Fix author info (based on #350).
2012-05-23 11:40:26 -07:00
bootstraponline d7dd90f073 Update README.md 2012-05-23 11:12:29 -06:00
Neon bbc19d1800 Added testcase for 'open existing parent' 2012-05-24 00:04:45 +09:00
Jeong, Heon 9ee9e61312 Fix searching in page_dir if it exists
This bug can cause DuplicateError even there is no such file

in page_dir
2012-05-23 23:58:54 +09:00
bootstraponline f765137f3f Avoid nil. 2012-05-23 00:04:57 -06:00
bootstraponline e160822b0f Only use versions. 2012-05-22 23:48:56 -06:00
bootstraponline c0e35b0126 Avoid nil. 2012-05-22 23:03:23 -06:00
bootstraponline ac41ed629e Merge modified #350. 2012-05-22 22:46:15 -06:00
Kristi 8b5dfff2a1 Merge pull request #343 from kristi/toc
Table of contents feature
2012-05-22 13:14:25 -07:00
kristi e77154bf7a Merge remote-tracking branch 'upstream/master' into toc 2012-05-22 12:14:03 -07:00
kristi 5f5187e05c Only set parentpage if a subpage was found
Fixes error if there's no header or footer
2012-05-22 11:55:02 -07:00
bootstraponline 5db1728a3f Use org-ruby 0.6.3. Fixes #86. 2012-05-22 09:49:11 -06:00
bootstraponline c7984ceed1 Revert "Merge pull request #350 from blmarket/pageauthor"
This reverts commit 5d3571b7a3, reversing
changes made to c1082b4474.
2012-05-21 17:09:15 -06:00
bootstraponline 5d3571b7a3 Merge pull request #350 from blmarket/pageauthor
Proper last edit info (with test case)
2012-05-21 16:00:15 -07:00
bootstraponline c1082b4474 Fix click. 2012-05-21 10:39:11 -06:00
bootstraponline 14f16349c0 Remove unload on save. 2012-05-21 10:35:29 -06:00
bootstraponline aa7e01a085 Add unload confirmation on live preview, edit, and create. 2012-05-21 10:27:16 -06:00
bootstraponline 484629734e Update README.md 2012-05-21 10:17:05 -06:00
bootstraponline 444fca2250 Revert changes to Home. 2012-05-21 10:02:55 -06:00
bootstraponline 7f17102c86 Remove home.md. 2012-05-21 10:00:06 -06:00
bootstraponline e480998a4c Merge pull request #345 from bootstraponline/file_view
Add file view.
2012-05-21 08:58:14 -07:00
bootstraponline 5c642997fe Origin is undefined in Firefox. 2012-05-21 09:50:23 -06:00
bootstraponline 5be5cd5ba5 Updated Home (markdown) 2012-05-21 09:49:22 -06:00
bootstraponline 1d55ed0599 Updated Home (markdown) 2012-05-21 09:49:12 -06:00
bootstraponline 4380aa9803 Updated Home (markdown) 2012-05-21 09:45:39 -06:00
bootstraponline 66e7f240da Updated Home (markdown) 2012-05-21 09:45:14 -06:00
bootstraponline f3e5816547 Updated Home (markdown) 2012-05-21 09:45:08 -06:00
bootstraponline 3d5931c259 Updated Home (markdown) 2012-05-21 09:44:52 -06:00
bootstraponline d510c74456 Updated Home (markdown) 2012-05-21 09:44:27 -06:00
bootstraponline 7154220d0b Updated Home (markdown) 2012-05-21 09:44:19 -06:00
bootstraponline d5155273df Move script tags to bottom. Refactor livepreview logic into livepreview.js. 2012-05-20 12:34:32 -06:00
Jeong, Heon 60dbe9d0a7 Proper last edit info
but it can be slow if page modified so many times
2012-05-20 12:37:10 +09:00
bootstraponline f7d3f6b3f0 Don't wait for onload. 2012-05-18 15:57:41 -06:00
bootstraponline 40fdd2aa74 Adjust save text. 2012-05-18 15:49:57 -06:00
bootstraponline f39ed93ca0 Use default commit message in comment window. 2012-05-18 15:32:14 -06:00
bootstraponline 541b2fabb4 Add new page button to file view action panel. 2012-05-18 15:00:23 -06:00
bootstraponline 067ad72f34 Update icon license. 2012-05-18 13:12:14 -06:00
bootstraponline 6c137e39c9 Add file view button. 2012-05-18 13:05:08 -06:00
bootstraponline f8c6cdb207 Add license for css tree menu. 2012-05-18 12:11:55 -06:00
bootstraponline f5de6a809d Remove name2 now that name is fixed. 2012-05-18 12:09:42 -06:00
bootstraponline e36b96fca6 Remove comments. 2012-05-18 12:01:43 -06:00
bootstraponline cd1738bdf6 Fix file names. 2012-05-18 12:00:43 -06:00
bootstraponline ebcd30fadc Add file view. 2012-05-18 11:50:38 -06:00
bootstraponline 3c10a6bf94 Set focus when toggling comment window. 2012-05-18 11:08:27 -06:00
bootstraponline dc80fd9b15 Remove old comments. 2012-05-18 10:39:52 -06:00
bootstraponline 5d21df9ac7 Fix css href. 2012-05-18 10:38:27 -06:00
bootstraponline 019e912d7f Fix comment button. 2012-05-18 10:35:42 -06:00
bootstraponline 3479dca0d0 Add comment window using Ace that allows user entered commit messages.
Use darkness div to dim the background when the comment window is active.
Set CSS in batch to avoid unnecessary reflows.
Use debouncing to efficiently resize the window.
Eliminate previewSetter in favor of redefining the previewSet function.
2012-05-18 10:28:59 -06:00
bootstraponline 32e5cc4a5a Add debounce. 2012-05-18 10:27:01 -06:00
bootstraponline 268a9f18fa Update readme. 2012-05-18 10:24:14 -06:00
bootstraponline 16a6186570 Add icon for save with comment in live preview. 2012-05-17 16:00:09 -06:00
bootstraponline 4b2fb6dd11 Add default commit messages when using gollum editor. 2012-05-17 15:17:24 -06:00
bootstraponline 67d21bcd64 Fix location. 2012-05-17 12:44:28 -06:00
bootstraponline 9b87126f0f Generate commit messages when using live preview. 2012-05-17 12:40:27 -06:00
Corey Donohoe 1043b4de70 Revert "Merge pull request #338 from jroes/resize-sha1s"
This reverts commit 4bc5e7b8ff, reversing
changes made to 423b5205bf.
2012-05-16 12:48:16 -07:00
Corey Donohoe 4bc5e7b8ff Merge pull request #338 from jroes/resize-sha1s
Fit generated SHA1 placeholders to original length.
2012-05-16 12:15:40 -07:00
bootstraponline 423b5205bf Fix language detection. 2012-05-15 11:49:55 -06:00
bootstraponline fde288d9e8 Guess highlight rules for code blocks to match gollum behavior. 2012-05-15 11:48:48 -06:00
bootstraponline f2a2d85008 Preserve whitespace in gollum code blocks. 2012-05-15 11:20:01 -06:00
bootstraponline 3a91b076e1 Fix gollum code blocks. 2012-05-15 11:06:36 -06:00
bootstraponline 27bd608b53 Update live preview title. 2012-05-15 10:37:38 -06:00
bootstraponline 966ba29084 Fix gollum style code blocks. 2012-05-15 10:12:32 -06:00
bootstraponline 3ea5b0193c Fix sanitizer to whitelist h1-6. 2012-05-15 09:59:15 -06:00
kristi 97dd1b3b00 Fix toc test 2012-05-14 17:01:39 -07:00
kristi fe0088d1ae Add TOC to readme file 2012-05-14 16:12:20 -07:00
kristi 342e1e22f8 Change link icon 2012-05-14 15:54:46 -07:00
kristi c9203047fc Make universal toc pretty too 2012-05-14 13:07:57 -07:00
kristi a3a946ccd6 Remove toc.rb; markup.rb handles toc processing 2012-05-14 13:06:46 -07:00
kristi 22564f34a9 Merge remote-tracking branch 'upstream/master' into toc 2012-05-14 10:44:50 -07:00
kristi f939c24aa4 Clear floats for footer 2012-05-14 10:25:31 -07:00
kristi be93fa747b Make TOC pretty. Also put in "[[_TOC_]]" stub for viewing sub-page directly 2012-05-14 10:23:12 -07:00
kristi d7f4eeea2c Merge remote-tracking branch 'upstream/master' into toc
Conflicts:
	lib/gollum/frontend/app.rb
	lib/gollum/markup.rb
	test/test_markup.rb
2012-05-14 09:12:44 -07:00
kristi 6191f60025 Fix tests for added example repo pages 2012-05-14 02:01:33 -07:00
kristi 82ccb0cedb add documentation comment 2012-05-14 02:01:06 -07:00
kristi eb92e4413a Add header files and TOC test files 2012-05-14 01:28:03 -07:00
kristi b0ba205532 Remove :header_hashtags option and adjust tests 2012-05-14 00:38:27 -07:00
kristi 4fa2cdf8d9 Allow sub pages to use the [[_TOC_]] tag 2012-05-13 22:19:55 -07:00
kristi ae30b23d34 insert a comment if no TOC headers found 2012-05-13 18:48:02 -07:00
kristi 1d3905bb71 Use special tag [[_TOC_]] to insert a table of contents 2012-05-13 12:44:20 -07:00
kristi aa1e845f9a create process_headers function to add anchors and create toc 2012-05-13 10:21:50 -07:00
Jonathan Roes fbcc69ec67 Tell Travis that the tests now depend on docutils. 2012-05-12 21:47:31 -04:00
Jonathan Roes 68b2de6dd7 Fit generated SHA1 placeholders to original length. 2012-05-12 21:05:42 -04:00
bootstraponline 20389babbc Merge pull request #336 from jroes/remove-links-in-code
Remove links in code, fixes #128.
2012-05-12 14:48:41 -07:00
Jonathan Roes f9899033aa Before replacing tags, ensure the SHA1 is not within preformatted content. 2012-05-12 17:29:23 -04:00
Jonathan Roes eb37b17486 Remove links in code, fixes #128. 2012-05-11 22:49:26 -04:00
bootstraponline c428cad286 Remove marker on no highlight pre tags. 2012-05-11 15:05:05 -06:00
kristi 26486da27b Use correct wiki option 2012-05-11 13:41:03 -07:00
kristi cabd0ed85e Add tests for new universal_toc and header_hashtags wiki options 2012-05-11 13:27:43 -07:00
kristi f53e1a60d5 Fix tests by adding a default_options hash to the wiki 2012-05-11 12:51:04 -07:00
kristi ec694e4a99 Fix option setting 2012-05-11 12:50:34 -07:00
Corey Donohoe 81e076c924 gemspec upgrade 2012-05-10 14:12:45 -07:00
Corey Donohoe 04070ffc23 bump gollum version 2012-05-10 14:12:36 -07:00
bootstraponline 6941d6b863 Restore title now that #308 is merged using github.com css. 2012-05-10 13:35:33 -06:00
bootstraponline 3c88f68f16 Fix relative links in live preview. 2012-05-10 12:25:26 -06:00
bootstraponline 82461da704 Merge pull request #334 from Skookum/selected-links
Grab selected text and use it as the default text when creating links.
2012-05-10 10:23:52 -07:00
Mark Rickert 8e5d17c907 Grab selected text and use it as the default text when creating links. 2012-05-10 13:16:52 -04:00
Tim Harvey 43d2143506 Redirect from root to /Home, fixes #250 2012-05-10 08:55:56 -04:00
kristi 28b729acda Add in some minimal documentation for wiki options 2012-05-10 00:38:35 -07:00
kristi 584641236b fixup toc/anchor code in markup.rb 2012-05-10 00:34:35 -07:00
kristi ca74897569 Add header_hashtag feature option: headers display a link icon when moused over so you can jump to sections
Move anchor processing into markup.rb
Use dashes for spaces in the anchor hashtag
2012-05-10 00:26:22 -07:00
kristi 61987c85d2 Add universal_toc wiki option 2012-05-09 16:13:53 -07:00
bootstraponline cfb75abeed Remove test file. 2012-05-09 16:27:59 -06:00
bootstraponline fd32706f0b Use pre tag for code in live preview. 2012-05-09 16:15:48 -06:00
bootstraponline d1f90b7d44 Merge branch 'master' of github.com:github/gollum 2012-05-09 16:09:30 -06:00
kristi f09bc4a81a Fix editor bug - displaying wrong version of header/footer/sidebar
Use most recent version; not the version matching the page
2012-05-09 15:04:29 -07:00
bootstraponline 31b3aea282 Merge branch 'master' of github.com:github/gollum 2012-05-09 14:36:37 -06:00
bootstraponline 2e1d236e8e Enable previewframe scrolling. 2012-05-09 14:36:20 -06:00
kristi 065d06a98f Move toc calling code out of app; put in Page.toc_data
Page stores the formatted document parsed by Nokogiri
2012-05-09 13:33:54 -07:00
kristi 63107566ec add Toc to Gollum 2012-05-09 13:33:08 -07:00
bootstraponline 4f1dcea806 2012-05-09 14:28:32 -06:00
bootstraponline 5da1a2c611 2012-05-09 14:28:20 -06:00
bootstraponline 180a214e1f Merge pull request #311 from bootstraponline/livepreview
Live Preview.
2012-05-09 13:24:12 -07:00
kristi bb417c6975 Rename class to Toc 2012-05-09 12:18:24 -07:00
kristi 75c02475be Remove extensions namespace 2012-05-09 12:14:45 -07:00
bootstraponline 2fd07211d9 Update README.md 2012-05-09 12:06:05 -06:00
bootstraponline 128f3be596 Use template.css 2012-05-09 10:56:52 -06:00
bootstraponline 810333dbb7 Update link CSS to match github.com. 2012-05-09 10:24:12 -06:00
bootstraponline e465358ec0 Add Ubuntu asciidoc install commmand. 2012-05-09 10:03:38 -06:00
bootstraponline 2954ed84a0 Merge pull request #327 from arr2036/master
Pass :is_bare to Grit where appropriate.
2012-05-09 08:57:18 -07:00
Arran Cudbard-Bell b36cd8a68e Pass through :is_bare option from wiki_options, allows Gollum to work with gitolite 2012-05-09 16:12:00 +02:00
Arran Cudbard-Bell 8435daa598 Stop anchor highlighting 2012-05-09 15:37:42 +02:00
Arran Cudbard-Bell 38c943d564 Add supporting modifications to frontend and css 2012-05-09 15:07:01 +02:00
Arran Cudbard-Bell 8e89ec504f Initial commit of Nokogiri based TOC generator 2012-05-09 14:06:17 +02:00
Kristi a692ec1124 Merge pull request #326 from kristi/frontend-tweak
Frontend tweak: Add header to editor, small fixup for asciidoc css, add spacing to headers
2012-05-08 17:25:26 -07:00
kristi 4e5f2c9587 Add header to editor 2012-05-08 17:29:28 -07:00
kristi 1cc263acfb Make footer editor font normal sized 2012-05-08 17:22:39 -07:00
kristi 49c6534da6 Put asciidoc fix into template with the rest of the markup css
Also remove padding from the asciidoc code block so first line doesn't get indented
2012-05-08 17:11:02 -07:00
bootstraponline 02d3a3d7ec Clarify gemspec task desc. 2012-05-08 16:36:44 -06:00
kristi 1dbe49243c Give headers more headroom 2012-05-08 15:03:15 -07:00
kristi 2c12fb7ae8 Add missing semicolons 2012-05-08 15:02:52 -07:00
kristi 829c6debbd Merge remote-tracking branch 'upstream/master' into frontend-tweak 2012-05-08 14:58:32 -07:00
bootstraponline f2d3ed322e Merge pull request #325 from bootstraponline/ascii_css
Fix AsciiDoc CSS.
2012-05-08 12:40:57 -07:00
bootstraponline d90e7db497 Fix #278. 2012-05-08 13:39:21 -06:00
Corey Donohoe 26f372a36a this works on 1.9.3 now too 2012-05-08 12:25:03 -07:00
bootstraponline b037777f83 Fix spacing. 2012-05-08 13:18:46 -06:00
bootstraponline 35ce35b1e0 Default to empty edit window. 2012-05-08 13:15:09 -06:00
bootstraponline e1517c2907 Merge with upstream. 2012-05-08 13:13:36 -06:00
bootstraponline ed5f88daa0 Remove unused local var. 2012-05-08 13:05:49 -06:00
bootstraponline 4afda646f0 Merge pull request #324 from bootstraponline/windowsNote
Add windows filename invalid characters notice to readme.
2012-05-08 11:36:41 -07:00
bootstraponline e782538777 Add windows filename invalid notice to readme. 2012-05-08 12:17:36 -06:00
Corey Donohoe 4e86be86d9 Merge pull request #323 from kristi/frontend-tweak
Fix HR background
2012-05-07 21:22:29 -07:00
kristi 6c8cfcd7c2 Make code border darker 2012-05-07 20:47:04 -07:00
kristi 9fc7929665 uniform spacing for css 2012-05-07 20:47:04 -07:00
kristi d590bf7d64 Add images from github 2012-05-07 20:47:04 -07:00
kristi c0f653340e Fix urls 2012-05-07 20:47:04 -07:00
Corey Donohoe ac2bef083b Merge pull request #322 from kristi/header-feature
Header feature
2012-05-07 20:42:14 -07:00
kristi 42c7d0ca44 Fix crazy spacing (sorry, git blame, I couldn't stand it any longer) 2012-05-07 20:35:28 -07:00
kristi 8a8afcfb24 Put gray background on header, fix footer font size 2012-05-07 20:28:07 -07:00
kristi 5d259bb5aa Use markdown css formatting for header and footer 2012-05-07 20:09:59 -07:00
Corey Donohoe d2a24ed4bc Merge pull request #321 from bootstraponline/cleanUp
Remove unused local var.
2012-05-07 15:04:04 -07:00
bootstraponline efd2f49484 Remove unused local var. 2012-05-07 15:37:24 -06:00
Corey Donohoe 9d4d6ccca5 Merge remote-tracking branch 'bootstraponline/gollum2'
/cc @kristi is the css behaving on this? we had minor markup conflicts

Conflicts:
	lib/gollum/frontend/templates/page.mustache
2012-05-07 14:10:38 -07:00
Aman Gupta 218c894b5a Merge pull request #319 from bootstraponline/looseObject
Fix LooseObjectError by upgrading to grit 2.5.
2012-05-07 13:29:21 -07:00
bootstraponline 0dec522542 Fix LooseObjectError by upgrading to grit 2.5. See https://github.com/mojombo/grit/issues/65 2012-05-07 14:26:48 -06:00
bootstraponline 7fa6708483 Add _Header.md to revert.git. 2012-05-07 14:17:15 -06:00
kristi 33af47c282 Make code border darker 2012-05-07 00:22:24 -07:00
kristi 6b971e9e1b uniform spacing for css 2012-05-07 00:22:24 -07:00
kristi 50107504a6 Add images from github 2012-05-07 00:22:23 -07:00
kristi 2cb0c9fea6 Fix urls 2012-05-07 00:22:23 -07:00
Corey Donohoe dd7c2cc7f6 Merge pull request #317 from kristi/frontend-tweak
Frontend tweak
2012-05-06 17:00:16 -07:00
kristi 857ca14499 add bottom margin to wiki-page css 2012-05-06 16:37:29 -07:00
kristi f022b3fcde Use github markup for page and sidebar content 2012-05-06 16:37:29 -07:00
kristi 9470ff2dcc fix the sidebar editor 2012-05-06 16:37:28 -07:00
Corey Donohoe d817a4fdb6 fixup page versioning, fixes #174
Thanks @nealpoole and @arr2036
2012-05-06 13:30:23 -07:00
Corey Donohoe 19635b06cf gemspec updates 2012-05-06 12:08:25 -07:00
Corey Donohoe 872776660b next version will be 2.0 2012-05-06 12:08:12 -07:00
Corey Donohoe 9644d4b00e dupe sanitization attrs initialized by constants, fixes #200 2012-05-06 12:07:41 -07:00
bootstraponline 04579d7ae6 Update test. 2012-05-05 13:51:46 -06:00
bootstraponline e9a9eb1779 Add header. 2012-05-05 13:49:01 -06:00
Corey Donohoe 9a1dddaccf whitelist apt uri schemes, fixes #233 2012-05-05 11:56:01 -07:00
Corey Donohoe 4110ab5a82 Merge pull request #308 from bootstraponline/title
Title defined by filename only.
2012-05-04 15:35:32 -07:00
Corey Donohoe 5d1844e491 Merge pull request #313 from kristi/frontend-tweak
Fix searchbar scaling issue
2012-05-04 09:44:23 -07:00
kristi 6a126d46ee Fix searchbar scaling issue 2012-05-04 09:35:27 -07:00
kristi f834a0c84f searchbar fix for ie9 2012-05-04 09:24:20 -07:00
Corey Donohoe 9dfeb237e7 Merge pull request #312 from kristi/frontend-tweak
searchbar fix for ie9
2012-05-04 09:21:45 -07:00
Corey Donohoe b769ba2974 Merge pull request #310 from kristi/frontend-tweak
Frontend tweaks
2012-05-04 08:32:17 -07:00
Corey Donohoe fc1feb280f let's use 0.8.0 if at all 2012-05-04 08:25:01 -07:00
Corey Donohoe bface83af7 Merge pull request #309 from nricciar/master
Gollum using very old version of wikicloth
2012-05-04 08:24:14 -07:00
bootstraponline 9a89a16388 Update live preview and gemspec. 2012-05-03 17:22:34 -06:00
bootstraponline 7649abf86a Add encodeURIComponent. 2012-05-03 11:51:59 -06:00
bootstraponline b6ad97745d Use encodeURIComponent. 2012-05-03 11:49:41 -06:00
bootstraponline 92028e191d Remove console.log. 2012-05-03 11:13:27 -06:00
bootstraponline 7d4427a5d3 Add save and load. 2012-05-03 11:10:50 -06:00
Vicent Martí 2bea800a37 Proper ordering for markup processing, fixes #135
Code blocks get extracted first.
2012-05-02 18:53:41 -07:00
kristi 4c1ff7deb7 fixup the compare revisions page 2012-05-02 16:55:16 -07:00
bootstraponline 347260f17b Add livepreview (7f3ed651e4e4388977f9b3ce29ed1a995ff6d7a9). 2012-05-02 16:59:50 -06:00
bootstraponline 1086fba7da Only use live preview for editing markdown pages. 2012-05-02 16:58:49 -06:00
kristi 5a7cb129bb Fixup css styling for pages, editor, history 2012-05-02 15:52:15 -07:00
kristi b29d22e99b Make navbar flow nicely for narrow windows 2012-05-02 13:51:26 -07:00
David 12cf102543 removing hardcoded reference to old version of wikicloth 2012-05-02 20:45:46 +00:00
kristi 3d95730880 Fix navbar and searchbar css 2012-05-02 13:00:46 -07:00
bootstraponline c5d807dd58 Fix tests. 2012-05-02 12:13:18 -06:00
bootstraponline d40df79dce Title defined by filename only. 2012-05-02 12:05:57 -06:00
Corey Donohoe 3cfa297b49 hide the page title as before 2012-05-02 19:29:17 +02:00
Corey Donohoe e435769345 remove executable bit 2012-05-02 19:20:57 +02:00
bootstraponline 9a73877b3e Fix search bar and restore title. 2012-05-02 11:03:37 -06:00
Corey Donohoe e2cd8d93f4 Merge pull request #306 from pdeschen/master
README Installation requirements sub section for mathematical equations support
2012-05-01 16:33:51 -07:00
Corey Donohoe afc6ec468f bit of testing info 2012-05-02 01:33:15 +02:00
Corey Donohoe 391838cfc3 no more rbx 2012-05-02 01:25:52 +02:00
Corey Donohoe 36a11ded4f Merge pull request #304 from rwfowler/asciidocLinksWithTravis
Disable internal link processing for asciidoc
2012-05-01 16:10:51 -07:00
Corey Donohoe f540ef2e06 Merge pull request #305 from rwfowler/goForGreen
Fix the test_normalizes_commit_hash on Travis-CI
2012-05-01 16:04:39 -07:00
Corey Donohoe b061e0f859 2.0 is unnecessary 2012-05-02 00:49:44 +02:00
Corey Donohoe 4972fbbc7b this doesn't build on 1.9.x /cc @brianmario 2012-05-02 00:44:17 +02:00
Pascal Deschenes 1f318de812 add missing note about dvips in installation requirements sub section + associated section text 2012-05-01 18:15:01 -04:00
Pascal Deschenes 0ceeadd75b add installation requirements regarding mathematical equations support 2012-05-01 18:10:21 -04:00
Ryan Fowler b9dad32707 Fix the test_normalizes_commit_hash on Travis-CI 2012-05-01 17:02:50 -05:00
Ryan Fowler d1cf698b45 Disable internal link processing for asciidoc
asciidoc's representation of section identifiers interferes with
Gollum's page linking. This disables Gollum's page link tag
extraction for asciidoc files.

Adds "apt-get install -y asciidoc" to .travis.yml so tests pass
on @travis-ci.
2012-05-01 14:23:26 -05:00
Corey Donohoe 9dba3f9c58 Revert "Merge pull request #303 from rwfowler/asciidocLinks"
This reverts commit 8fbbe40300, reversing
changes made to b7fb4c5950.
2012-05-01 19:51:05 +02:00
Corey Donohoe 8fbbe40300 Merge pull request #303 from rwfowler/asciidocLinks
Fix for #52 - Disable internal link processing for asciidoc
2012-05-01 10:42:31 -07:00
Ryan Fowler f73c925ad9 Disable internal link processing for asciidoc
asciidoc's representation of section identifiers interferes with
Gollum's page linking. This disables Gollum's page link tag
extraction for asciidoc files.
2012-05-01 11:43:27 -05:00
Corey Donohoe b7fb4c5950 Merge pull request #302 from kristi/master
fix Rack config.ru documentation
2012-05-01 02:32:07 -07:00
kristi fed49bb98b Fix gollum_path in rack setup documentation 2012-05-01 01:37:17 -07:00
582 changed files with 131419 additions and 13549 deletions
+32
View File
@@ -0,0 +1,32 @@
# https://help.github.com/articles/dealing-with-line-endings
#
# For Mac & Linux
# git config --global core.autocrlf input
#
# For windows
# git config --global core.autocrlf true
#
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.txt text
*.md text
*.rb text
*.js text
*.html text
*.yml text
*.mustache text
*.css text
Rakefile text
Gemfile text
LICENSE text
COPYRIGHT text
gollum text
.gitattributes text
.gitignore text
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
+1
View File
@@ -4,3 +4,4 @@ pkg
.bundle
Gemfile.lock
*.gem
*.swp
+3 -5
View File
@@ -1,6 +1,4 @@
rvm:
- 1.8.7
- 1.9.2
- rbx-2.0
notifications:
disabled: true
- 1.9.3
before_install:
- sudo apt-get update
+2 -2
View File
@@ -1,4 +1,4 @@
source "http://rubygems.org"
source 'https://rubygems.org'
gemspec
gem "rake", "~> 0.9.2"
gem 'rake', '~> 10.0.3'
+4
View File
@@ -1,3 +1,7 @@
# 2.4.11 / 2013-01-08
* Numerous security issues have been fixed. Please update to `2.4.11`
# 1.4.0 / 2012-04-10
* Minor
+122 -401
View File
@@ -1,6 +1,10 @@
gollum -- A wiki built on top of Git
====================================
[![Gem Version](https://badge.fury.io/rb/gollum.png)](http://rubygems.org/gems/gollum)
[![Build Status](https://secure.travis-ci.org/gollum/gollum.png?branch=master)](http://travis-ci.org/gollum/gollum)
[![Dependency Status](https://gemnasium.com/gollum/gollum.png)](https://gemnasium.com/gollum/gollum)
## DESCRIPTION
Gollum is a simple wiki system built on top of Git that powers GitHub Wikis.
@@ -16,26 +20,41 @@ number of ways depending on your needs. You can edit your wiki locally:
Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
[TomDoc](http://tomdoc.org/) for inline documentation.
## SYSTEM REQUIREMENTS
- Python 2.5+ (2.7.3 recommended)
- Ruby 1.8.7+ (1.9.3 recommended)
- Unix like operating system (OS X, Ubuntu, Debian, and more)
- Will not work on Windows (because of [grit](https://github.com/github/grit))
## SECURITY
Don't enable `--custom-css` or `--custom-js` unless you trust every user who has the ability to edit the wiki.
A better solution with more security is being tracked in [#665](https://github.com/gollum/gollum/issues/665).
## INSTALLATION
The best way to install Gollum is with RubyGems:
$ [sudo] gem install gollum
```bash
$ [sudo] gem install gollum
```
If you're installing from source, you can use [Bundler][bundler] to pick up all the
gems:
$ bundle install
```bash
$ bundle install
```
In order to use the various formats that Gollum supports, you will need to
separately install the necessary dependencies for each format. You only need
to install the dependencies for the formats that you plan to use.
* [ASCIIDoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc`
* [ASCIIDoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc` on mac or `apt-get install -y asciidoc` on Ubuntu
* [Creole](http://wikicreole.org/) -- `gem install creole`
* [Markdown](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet`
* [GitHub Flavored Markdown](http://github.github.com/github-flavored-markdown/) -- `gem install github-markdown`
* [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown) -- `gem install github-markdown`
* [Org](http://orgmode.org/) -- `gem install org-ruby`
* [Pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
* [RDoc](http://rdoc.sourceforge.net/)
@@ -45,403 +64,34 @@ to install the dependencies for the formats that you plan to use.
[bundler]: http://gembundler.com/
## SYNTAX
Gollum supports a variety of formats and extensions (Markdown, MediaWiki, Textile, …).
On top of these formats Gollum lets you insert headers, footers, links, image, math and more.
Check out the [Gollum Wiki](https://github.com/gollum/gollum/wiki) for all of Gollum's formats and syntactic options.
## RUNNING
To view and edit your Gollum repository locally via the built in web
interface, simply install the Gollum gem, navigate to your repository via the
command line, and run the executable:
$ gollum
```bash
$ gollum
```
This will start up a web server running the Gollum frontend and you can view
and edit your wiki at http://localhost:4567. To get help on the command line
utility, you can run it like so:
$ gollum --help
```bash
$ gollum --help
```
## REPO STRUCTURE
A Gollum repository's contents are designed to be human editable. Page content
is written in `page files` and may be organized into directories any way you
choose. Special footers can be created in `footer files`. Other content
(images, PDFs, etc) may also be present and organized in the same way.
## PAGE FILES
Page files may be written in any format supported by
[GitHub-Markup](http://github.com/github/markup) (except roff). The
current list of formats and allowed extensions is:
* ASCIIDoc: .asciidoc
* Creole: .creole
* Markdown: .markdown, .mdown, .mkdn, .mkd, .md
* Org Mode: .org
* Pod: .pod
* RDoc: .rdoc
* ReStructuredText: .rest.txt, .rst.txt, .rest, .rst
* Textile: .textile
* MediaWiki: .mediawiki, .wiki
Gollum detects the page file format via the extension, so files must have one
of the supported extensions in order to be converted.
Page file names may contain any printable UTF-8 character except space
(U+0020) and forward slash (U+002F). If you commit a page file with any of
these characters in the name it will not be accessible via the web interface.
Even though page files may be placed in any directory, there is still only a
single namespace for page names, so all page files should have globally unique
names regardless of where they are located in the repository.
The special page file `Home.ext` (where the extension is one of the supported
formats) will be used as the entrance page to your wiki. If it is missing, an
automatically generated table of contents will be shown instead.
## SIDEBAR FILES
Sidebar files allow you to add a simple sidebar to your wiki. Sidebar files
are named `_Sidebar.ext` where the extension is one of the supported formats.
Sidebars affect all pages in their directory and any subdirectories that do not
have a sidebar file of their own.
## FOOTER FILES
Footer files allow you to add a simple footer to your wiki. Footer files must
be named `_Footer.ext` where the extension is one of the supported formats.
Like sidebars, footers affect all pages in their directory and any
subdirectories that do not have a footer file of their own.
## HTML SANITIZATION
For security and compatibility reasons Gollum wikis may not contain custom CSS
or JavaScript. These tags will be stripped from the converted HTML. See
`docs/sanitization.md` for more details on what tags and attributes are
allowed.
## BRACKET TAGS
A variety of Gollum tags use a double bracket syntax. For example:
[[Link]]
Some tags will accept attributes which are separated by pipe symbols. For
example:
[[Link|Page Title]]
In all cases, the first thing in the link is what is displayed on the page.
So, if the tag is an internal wiki link, the first thing in the tag will be
the link text displayed on the page. If the tag is an embedded image, the
first thing in the tag will be a path to an image file. Use this trick to
easily remember which order things should appear in tags.
Some formats, such as MediaWiki, support the opposite syntax:
[[Page Title|Link]]
## PAGE LINKS
To link to another Gollum wiki page, use the Gollum Page Link Tag.
[[Frodo Baggins]]
The above tag will create a link to the corresponding page file named
`Frodo-Baggins.ext` where `ext` may be any of the allowed extension types. The
conversion is as follows:
1. Replace any spaces (U+0020) with dashes (U+002D)
2. Replace any slashes (U+002F) with dashes (U+002D)
If you'd like the link text to be something that doesn't map directly to the
page name, you can specify the actual page name after a pipe:
[[Frodo|Frodo Baggins]]
The above tag will link to `Frodo-Baggins.ext` using "Frodo" as the link text.
The page file may exist anywhere in the directory structure of the repository.
Gollum does a breadth first search and uses the first match that it finds.
Here are a few more examples:
[[J. R. R. Tolkien]] -> J.-R.-R.-Tolkien.ext
[[Movies / The Hobbit]] -> Movies---The-Hobbit.ext
[[モルドール]] -> モルドール.ext
## EXTERNAL LINKS
As a convenience, simple external links can be placed within brackets and they
will be linked to the given URL with the URL as the link text. For example:
[[http://example.com]]
External links must begin with either "http://" or "https://". If you need
something more flexible, you can resort to the link syntax in the page's
underlying markup format.
## ABSOLUTE VS. RELATIVE VS. EXTERNAL PATH
For Gollum tags that operate on static files (images, PDFs, etc), the paths
may be referenced as either relative, absolute, or external. Relative paths
point to a static file relative to the page file within the directory
structure of the Gollum repo (even though after conversion, all page files
appear to be top level). These paths are NOT prefixed with a slash. For
example:
gollum.pdf
docs/diagram.png
Absolute paths point to a static file relative to the Gollum repo's
root, regardless of where the page file is stored within the directory
structure. These paths ARE prefixed with a slash. For example:
/pdfs/gollum.pdf
/docs/diagram.png
External paths are full URLs. An external path must begin with either
"http://" or "https://". For example:
http://example.com/pdfs/gollum.pdf
http://example.com/images/diagram.png
All of the examples in this README use relative paths, but you may use
whatever works best in your situation.
## FILE LINKS
To link to static files that are contained in the Gollum repository you should
use the Gollum File Link Tag.
[[Gollum|gollum.pdf]]
The first part of the tag is the link text. The path to the file appears after
the pipe.
## IMAGES
To display images that are contained in the Gollum repository you should use
the Gollum Image Tag. This will display the actual image on the page.
[[gollum.png]]
In addition to the simple format, there are a variety of options that you
can specify between pipe delimiters.
To specify alt text, use the `alt=` option. Default is no alt text.
[[gollum.png|alt=Gollum and his precious wiki]]
To place the image in a frame, use the `frame` option. When combined with the
`alt=` option, the alt text will be used as a caption as well. Default is no
frame.
[[gollum.png|frame|alt=Gollum and his precious wiki]]
To specify the alignment of the image on the page, use the `align=` option.
Possible values are `left`, `center`, and `right`. Default is `left`.
[[gollum.png|align=center]]
To float an image so that text flows around it, use the `float` option. When
`float` is specified, only `left` and `right` are valid `align` options.
Default is not floating. When floating is activated but no alignment is
specified, default alignment is `left`.
[[gollum.png|float]]
To specify a max-width, use the `width=` option. Units must be specified in
either `px` or `em`.
[[gollum.png|width=400px]]
To specify a max-height, use the `height=` option. Units must be specified in
either `px` or `em`.
[[gollum.png|height=300px]]
Any of these options may be composed together by simply separating them with
pipes.
## ESCAPING GOLLUM TAGS
If you need the literal text of a wiki or static link to show up in your final
wiki page, simply preface the link with a single quote (like in LISP):
'[[Page Link]]
'[[File Link|file.pdf]]
'[[image.jpg]]
This is useful for writing about the link syntax in your wiki pages.
## SYNTAX HIGHLIGHTING
In page files you can get automatic syntax highlighting for a wide range of
languages (courtesy of [Pygments](http://pygments.org/) - must install
separately) by using the following syntax:
```ruby
def foo
puts 'bar'
end
```
The block must start with three backticks, at the beginning of a line or
indented with any number of spaces or tabs.
After that comes the name of the language that is contained by the
block. The language must be one of the `short name` lexer strings supported by
Pygments. See the [list of lexers](http://pygments.org/docs/lexers/) for valid
options.
The block contents should be indented at the same level than the opening backticks.
If the block contents are indented with an additional two spaces or one tab,
then that whitespace will be ignored (this makes the blocks easier to read in plaintext).
The block must end with three backticks indented at the same level than the opening
backticks.
## MATHEMATICAL EQUATIONS
Page files may contain mathematic equations in TeX syntax that will be nicely
typeset into the expected output. A block-style equation is delimited by `\[`
and `\]`. For example:
\[ P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
Inline equations are delimited by `\(` and `\)`. These equations will appear
inline with regular text. For example:
The Pythagorean theorem is \( a^2 + b^2 = c^2 \).
## SEQUENCE DIAGRAMS
You may imbed sequence diagrams into your wiki page (rendered by
[WebSequenceDiagrams](http://www.websequencediagrams.com) by using the
following syntax:
{{{ blue-modern
alice->bob: Test
bob->alice: Test response
}}}
You can replace the string "blue-modern" with any supported style.
## API DOCUMENTATION
The Gollum API allows you to retrieve raw or formatted wiki content from a Git
repository, write new content to the repository, and collect various meta data
about the wiki as a whole.
Initialize the Gollum::Repo object:
# Require rubygems if necessary
require 'rubygems'
# Require the Gollum library
require 'gollum'
# Create a new Gollum::Wiki object by initializing it with the path to the
# Git repository.
wiki = Gollum::Wiki.new("my-gollum-repo.git")
# => <Gollum::Wiki>
By default, internal wiki links are all absolute from the root. To specify a different base path, you can specify the `:base_path` option:
wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
Get the latest version of the given human or canonical page name:
page = wiki.page('page-name')
# => <Gollum::Page>
page.raw_data
# => "# My wiki page"
page.formatted_data
# => "<h1>My wiki page</h1>"
page.format
# => :markdown
vsn = page.version
# => <Grit::Commit>
vsn.id
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
Get the footer (if any) for a given page:
page.footer
# => <Gollum::Page>
Get a list of versions for a given page:
vsns = wiki.page('page-name').versions
# => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
vsns.first.id
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
vsns.first.authored_date
# => Sun Mar 28 19:11:21 -0700 2010
Get a specific version of a given canonical page file:
wiki.page('page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
Get the latest version of a given static file:
file = wiki.file('asset.js')
# => <Gollum::File>
file.raw_data
# => "alert('hello');"
file.version
# => <Grit::Commit>
Get a specific version of a given static file:
wiki.file('asset.js', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
Get an in-memory Page preview (useful for generating previews for web
interfaces):
preview = wiki.preview_page("My Page", "# Contents", :markdown)
preview.formatted_data
# => "<h1>Contents</h1>"
Methods that write to the repository require a Hash of commit data that takes
the following form:
commit = { :message => 'commit message',
:name => 'Tom Preston-Werner',
:email => 'tom@github.com' }
Write a new version of a page (the file will be created if it does not already
exist) and commit the change. The file will be written at the repo root.
wiki.write_page('Page Name', :markdown, 'Page contents', commit)
Update an existing page. If the format is different than the page's current
format, the file name will be changed to reflect the new format.
page = wiki.page('Page Name')
wiki.update_page(page, page.name, page.format, 'Page contents', commit)
To delete a page and commit the change:
wiki.delete_page(page, commit)
Note that the gollum server will not run on Windows because of [an issue](https://github.com/rtomayko/posix-spawn/issues/9) with posix-spawn (which is used by Grit).
### RACK
@@ -449,19 +99,43 @@ You can also run gollum with any rack-compatible server by placing this config.r
file inside your wiki repository. This allows you to utilize any Rack middleware
like Rack::Auth, OmniAuth, etc.
#!/usr/bin/env ruby
require 'rubygems'
require 'gollum/frontend/app'
```ruby
#!/usr/bin/env ruby
require 'rubygems'
require 'gollum/app'
gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:default_markup, :markdown) # set your favorite markup language
Precious::App.set(:wiki_options, {:universal_toc => false})
run Precious::App
```
Your Rack middleware can pass author details to Gollum in a Hash in the session under the 'gollum.author' key.
## CONFIG FILE
Gollum optionally takes a `--config file`. See [config.rb](https://github.com/gollum/gollum/blob/master/config.rb) for an example.
## CUSTOM CSS/JS
The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page.
The `--js` flag will inject `custom.js` from the root of your git repository into each page. `custom.js` must be commited to git or you will get a 302 redirect to the create page.
## API DOCUMENTATION
The [Gollum API](https://github.com/gollum/gollum-lib/) allows you to retrieve
raw or formatted wiki content from a Git repository, write new content to the
repository, and collect various meta data about the wiki as a whole.
gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
Precious::App.set(:default_markup, :markdown) # set your favorite markup language
run Precious::App
## CONTRIBUTE
If you'd like to hack on Gollum, start by forking my repo on GitHub:
If you'd like to hack on Gollum, start by forking the repo on GitHub:
http://github.com/github/gollum
http://github.com/gollum/gollum
To get all of the dependencies, install the gem first. The best way to get
your changes merged back into core is as follows:
@@ -474,10 +148,57 @@ your changes merged back into core is as follows:
1. Do not change the version number, I will do that on my end
1. If necessary, rebase your commits into logical chunks, without errors
1. Push the branch up to GitHub
1. Send a pull request to the github/gollum project.
1. Send a pull request to the gollum/gollum project.
## RELEASING
$ rake gemspec
$ gem build gollum.gemspec
$ gem push gollum-X.Y.Z.gem
Gollum uses [Semantic Versioning](http://semver.org/).
x.y.z
For z releases:
```bash
$ rake bump
$ rake release
```
For x.y releases:
```bash
Update VERSION in lib/gollum.rb
$ rake gemspec
$ rake release
```
## BUILDING THE GEM FROM MASTER
```bash
$ gem uninstall -aIx gollum
$ git clone https://github.com/gollum/gollum.git
$ cd gollum
gollum$ rake build
gollum$ gem install --no-ri --no-rdoc pkg/gollum*.gem
```
## RUN THE TESTS
```bash
$ bundle install
$ bundle exec rake test
```
## WORK WITH TEST REPOS
An example of how to add a test file to the bare repository lotr.git.
```bash
$ mkdir tmp; cd tmp
$ git clone ../lotr.git/ .
Cloning into '.'...
done.
$ git log
$ echo "test" > test.md
$ git add . ; git commit -am "Add test"
$ git push ../lotr.git/ master
```
+33 -4
View File
@@ -17,6 +17,27 @@ def version
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
end
# assumes x.y.z all digit version
def next_version
# x.y.z
v = version.split '.'
# bump z
v[-1] = v[-1].to_i + 1
v.join '.'
end
def bump_version
old_file = File.read("lib/#{name}.rb")
old_version_line = old_file[/^\s*VERSION\s*=\s*.*/]
new_version = next_version
# replace first match of old vesion with new version
old_file.sub!(old_version_line, " VERSION = '#{new_version}'")
File.write("lib/#{name}.rb", old_file)
new_version
end
def date
Date.today.to_s
end
@@ -71,7 +92,14 @@ end
#
#############################################################################
desc "Update version number and gemspec"
task :bump do
puts "Updated version to #{bump_version}"
# Execute does not invoke dependencies.
# Manually invoke gemspec then validate.
Rake::Task[:gemspec].execute
Rake::Task[:validate].execute
end
#############################################################################
#
@@ -86,6 +114,7 @@ task :release => :build do
exit!
end
sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git pull"
sh "git tag v#{version}"
sh "git push origin master"
sh "git push origin v#{version}"
@@ -99,7 +128,7 @@ task :build => :gemspec do
sh "mv #{gem_file} pkg"
end
desc 'Validate gemspec'
desc 'Update gemspec'
task :gemspec => :validate do
# read spec file and split out manifest section
spec = File.read(gemspec_file)
@@ -117,7 +146,7 @@ task :gemspec => :validate do
split("\n").
sort.
reject { |file| file =~ /^\./ }.
reject { |file| file =~ /^(rdoc|pkg)/ }.
reject { |file| file =~ /^(rdoc|pkg|test|Home\.md|\.gitattributes)/ }.
map { |file| " #{file}" }.
join("\n")
@@ -139,4 +168,4 @@ task :validate do
puts "A `VERSION` file at root level violates Gem best practices."
exit!
end
end
end
+84 -4
View File
@@ -19,7 +19,10 @@ require 'gollum'
exec = {}
options = { 'port' => 4567, 'bind' => '0.0.0.0' }
wiki_options = {}
wiki_options = {
:live_preview => false,
:allow_uploads => false,
}
opts = OptionParser.new do |opts|
opts.banner = help
@@ -45,13 +48,60 @@ opts = OptionParser.new do |opts|
options['irb'] = true
end
opts.on("--css", "Inject custom css. Uses custom.css from root repository") do
wiki_options[:css] = true
end
opts.on("--js", "Inject custom js. Uses custom.js from root repository") do
wiki_options[:js] = true
end
opts.on("--page-file-dir [PATH]", "Specify the sub directory for all page files (default: repository root).") do |path|
wiki_options[:page_file_dir] = path
end
opts.on("--base-path [PATH]", "Specify the base path.") do |path|
wiki_options[:base_path] = path
end
opts.on("--gollum-path [PATH]", "Specify the gollum path.") do |path|
wiki_options[:gollum_path] = path
end
opts.on("--ref [REF]", "Specify the repository ref to use (default: master).") do |ref|
wiki_options[:ref] = ref
end
opts.on("--no-live-preview", "Disables livepreview.") do
wiki_options[:live_preview] = false
end
opts.on("--live-preview", "Enables livepreview.") do
wiki_options[:live_preview] = true
end
opts.on("--allow-uploads", "Allows file uploads.") do
wiki_options[:allow_uploads] = true
end
opts.on("--mathjax", "Enables mathjax.") do
wiki_options[:mathjax] = true
end
opts.on("--user-icons [SOURCE]", "Set the history user icons. Valid values: gravatar, identicon, none. Default: none.") do |source|
wiki_options[:user_icons] = source
end
opts.on("--show-all", "Shows all files in file view. By default only valid pages are shown.") do
wiki_options[:show_all] = true
end
opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
wiki_options[:collapse_tree] = true
end
opts.on("--h1-title", "Sets page title to value of first h1") do
wiki_options[:h1_title] = true
end
end
# Read command line options into `options` hash
@@ -63,7 +113,10 @@ rescue OptionParser::InvalidOption
exit
end
gollum_path = ARGV[0] || Dir.pwd
# --gollum-path wins over ARGV[0]
gollum_path = wiki_options[:gollum_path] ?
wiki_options[:gollum_path] :
ARGV[0] || Dir.pwd
if options['irb']
require 'irb'
@@ -91,6 +144,7 @@ if options['irb']
end
begin
require 'gollum-lib'
wiki = Gollum::Wiki.new(gollum_path, wiki_options)
if !wiki.exist? then raise Grit::InvalidGitRepositoryError end
puts "Loaded Gollum wiki at #{File.expand_path(gollum_path).inspect}."
@@ -111,7 +165,7 @@ if options['irb']
exit 0
end
else
require 'gollum/frontend/app'
require 'gollum/app'
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:wiki_options, wiki_options)
@@ -122,5 +176,31 @@ else
require cfg
end
Precious::App.run!(options)
base_path = wiki_options[:base_path]
if wiki_options[:base_path].nil?
Precious::App.run!(options)
else
require 'rack'
class MapGollum
def initialize base_path
@mg = Rack::Builder.new do
map '/' do
run Proc.new { [ 302, {'Location'=> "/#{base_path}" }, [] ] }
end
map "/#{base_path}" do
run Precious::App
end
end
end
def call(env)
@mg.call(env)
end
end
# Rack::Handler does not work with Ctrl + C. Use Rack::Server instead.
Rack::Server.new(:app => MapGollum.new(base_path), :Port => options['port'], :Host => options['bind']).start
end
end
+28
View File
@@ -0,0 +1,28 @@
# Example gollum config
# gollum ../wiki --config config.rb
#
# or run from source with
#
# bundle exec bin/gollum ../wiki/ --config config.rb
# Remove const to avoid
# warning: already initialized constant FORMAT_NAMES
#
# only remove if it's defined.
# constant Gollum::Page::FORMAT_NAMES not defined (NameError)
Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
# limit to one format
Gollum::Page::FORMAT_NAMES = { :markdown => "Markdown" }
=begin
Valid formats are:
{ :markdown => "Markdown",
:textile => "Textile",
:rdoc => "RDoc",
:org => "Org-mode",
:creole => "Creole",
:rest => "reStructuredText",
:asciidoc => "AsciiDoc",
:mediawiki => "MediaWiki",
:pod => "Pod" }
=end
+498 -184
View File
@@ -2,18 +2,20 @@ Gem::Specification.new do |s|
s.specification_version = 2 if s.respond_to? :specification_version=
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.rubygems_version = '1.3.5'
s.required_ruby_version = ">= 1.9"
s.name = 'gollum'
s.version = '1.4.3'
s.date = '2012-04-25'
s.version = '2.5.0'
s.date = '2013-07-21'
s.rubyforge_project = 'gollum'
s.license = 'MIT'
s.summary = "A simple, Git-powered wiki."
s.description = "A simple, Git-powered wiki with a sweet API and local frontend."
s.authors = ["Tom Preston-Werner", "Rick Olson"]
s.email = 'tom@github.com'
s.homepage = 'http://github.com/github/gollum'
s.homepage = 'http://github.com/gollum/gollum'
s.require_paths = %w[lib]
@@ -22,201 +24,513 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.extra_rdoc_files = %w[README.md LICENSE]
s.add_dependency('grit', "~> 2.4.1")
s.add_dependency('github-markup', [">= 0.7.0", "< 1.0.0"])
s.add_dependency('github-markdown')
s.add_dependency('pygments.rb', "~> 0.2.0")
s.add_dependency('posix-spawn', "~> 0.3.0")
s.add_dependency('sinatra', "~> 1.0")
s.add_dependency('mustache', [">= 0.11.2", "< 1.0.0"])
s.add_dependency('sanitize', "~> 2.0.0")
s.add_dependency('nokogiri', "~> 1.4")
s.add_dependency 'gollum-lib', '~> 1.0.4'
s.add_dependency 'sinatra', '~> 1.4.2'
s.add_dependency 'mustache', ['>= 0.99.4', '< 1.0.0']
s.add_dependency 'useragent', '~> 0.6.0'
s.add_development_dependency('RedCloth')
s.add_development_dependency('mocha')
s.add_development_dependency('org-ruby', '~>0.6.2')
s.add_development_dependency('shoulda')
s.add_development_dependency('rack-test')
s.add_development_dependency('wikicloth', '~> 0.6.3')
s.add_development_dependency('rake', '~> 0.9.2')
s.add_development_dependency 'rack-test', '~> 0.6.2'
s.add_development_dependency 'shoulda', ['>= 3.4.0', '< 3.5.0']
s.add_development_dependency 'minitest-reporters', '~> 0.14.16'
# = MANIFEST =
s.files = %w[
Gemfile
HISTORY.md
Home.md
LICENSE
README.md
Rakefile
bin/gollum
config.rb
docs/sanitization.md
gollum.gemspec
lib/gollum.rb
lib/gollum/blob_entry.rb
lib/gollum/committer.rb
lib/gollum/file.rb
lib/gollum/frontend/app.rb
lib/gollum/frontend/public/gollum/css/dialog.css
lib/gollum/frontend/public/gollum/css/editor.css
lib/gollum/frontend/public/gollum/css/gollum.css
lib/gollum/frontend/public/gollum/css/ie7.css
lib/gollum/frontend/public/gollum/css/template.css
lib/gollum/frontend/public/gollum/images/icon-sprite.png
lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js
lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js
lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js
lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js
lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js
lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js
lib/gollum/frontend/public/gollum/javascript/editor/langs/rdoc.js
lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js
lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js
lib/gollum/frontend/public/gollum/javascript/gollum.js
lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
lib/gollum/frontend/public/gollum/javascript/jquery.color.js
lib/gollum/frontend/public/gollum/javascript/jquery.js
lib/gollum/frontend/templates/compare.mustache
lib/gollum/frontend/templates/create.mustache
lib/gollum/frontend/templates/edit.mustache
lib/gollum/frontend/templates/editor.mustache
lib/gollum/frontend/templates/error.mustache
lib/gollum/frontend/templates/history.mustache
lib/gollum/frontend/templates/layout.mustache
lib/gollum/frontend/templates/page.mustache
lib/gollum/frontend/templates/pages.mustache
lib/gollum/frontend/templates/search.mustache
lib/gollum/frontend/templates/searchbar.mustache
lib/gollum/frontend/views/compare.rb
lib/gollum/frontend/views/create.rb
lib/gollum/frontend/views/edit.rb
lib/gollum/frontend/views/editable.rb
lib/gollum/frontend/views/error.rb
lib/gollum/frontend/views/history.rb
lib/gollum/frontend/views/layout.rb
lib/gollum/frontend/views/page.rb
lib/gollum/frontend/views/pages.rb
lib/gollum/frontend/views/search.rb
lib/gollum/git_access.rb
lib/gollum/markup.rb
lib/gollum/page.rb
lib/gollum/pagination.rb
lib/gollum/sanitization.rb
lib/gollum/tex.rb
lib/gollum/web_sequence_diagram.rb
lib/gollum/wiki.rb
lib/gollum/app.rb
lib/gollum/helpers.rb
lib/gollum/public/gollum/css/_styles.css
lib/gollum/public/gollum/css/dialog.css
lib/gollum/public/gollum/css/editor.css
lib/gollum/public/gollum/css/gollum.css
lib/gollum/public/gollum/css/ie7.css
lib/gollum/public/gollum/css/template.css
lib/gollum/public/gollum/images/dirty-shade.png
lib/gollum/public/gollum/images/fileview/document.png
lib/gollum/public/gollum/images/fileview/folder-horizontal.png
lib/gollum/public/gollum/images/fileview/toggle-small-expand.png
lib/gollum/public/gollum/images/fileview/toggle-small.png
lib/gollum/public/gollum/images/icon-sprite.png
lib/gollum/public/gollum/images/man_24.png
lib/gollum/public/gollum/images/para.png
lib/gollum/public/gollum/images/pin-16.png
lib/gollum/public/gollum/images/pin-20.png
lib/gollum/public/gollum/images/pin-24.png
lib/gollum/public/gollum/images/pin-32.png
lib/gollum/public/gollum/javascript/editor/gollum.editor.js
lib/gollum/public/gollum/javascript/editor/langs/asciidoc.js
lib/gollum/public/gollum/javascript/editor/langs/creole.js
lib/gollum/public/gollum/javascript/editor/langs/markdown.js
lib/gollum/public/gollum/javascript/editor/langs/org.js
lib/gollum/public/gollum/javascript/editor/langs/pod.js
lib/gollum/public/gollum/javascript/editor/langs/rdoc.js
lib/gollum/public/gollum/javascript/editor/langs/textile.js
lib/gollum/public/gollum/javascript/gollum.dialog.js
lib/gollum/public/gollum/javascript/gollum.js
lib/gollum/public/gollum/javascript/gollum.placeholder.js
lib/gollum/public/gollum/javascript/identicon_canvas.js
lib/gollum/public/gollum/javascript/jquery-1.7.2.min.js
lib/gollum/public/gollum/javascript/jquery.color.js
lib/gollum/public/gollum/javascript/mousetrap.min.js
lib/gollum/public/gollum/livepreview/css/custom.css
lib/gollum/public/gollum/livepreview/images/cancel_24.png
lib/gollum/public/gollum/livepreview/images/globe_24.png
lib/gollum/public/gollum/livepreview/images/lr_24.png
lib/gollum/public/gollum/livepreview/images/save_24.png
lib/gollum/public/gollum/livepreview/images/savecomment_24.png
lib/gollum/public/gollum/livepreview/index.html
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ace.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/anchor.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/anchor_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/config.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/config_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/css/editor.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/document.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/document_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold_line.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/folding.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor_change_document_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor_highlight_selected_word_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor_navigation_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor_text_edit_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/static.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/textarea.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/hash_handler.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/textinput.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/commands.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/aliases.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/motions.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/operators.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/util.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/registers.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/cursor.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/gutter.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/text.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/text_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/browser_focus.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/dom.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/es5-shim.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/event.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/fixoldbrowsers.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/keys.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/lang.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/net.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/package.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/test_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_javascript.txt
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c9search.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c_cpp.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_clojure.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coffee.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coldfusion.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_csharp.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_css.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_diff.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_glsl.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_golang.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_groovy.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_haxe.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_html.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_java.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_javascript.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_json.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_jsx.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_latex.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_less.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_liquid.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_lua.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_luapage.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_markdown.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ocaml.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_perl.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_pgsql.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_php.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_powershell.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_python.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ruby.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scad.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scala.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scss.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sh.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sql.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_svg.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_tcl.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_text.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_textile.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xml.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xquery.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_yaml.json
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/abap.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/abap_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xml.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xquery.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c9search.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c9search_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/clojure.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/clojure_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/helpers.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/lexer.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/nodes.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/rewriter.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/scope.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_worker.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/csharp.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/csharp_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css/csslint.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/dart.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/dart_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/asciidoc.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/diff.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/latex.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/lua.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/markdown.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/glsl.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/glsl_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haml.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haml_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jade.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jade_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/java.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript/jshint.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json/json_parse.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsp.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsp_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/latex_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/less.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/less_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lisp.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lisp_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lucene.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/makefile.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/makefile_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/perl_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/php.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/php_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/powershell.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/powershell_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/python.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/r.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/r_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scad.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scad_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scala.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scala_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scss.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scss_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sh.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/stylus.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/stylus_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tcl.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tcl_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tex.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tex_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/text.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/typescript.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/typescript_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/JSONParseTreeHandler.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/visitors/SyntaxHighlighter.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/yaml_highlight_rules.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/model/editor.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/default_gutter_handler.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/default_handlers.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/fold_handler.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_event.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_handler.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/multi_select.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/placeholder.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range_list.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range_list_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/renderloop.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/requirejs/text.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/scrollbar.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/search.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/search_highlight.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/search_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/selection.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/selection_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/split.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/all.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/all_browser.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/assertions.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/assert.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/async.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/index.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/utils.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/benchmark.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/tests.html
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/github.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/github.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.css
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/tokenizer_dev.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/undomanager.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/unicode.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js
lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/worker_sourcemint.js
lib/gollum/public/gollum/livepreview/js/jquery.ba-throttle-debounce.min.js
lib/gollum/public/gollum/livepreview/js/livepreview.js
lib/gollum/public/gollum/livepreview/js/md_sundown.js
lib/gollum/public/gollum/livepreview/js/requirejs.min.js
lib/gollum/public/gollum/livepreview/js/sundown.js
lib/gollum/public/gollum/livepreview/licenses/ace/LICENSE.txt
lib/gollum/public/gollum/livepreview/licenses/bootstraponline_gollum/LICENSE.txt
lib/gollum/public/gollum/livepreview/licenses/debounce/LICENSE-MIT.txt
lib/gollum/public/gollum/livepreview/licenses/gollum/LICENSE.txt
lib/gollum/public/gollum/livepreview/licenses/jquery/MIT-LICENSE.txt
lib/gollum/public/gollum/livepreview/licenses/licenses.txt
lib/gollum/public/gollum/livepreview/licenses/notepages/LICENSE.txt
lib/gollum/public/gollum/livepreview/licenses/requirejs/LICENSE.txt
lib/gollum/public/gollum/livepreview/licenses/retina_display_icon_set/by_sa_3.0_unported_legalcode.txt
lib/gollum/public/gollum/livepreview/licenses/sizzle/LICENSE.txt
lib/gollum/public/gollum/livepreview/licenses/sundown/sundown.txt
lib/gollum/public/gollum/livepreview/licenses/templarian_windowsicons/license.txt
lib/gollum/public/gollum/livepreview/readme.md
lib/gollum/templates/compare.mustache
lib/gollum/templates/create.mustache
lib/gollum/templates/edit.mustache
lib/gollum/templates/editor.mustache
lib/gollum/templates/error.mustache
lib/gollum/templates/file_view.mustache
lib/gollum/templates/history.mustache
lib/gollum/templates/history_authors/gravatar.mustache
lib/gollum/templates/history_authors/identicon.mustache
lib/gollum/templates/history_authors/none.mustache
lib/gollum/templates/layout.mustache
lib/gollum/templates/page.mustache
lib/gollum/templates/pages.mustache
lib/gollum/templates/search.mustache
lib/gollum/templates/searchbar.mustache
lib/gollum/uri_encode_component.rb
lib/gollum/views/compare.rb
lib/gollum/views/create.rb
lib/gollum/views/edit.rb
lib/gollum/views/editable.rb
lib/gollum/views/error.rb
lib/gollum/views/file_view.rb
lib/gollum/views/has_page.rb
lib/gollum/views/history.rb
lib/gollum/views/layout.rb
lib/gollum/views/page.rb
lib/gollum/views/pages.rb
lib/gollum/views/search.rb
licenses/css_tree_menu_thecssninja/license.txt
licenses/licenses.txt
licenses/unity_asset_pool/COPYRIGHT
templates/formatting.html
test/examples/empty.git/HEAD
test/examples/empty.git/config
test/examples/empty.git/description
test/examples/empty.git/hooks/applypatch-msg.sample
test/examples/empty.git/hooks/commit-msg.sample
test/examples/empty.git/hooks/post-commit.sample
test/examples/empty.git/hooks/post-receive.sample
test/examples/empty.git/hooks/post-update.sample
test/examples/empty.git/hooks/pre-applypatch.sample
test/examples/empty.git/hooks/pre-commit.sample
test/examples/empty.git/hooks/pre-rebase.sample
test/examples/empty.git/hooks/prepare-commit-msg.sample
test/examples/empty.git/hooks/update.sample
test/examples/empty.git/info/exclude
test/examples/empty.git/objects/info/.gitkeep
test/examples/empty.git/objects/pack/.gitkeep
test/examples/empty.git/refs/heads/.gitkeep
test/examples/lotr.git/COMMIT_EDITMSG
test/examples/lotr.git/HEAD
test/examples/lotr.git/ORIG_HEAD
test/examples/lotr.git/config
test/examples/lotr.git/description
test/examples/lotr.git/index
test/examples/lotr.git/info/exclude
test/examples/lotr.git/logs/HEAD
test/examples/lotr.git/logs/refs/heads/master
test/examples/lotr.git/objects/06/131480411710c92a82fe2d1e76932c70feb2e5
test/examples/lotr.git/objects/0a/de1e2916346d4c1f2fb63b863fd3c16808fe44
test/examples/lotr.git/objects/0e/d8cbe0a25235bd867e65193c7d837c66b328ef
test/examples/lotr.git/objects/12/629d666c5e3178f82f533f543d61b53dc78c0b
test/examples/lotr.git/objects/1d/b89ebba7e2c14d93b94ff98cfa3708a4f0d4e3
test/examples/lotr.git/objects/24/49c2681badfd3c189e8ed658dacffe8ba48fe5
test/examples/lotr.git/objects/25/4bdc1ba27d8b8a794538a8522d9a2b56ec2dd9
test/examples/lotr.git/objects/2c/b9156ad383914561a8502fc70f5a1d887e48ad
test/examples/lotr.git/objects/5d/cac289a8603188d2c5caf481dcba2985126aaa
test/examples/lotr.git/objects/60/f12f4254f58801b9ee7db7bca5fa8aeefaa56b
test/examples/lotr.git/objects/71/4323c104239440a5c66ab12a67ed07a83c404f
test/examples/lotr.git/objects/84/0ec5b1ba1320e8ec443f28f99566f615d5af10
test/examples/lotr.git/objects/93/6b83ee0dd8837adb82511e40d5e4ebe59bb675
test/examples/lotr.git/objects/94/523d7ae48aeba575099dd12926420d8fd0425d
test/examples/lotr.git/objects/96/97dc65e095658bbd1b8e8678e08881e86d32f1
test/examples/lotr.git/objects/a3/1ca2a7c352c92531a8b99815d15843b259e814
test/examples/lotr.git/objects/a6/59b3763b822dd97544621fd0beef162ea37b14
test/examples/lotr.git/objects/a8/ad3c09dd842a3517085bfadd37718856dee813
test/examples/lotr.git/objects/aa/b61fe89d56f8614c0a8151da34f939dcedfa68
test/examples/lotr.git/objects/bc/4b5fc0ce2c2ba3acef6647e4f67256ee45ab60
test/examples/lotr.git/objects/c3/b43e9f08966b088e7a0192e436b7a884542e05
test/examples/lotr.git/objects/dc/596d6b2dd89ab05c66f4abd7d5eb706bc17f19
test/examples/lotr.git/objects/ec/da3205bee14520aab5a7bb307392064b938e83
test/examples/lotr.git/objects/f4/84ebb1f40f8eb20d1bcd8d1d71934d2b8ae961
test/examples/lotr.git/objects/fa/e7ef5344202bba4129abdc13060d9297d99465
test/examples/lotr.git/objects/info/packs
test/examples/lotr.git/objects/pack/pack-dcbeaf3f6ff6c5eb08ea2b0a2d83626e8763546b.idx
test/examples/lotr.git/objects/pack/pack-dcbeaf3f6ff6c5eb08ea2b0a2d83626e8763546b.pack
test/examples/lotr.git/packed-refs
test/examples/lotr.git/refs/heads/master
test/examples/lotr.git/refs/remotes/origin/HEAD
test/examples/page_file_dir.git/COMMIT_EDITMSG
test/examples/page_file_dir.git/HEAD
test/examples/page_file_dir.git/config
test/examples/page_file_dir.git/description
test/examples/page_file_dir.git/index
test/examples/page_file_dir.git/info/exclude
test/examples/page_file_dir.git/logs/HEAD
test/examples/page_file_dir.git/logs/refs/heads/master
test/examples/page_file_dir.git/objects/0c/7d27db1f575263efdcab3dc650f4502a2dbcbf
test/examples/page_file_dir.git/objects/22/b404803c966dd92865614d86ff22ca12e50c1e
test/examples/page_file_dir.git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99
test/examples/page_file_dir.git/objects/57/16ca5987cbf97d6bb54920bea6adde242d87e6
test/examples/page_file_dir.git/objects/5b/43e14e0a15fb6f08feab1773d1c0991e9f71e2
test/examples/page_file_dir.git/refs/heads/master
test/examples/revert.git/COMMIT_EDITMSG
test/examples/revert.git/HEAD
test/examples/revert.git/config
test/examples/revert.git/description
test/examples/revert.git/index
test/examples/revert.git/info/exclude
test/examples/revert.git/logs/HEAD
test/examples/revert.git/logs/refs/heads/master
test/examples/revert.git/objects/20/2ced67cea93c7b6bd2928aa1daef8d1d55a20d
test/examples/revert.git/objects/41/76394bfa11222363c66ce7e84b5f154095b6d9
test/examples/revert.git/objects/6a/69f92020f5df77af6e8813ff1232493383b708
test/examples/revert.git/objects/b4/785957bc986dc39c629de9fac9df46972c00fc
test/examples/revert.git/objects/f4/03b791119f8232b7cb0ba455c624ac6435f433
test/examples/revert.git/objects/info/packs
test/examples/revert.git/objects/pack/pack-a561f8437234f74d0bacb9e0eebe52d207f5770d.idx
test/examples/revert.git/objects/pack/pack-a561f8437234f74d0bacb9e0eebe52d207f5770d.pack
test/examples/revert.git/packed-refs
test/examples/revert.git/refs/heads/master
test/examples/revert.git/refs/remotes/origin/HEAD
test/examples/yubiwa.git/HEAD
test/examples/yubiwa.git/config
test/examples/yubiwa.git/description
test/examples/yubiwa.git/info/exclude
test/examples/yubiwa.git/objects/10/fa2ddc4e3b4009d8a453aace10bd6148c1ad00
test/examples/yubiwa.git/objects/52/4b82874327ea7cbf730389964ba7cb3de966de
test/examples/yubiwa.git/objects/58/3fc201cb457fb3f1480f3e1e5999b119633835
test/examples/yubiwa.git/objects/87/bc1dd46ab3d3874d4e898d45dd512cc20a7cc8
test/examples/yubiwa.git/objects/89/64ed1b4e21aa90e831763bbce9034bfda81b70
test/examples/yubiwa.git/objects/9f/f6dd0660da5fba2d3374adb2b84fa653bb538b
test/examples/yubiwa.git/objects/ac/e97abf2b177815a1972d7db22f229f58c83309
test/examples/yubiwa.git/objects/b1/f443863a4816628807fbf86141ebef055dda34
test/examples/yubiwa.git/refs/heads/master
test/helper.rb
test/test_app.rb
test/test_committer.rb
test/test_file.rb
test/test_git_access.rb
test/test_markup.rb
test/test_page.rb
test/test_page_revert.rb
test/test_wiki.rb
templates/helper_wiki.rb
]
# = MANIFEST =
+9 -13
View File
@@ -1,5 +1,7 @@
# ~*~ encoding: utf-8 ~*~
# stdlib
require 'digest/md5'
require 'digest/sha1'
require 'ostruct'
# external
@@ -8,23 +10,17 @@ require 'github/markup'
require 'sanitize'
# internal
require File.expand_path('../gollum/git_access', __FILE__)
require File.expand_path('../gollum/committer', __FILE__)
require File.expand_path('../gollum/pagination', __FILE__)
require File.expand_path('../gollum/blob_entry', __FILE__)
require File.expand_path('../gollum/wiki', __FILE__)
require File.expand_path('../gollum/page', __FILE__)
require File.expand_path('../gollum/file', __FILE__)
require File.expand_path('../gollum/markup', __FILE__)
require File.expand_path('../gollum/sanitization', __FILE__)
require File.expand_path('../gollum/tex', __FILE__)
require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
require File.expand_path('../gollum/uri_encode_component', __FILE__)
# Set ruby to UTF-8 mode
# This is required for Ruby 1.8.7 which gollum still supports.
$KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
module Gollum
VERSION = '1.4.3'
VERSION = '2.5.0'
def self.assets_path
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
end
class Error < StandardError; end
+497
View File
@@ -0,0 +1,497 @@
# ~*~ encoding: utf-8 ~*~
require 'cgi'
require 'sinatra'
require 'gollum-lib'
require 'mustache/sinatra'
require 'useragent'
require 'stringex'
require 'gollum'
require 'gollum/views/layout'
require 'gollum/views/editable'
require 'gollum/views/has_page'
require File.expand_path '../helpers', __FILE__
#required to upload bigger binary files
Grit::Git.git_timeout = 120 # timeout in secs
Grit::Git.git_max_size = 190 * 10**6 # size in bytes (10^6=1 MB)
# Fix to_url
class String
alias :upstream_to_url :to_url
# _Header => header which causes errors
def to_url
return nil if self.nil?
upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar']
end
end
# Run the frontend, based on Sinatra
#
# There are a number of wiki options that can be set for the frontend
#
# Example
# require 'gollum/app'
# Precious::App.set(:wiki_options, {
# :universal_toc => false,
# }
#
# See the wiki.rb file for more details on wiki options
module Precious
class App < Sinatra::Base
register Mustache::Sinatra
include Precious::Helpers
dir = File.dirname(File.expand_path(__FILE__))
# Detect unsupported browsers.
Browser = Struct.new(:browser, :version)
@@min_ua = [
Browser.new('Internet Explorer', '10.0'),
Browser.new('Chrome', '7.0'),
Browser.new('Firefox', '4.0'),
]
def supported_useragent?(user_agent)
ua = UserAgent.parse(user_agent)
@@min_ua.detect {|min| ua >= min }
end
# We want to serve public assets for now
set :public_folder, "#{dir}/public/gollum"
set :static, true
set :default_markup, :markdown
set :mustache, {
# Tell mustache where the Views constant lives
:namespace => Precious,
# Mustache templates live here
:templates => "#{dir}/templates",
# Tell mustache where the views are
:views => "#{dir}/views"
}
# Sinatra error handling
configure :development, :staging do
enable :show_exceptions, :dump_errors
disable :raise_errors, :clean_trace
end
configure :test do
enable :logging, :raise_errors, :dump_errors
end
before do
@base_url = url('/', false).chomp('/')
# above will detect base_path when it's used with map in a config.ru
settings.wiki_options.merge!({ :base_path => @base_url })
@css = settings.wiki_options[:css]
@js = settings.wiki_options[:js]
end
get '/' do
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect clean_url(::File.join(@base_url, page_dir, wiki_new.index_page))
end
# path is set to name if path is nil.
# if path is 'a/b' and a and b are dirs, then
# path must have a trailing slash 'a/b/' or
# extract_path will trim path to 'a'
# name, path, version
def wiki_page(name, path = nil, version = nil, exact = true)
wiki = wiki_new
path = name if path.nil?
name = extract_name(name) || wiki.index_page
path = extract_path(path)
path = '/' if exact && path.nil?
OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),
:name => name, :path => path)
end
def wiki_new
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
end
get '/data/*' do
if page = wiki_page(params[:splat].first).page
page.raw_data
end
end
get '/edit/*' do
wikip = wiki_page(params[:splat].first)
@name = wikip.name
@path = wikip.path
wiki = wikip.wiki
if page = wikip.page
if wiki.live_preview && page.format.to_s.include?('markdown') && supported_useragent?(request.user_agent)
live_preview_url = '/livepreview/index.html?page=' + encodeURIComponent(@name)
if @path
live_preview_url << '&path=' + encodeURIComponent(@path)
end
redirect to(live_preview_url)
else
@page = page
@page.version = wiki.repo.log(wiki.ref, @page.path).first
raw_data = page.raw_data
@content = raw_data.respond_to?(:force_encoding) ? raw_data.force_encoding('UTF-8') : raw_data
mustache :edit
end
else
redirect to("/create/#{encodeURIComponent(@name)}")
end
end
post '/uploadFile' do
wiki = wiki_new
unless wiki.allow_uploads
@message = "File uploads are disabled"
mustache :error
return
end
if params[:file]
fullname = params[:file][:filename]
tempfile = params[:file][:tempfile]
end
dir = 'uploads'
ext = ::File.extname(fullname)
format = ext.split('.').last || 'txt'
filename = ::File.basename(fullname, ext)
contents = ::File.read(tempfile)
reponame = filename + '.' + format
head = wiki.repo.head
options = {
:message => "Uploaded file to uploads/#{reponame}",
:parent => wiki.repo.head.commit,
}
author = session['gollum.author']
unless author.nil?
options.merge! author
end
begin
committer = Gollum::Committer.new(wiki, options)
committer.add_to_index(dir, filename, format, contents)
committer.after_commit do |committer, sha|
wiki.clear_cache
committer.update_working_dir(dir, filename, format)
end
committer.commit
redirect to('/')
rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}"
mustache :error
end
end
post '/rename/*' do
wikip = wiki_page(params[:splat].first)
halt 500 if wikip.nil?
wiki = wikip.wiki
page = wiki.paged(wikip.name, wikip.path, exact = true)
rename = params[:rename]
halt 500 if page.nil?
halt 500 if rename.nil? or rename.empty?
# Fixup the rename if it is a relative path
# In 1.8.7 rename[0] != rename[0..0]
if rename[0..0] != '/'
source_dir = ::File.dirname(page.path)
source_dir = '' if source_dir == '.'
(target_dir, target_name) = ::File.split(rename)
target_dir = target_dir == '' ? source_dir : "#{source_dir}/#{target_dir}"
rename = "#{target_dir}/#{target_name}"
end
committer = Gollum::Committer.new(wiki, commit_message)
commit = {:committer => committer}
success = wiki.rename_page(page, rename, commit)
if !success
# This occurs on NOOPs, for example renaming A => A
redirect to("/#{page.escaped_url_path}")
return
end
committer.commit
wikip = wiki_page(rename)
page = wiki.paged(wikip.name, wikip.path, exact = true)
return if page.nil?
redirect to("/#{page.escaped_url_path}")
end
post '/edit/*' do
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
page_name = CGI.unescape(params[:page])
wiki = wiki_new
page = wiki.paged(page_name, path, exact = true)
return if page.nil?
committer = Gollum::Committer.new(wiki, commit_message)
commit = {:committer => committer}
update_wiki_page(wiki, page, params[:content], commit, page.name, params[:format])
update_wiki_page(wiki, page.header, params[:header], commit) if params[:header]
update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
committer.commit
redirect to("/#{page.escaped_url_path}") unless page.nil?
end
get '/delete/*' do
wikip = wiki_page(params[:splat].first)
name = wikip.name
wiki = wikip.wiki
page = wikip.page
wiki.delete_page(page, { :message => "Destroyed #{name} (#{page.format})" })
redirect to('/')
end
get '/create/*' do
wikip = wiki_page(params[:splat].first.gsub('+', '-'))
@name = wikip.name.to_url
@path = wikip.path
page_dir = settings.wiki_options[:page_file_dir].to_s
unless page_dir.empty?
# --page-file-dir docs
# /docs/Home should be created in /Home
# not /docs/Home because write_page will append /docs
@path = @path.sub(page_dir, '/') if @path.start_with? page_dir
end
@path = clean_path(@path)
page = wikip.page
if page
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect to("/#{clean_url(::File.join(page_dir, page.escaped_url_path))}")
else
mustache :create
end
end
post '/create' do
name = params[:page].to_url
path = sanitize_empty_params(params[:path]) || ''
format = params[:format].intern
wiki = wiki_new
begin
wiki.write_page(name, format, params[:content], commit_message, path)
page_dir = settings.wiki_options[:page_file_dir].to_s
redirect to("/#{clean_url(::File.join(page_dir, path, name))}")
rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}"
mustache :error
end
end
post '/revert/:page/*' do
wikip = wiki_page(params[:page])
@path = wikip.path
@name = wikip.name
wiki = wikip.wiki
@page = wiki.paged(@name,@path)
shas = params[:splat].first.split("/")
sha1 = shas.shift
sha2 = shas.shift
commit = commit_message
commit[:message] = "Revert commit #{sha1.chars.take(7).join}"
if wiki.revert_page(@page, sha1, sha2, commit)
redirect to("/#{@page.escaped_url_path}")
else
sha2, sha1 = sha1, "#{sha1}^" if !sha2
@versions = [sha1, sha2]
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@diff = diffs.first
@message = "The patch does not apply."
mustache :compare
end
end
post '/preview' do
wiki = wiki_new
@name = params[:page] || "Preview"
@page = wiki.preview_page(@name, params[:content], params[:format])
@content = @page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@h1_title = wiki.h1_title
@editable = false
@allow_uploads = wiki.allow_uploads
mustache :page
end
get '/history/*' do
@page = wiki_page(params[:splat].first).page
@page_num = [params[:page].to_i, 1].max
@versions = @page.versions :page => @page_num
mustache :history
end
post '/compare/*' do
@file = params[:splat].first
@versions = params[:versions] || []
if @versions.size < 2
redirect to("/history/#{@file}")
else
redirect to("/compare/%s/%s...%s" % [
@file,
@versions.last,
@versions.first]
)
end
end
get %r{
/compare/ # match any URL beginning with /compare/
(.+) # extract the full path (including any directories)
/ # match the final slash
([^.]+) # match the first SHA1
\.{2,3} # match .. or ...
(.+) # match the second SHA1
}x do |path, start_version, end_version|
wikip = wiki_page(path)
@path = wikip.path
@name = wikip.name
@versions = [start_version, end_version]
wiki = wikip.wiki
@page = wikip.page
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@diff = diffs.first
mustache :compare
end
get %r{/(.+?)/([0-9a-f]{40})} do
file_path = params[:captures][0]
version = params[:captures][1]
wikip = wiki_page(file_path, file_path, version)
name = wikip.name
path = wikip.path
if page = wikip.page
@page = page
@name = name
@content = page.formatted_data
mustache :page
else
halt 404
end
end
get '/search' do
@query = params[:q]
wiki = wiki_new
# Sort wiki search results by count (desc) and then by name (asc)
@results = wiki.search(@query).sort{ |a, b| (a[:count] <=> b[:count]).nonzero? || b[:name] <=> a[:name] }.reverse
@name = @query
mustache :search
end
get %r{
/pages # match any URL beginning with /pages
(?: # begin an optional non-capturing group
/(.+) # capture any path after the "/pages" excluding the leading slash
)? # end the optional non-capturing group
}x do |path|
@path = extract_path(path) if path
wiki_options = settings.wiki_options.merge({ :page_file_dir => @path })
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
@results = wiki.pages
@results += wiki.files if settings.wiki_options[:show_all]
@ref = wiki.ref
mustache :pages
end
get '/fileview' do
wiki = wiki_new
options = settings.wiki_options
content = wiki.pages
# if showing all files include wiki.files
content += wiki.files if options[:show_all]
# must pass wiki_options to FileView
# --show-all and --collapse-tree can be set.
@results = Gollum::FileView.new(content, options).render_files
@ref = wiki.ref
mustache :file_view, { :layout => false }
end
get '/*' do
show_page_or_file(params[:splat].first)
end
def show_page_or_file(fullpath)
wiki = wiki_new
name = extract_name(fullpath) || wiki.index_page
path = extract_path(fullpath) || '/'
if page = wiki.paged(name, path, exact = true)
@page = page
@name = name
@content = page.formatted_data
# Extensions and layout data
@editable = true
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@h1_title = wiki.h1_title
@bar_side = wiki.bar_side
@allow_uploads = wiki.allow_uploads
mustache :page
elsif file = wiki.file(fullpath, wiki.ref, true)
if file.on_disk?
send_file file.on_disk_path, :disposition => 'inline'
else
content_type file.mime_type
file.raw_data
end
else
page_path = [path, name].compact.join('/')
redirect to("/create/#{clean_url(encodeURIComponent(page_path))}")
end
end
def update_wiki_page(wiki, page, content, commit, name = nil, format = nil)
return if !page ||
((!content || page.raw_data == content) && page.format == format)
name ||= page.name
format = (format || page.format).to_sym
content ||= page.raw_data
wiki.update_page(page, name, format, content.to_s, commit)
end
private
# Options parameter to Gollum::Committer#initialize
# :message - The String commit message.
# :name - The String author full name.
# :email - The String email address.
# message is sourced from the incoming request parameters
# author details are sourced from the session, to be populated by rack middleware ahead of us
def commit_message
msg = (params[:message].nil? or params[:message].empty?) ? "[no message]" : params[:message]
commit_message = { :message => msg }
author_parameters = session['gollum.author']
commit_message.merge! author_parameters unless author_parameters.nil?
commit_message
end
end
end
-78
View File
@@ -1,78 +0,0 @@
module Gollum
class BlobEntry
# Gets the String SHA for this blob.
attr_reader :sha
# Gets the full path String for this blob.
attr_reader :path
# Gets the Fixnum size of this blob.
attr_reader :size
def initialize(sha, path, size = nil)
@sha = sha
@path = path
@size = size
@dir = @name = @blob = nil
end
# Gets the normalized directory path String for this blob.
def dir
@dir ||= self.class.normalize_dir(::File.dirname(@path))
end
# Gets the file base name String for this blob.
def name
@name ||= ::File.basename(@path)
end
# Gets a Grit::Blob instance for this blob.
#
# repo - Grit::Repo instance for the Grit::Blob.
#
# Returns an unbaked Grit::Blob instance.
def blob(repo)
@blob ||= Grit::Blob.create(repo,
:id => @sha, :name => name, :size => @size)
end
# Gets a Page instance for this blob.
#
# wiki - Gollum::Wiki instance for the Gollum::Page
#
# Returns a Gollum::Page instance.
def page(wiki, commit)
blob = self.blob(wiki.repo)
page = wiki.page_class.new(wiki).populate(blob, self.dir)
page.version = commit
page
end
def inspect
%(#<Gollum::BlobEntry #{@sha} #{@path}>)
end
# Normalizes a given directory name for searching through tree paths.
# Ensures that a directory begins with a slash, or
#
# normalize_dir("") # => ""
# normalize_dir(".") # => ""
# normalize_dir("foo") # => "/foo"
# normalize_dir("/foo/") # => "/foo"
# normalize_dir("/") # => ""
# normalize_dir("c:/") # => ""
#
# dir - String directory name.
#
# Returns a normalized String directory name, or nil if no directory
# is given.
def self.normalize_dir(dir)
return '' if dir =~ /^.:\/$/
if dir
dir = ::File.expand_path(dir, '/')
dir = '' if dir == '/'
end
dir
end
end
end
-218
View File
@@ -1,218 +0,0 @@
module Gollum
# Responsible for handling the commit process for a Wiki. It sets up the
# Git index, provides methods for modifying the tree, and stores callbacks
# to be fired after the commit has been made. This is specifically
# designed to handle multiple updated pages in a single commit.
class Committer
# Gets the instance of the Gollum::Wiki that is being updated.
attr_reader :wiki
# Gets a Hash of commit options.
attr_reader :options
# Initializes the Committer.
#
# wiki - The Gollum::Wiki instance that is being updated.
# options - The commit Hash details:
# :message - The String commit message.
# :name - The String author full name.
# :email - The String email address.
# :parent - Optional Grit::Commit parent to this update.
# :tree - Optional String SHA of the tree to create the
# index from.
# :committer - Optional Gollum::Committer instance. If provided,
# assume that this operation is part of batch of
# updates and the commit happens later.
#
# Returns the Committer instance.
def initialize(wiki, options = {})
@wiki = wiki
@options = options
@callbacks = []
end
# Public: References the Git index for this commit.
#
# Returns a Grit::Index.
def index
@index ||= begin
idx = @wiki.repo.index
if tree = options[:tree]
idx.read_tree(tree)
elsif parent = parents.first
idx.read_tree(parent.tree.id)
end
idx
end
end
# Public: The committer for this commit.
#
# Returns a Grit::Actor.
def actor
@actor ||= begin
@options[:name] = @wiki.default_committer_name if @options[:name].to_s.empty?
@options[:email] = @wiki.default_committer_email if @options[:email].to_s.empty?
Grit::Actor.new(@options[:name], @options[:email])
end
end
# Public: The parent commits to this pending commit.
#
# Returns an array of Grit::Commit instances.
def parents
@parents ||= begin
arr = [@options[:parent] || @wiki.repo.commit(@wiki.ref)]
arr.flatten!
arr.compact!
arr
end
end
# Adds a page to the given Index.
#
# dir - The String subdirectory of the Gollum::Page without any
# prefix or suffix slashes (e.g. "foo/bar").
# name - The String Gollum::Page filename_stripped.
# format - The Symbol Gollum::Page format.
# data - The String wiki data to store in the tree map.
# allow_same_ext - A Boolean determining if the tree map allows the same
# filename with the same extension.
#
# Raises Gollum::DuplicatePageError if a matching filename already exists.
# This way, pages are not inadvertently overwritten.
#
# Returns nothing (modifies the Index in place).
def add_to_index(dir, name, format, data, allow_same_ext = false)
path = @wiki.page_file_name(name, format)
dir = '/' if dir.strip.empty?
fullpath = ::File.join(*[@wiki.page_file_dir, dir, path].compact)
fullpath = fullpath[1..-1] if fullpath =~ /^\//
if index.current_tree && tree = index.current_tree / dir
downpath = path.downcase.sub(/\.\w+$/, '')
tree.blobs.each do |blob|
next if page_path_scheduled_for_deletion?(index.tree, fullpath)
file = blob.name.downcase.sub(/\.\w+$/, '')
file_ext = ::File.extname(blob.name).sub(/^\./, '')
if downpath == file && !(allow_same_ext && file_ext == ext)
raise DuplicatePageError.new(dir, blob.name, path)
end
end
end
index.add(fullpath, @wiki.normalize(data))
end
# Update the given file in the repository's working directory if there
# is a working directory present.
#
# dir - The String directory in which the file lives.
# name - The String name of the page or the stripped filename
# (should be pre-canonicalized if required).
# format - The Symbol format of the page.
#
# Returns nothing.
def update_working_dir(dir, name, format)
unless @wiki.repo.bare
if @wiki.page_file_dir
dir = dir.size.zero? ? @wiki.page_file_dir : ::File.join(dir, @wiki.page_file_dir)
end
path =
if dir == ''
@wiki.page_file_name(name, format)
else
::File.join(dir, @wiki.page_file_name(name, format))
end
Dir.chdir(::File.join(@wiki.repo.path, '..')) do
if file_path_scheduled_for_deletion?(index.tree, path)
@wiki.repo.git.rm({'f' => true}, '--', path)
else
@wiki.repo.git.checkout({}, 'HEAD', '--', path)
end
end
end
end
# Writes the commit to Git and runs the after_commit callbacks.
#
# Returns the String SHA1 of the new commit.
def commit
sha1 = index.commit(@options[:message], parents, actor, nil, @wiki.ref)
@callbacks.each do |cb|
cb.call(self, sha1)
end
sha1
end
# Adds a callback to be fired after a commit.
#
# block - A block that expects this Committer instance and the created
# commit's SHA1 as the arguments.
#
# Returns nothing.
def after_commit(&block)
@callbacks << block
end
# Determine if a given page (regardless of format) is scheduled to be
# deleted in the next commit for the given Index.
#
# map - The Hash map:
# key - The String directory or filename.
# val - The Hash submap or the String contents of the file.
# path - The String path of the page file. This may include the format
# extension in which case it will be ignored.
#
# Returns the Boolean response.
def page_path_scheduled_for_deletion?(map, path)
parts = path.split('/')
if parts.size == 1
deletions = map.keys.select { |k| !map[k] }
downfile = parts.first.downcase.sub(/\.\w+$/, '')
deletions.any? { |d| d.downcase.sub(/\.\w+$/, '') == downfile }
else
part = parts.shift
if rest = map[part]
page_path_scheduled_for_deletion?(rest, parts.join('/'))
else
false
end
end
end
# Determine if a given file is scheduled to be deleted in the next commit
# for the given Index.
#
# map - The Hash map:
# key - The String directory or filename.
# val - The Hash submap or the String contents of the file.
# path - The String path of the file including extension.
#
# Returns the Boolean response.
def file_path_scheduled_for_deletion?(map, path)
parts = path.split('/')
if parts.size == 1
deletions = map.keys.select { |k| !map[k] }
deletions.any? { |d| d == parts.first }
else
part = parts.shift
if rest = map[part]
file_path_scheduled_for_deletion?(rest, parts.join('/'))
else
false
end
end
end
# Proxies methods t
def method_missing(name, *args)
index.send(name, *args)
end
end
end
-64
View File
@@ -1,64 +0,0 @@
module Gollum
class File
Wiki.file_class = self
# Public: Initialize a file.
#
# wiki - The Gollum::Wiki in question.
#
# Returns a newly initialized Gollum::File.
def initialize(wiki)
@wiki = wiki
@blob = nil
@path = nil
end
# Public: The on-disk filename of the file.
#
# Returns the String name.
def name
@blob && @blob.name
end
# Public: The raw contents of the page.
#
# Returns the String data.
def raw_data
@blob && @blob.data
end
# Public: The Grit::Commit version of the file.
attr_reader :version
# Public: The String path of the file.
attr_reader :path
# Public: The String mime type of the file.
def mime_type
@blob.mime_type
end
#########################################################################
#
# Internal Methods
#
#########################################################################
# Find a file in the given Gollum repo.
#
# name - The full String path.
# version - The String version ID to find.
#
# Returns a Gollum::File or nil if the file could not be found.
def find(name, version)
checked = name.downcase
map = @wiki.tree_map_for(version)
if entry = map.detect { |entry| entry.path.downcase == checked }
@path = name
@blob = entry.blob(@wiki.repo)
@version = version.is_a?(Grit::Commit) ? version : @wiki.commit_for(version)
self
end
end
end
end
-221
View File
@@ -1,221 +0,0 @@
require 'cgi'
require 'sinatra'
require 'gollum'
require 'mustache/sinatra'
require 'gollum/frontend/views/layout'
require 'gollum/frontend/views/editable'
module Precious
class App < Sinatra::Base
register Mustache::Sinatra
dir = File.dirname(File.expand_path(__FILE__))
# We want to serve public assets for now
set :public_folder, "#{dir}/public/gollum"
set :static, true
set :default_markup, :markdown
set :mustache, {
# Tell mustache where the Views constant lives
:namespace => Precious,
# Mustache templates live here
:templates => "#{dir}/templates",
# Tell mustache where the views are
:views => "#{dir}/views"
}
# Sinatra error handling
configure :development, :staging do
enable :show_exceptions, :dump_errors
disable :raise_errors, :clean_trace
end
configure :test do
enable :logging, :raise_errors, :dump_errors
end
get '/' do
show_page_or_file('Home')
end
get '/edit/*' do
@name = params[:splat].first
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
if page = wiki.page(@name)
@page = page
@content = page.raw_data
mustache :edit
else
mustache :create
end
end
post '/edit/*' do
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
page = wiki.page(params[:splat].first)
name = params[:rename] || page.name
committer = Gollum::Committer.new(wiki, commit_message)
commit = {:committer => committer}
update_wiki_page(wiki, page, params[:content], commit, name,
params[:format])
update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
committer.commit
redirect "/#{CGI.escape(Gollum::Page.cname(name))}"
end
post '/create' do
name = params[:page]
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
format = params[:format].intern
begin
wiki.write_page(name, format, params[:content], commit_message)
redirect "/#{CGI.escape(Gollum::Page.cname(name))}"
rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}"
mustache :error
end
end
post '/revert/:page/*' do
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@name = params[:page]
@page = wiki.page(@name)
shas = params[:splat].first.split("/")
sha1 = shas.shift
sha2 = shas.shift
if wiki.revert_page(@page, sha1, sha2, commit_message)
redirect "/#{CGI.escape(@name)}"
else
sha2, sha1 = sha1, "#{sha1}^" if !sha2
@versions = [sha1, sha2]
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@diff = diffs.first
@message = "The patch does not apply."
mustache :compare
end
end
post '/preview' do
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@name = "Preview"
@page = wiki.preview_page(@name, params[:content], params[:format])
@content = @page.formatted_data
@editable = false
mustache :page
end
get '/history/:name' do
@name = params[:name]
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@page = wiki.page(@name)
@page_num = [params[:page].to_i, 1].max
@versions = @page.versions :page => @page_num
mustache :history
end
post '/compare/:name' do
@versions = params[:versions] || []
if @versions.size < 2
redirect "/history/#{CGI.escape(params[:name])}"
else
redirect "/compare/%s/%s...%s" % [
CGI.escape(params[:name]),
@versions.last,
@versions.first]
end
end
get '/compare/:name/:version_list' do
@name = params[:name]
@versions = params[:version_list].split(/\.{2,3}/)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@page = wiki.page(@name)
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@diff = diffs.first
mustache :compare
end
get '/_tex.png' do
content_type 'image/png'
formula = Base64.decode64(params[:data])
Gollum::Tex.render_formula(formula)
end
get %r{^/(javascript|css|images)} do
halt 404
end
get %r{/(.+?)/([0-9a-f]{40})} do
name = params[:captures][0]
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
if page = wiki.page(name, params[:captures][1])
@page = page
@name = name
@content = page.formatted_data
@editable = true
mustache :page
else
halt 404
end
end
get '/search' do
@query = params[:q]
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@results = wiki.search @query
@name = @query
mustache :search
end
get '/pages' do
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@results = wiki.pages
@ref = wiki.ref
mustache :pages
end
get '/*' do
show_page_or_file(params[:splat].first)
end
def show_page_or_file(name)
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
if page = wiki.page(name)
@page = page
@name = name
@content = page.formatted_data
@editable = true
mustache :page
elsif file = wiki.file(name)
content_type file.mime_type
file.raw_data
else
@name = name
mustache :create
end
end
def update_wiki_page(wiki, page, content, commit_message, name = nil, format = nil)
return if !page ||
((!content || page.raw_data == content) && page.format == format)
name ||= page.name
format = (format || page.format).to_sym
content ||= page.raw_data
wiki.update_page(page, name, format, content.to_s, commit_message)
end
def commit_message
{ :message => params[:message] }
end
end
end
@@ -1,660 +0,0 @@
#wiki-wrapper #template blockquote {
margin: 1em 0;
border-left: 4px solid #ddd;
padding-left: .8em;
color: #555;
}
/*
gollum.css
A basic stylesheet for Gollum
*/
/* @section core */
body, html {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 10px;
margin: 0;
padding: 0;
}
#wiki-wrapper {
margin: 0 auto;
overflow: visible;
width: 80%;
}
a:link {
color: #4183c4;
text-decoration: none;
}
a:hover, a:visited {
color: #4183c4;
text-decoration: underline;
}
/* @section head */
#head {
margin: 4.5em 0 0.5em;
padding: 0.5em 0;
overflow: hidden;
}
#head h1 {
display: none;
}
#head ul.actions {
float: right;
}
/* @section content */
#wiki-content {
height: 1%;
overflow: visible;
}
#wiki-content .wrap {
height: 1%;
overflow: auto;
}
/* @section comments */
#wiki-body #inline-comment {
display: none; /* todo */
}
/* @section body */
#wiki-body {
display: block;
float: left;
margin-right: 3%;
width: 100%;
}
.has-rightbar #wiki-body {
width: 68%;
}
/* @section rightbar */
#wiki-rightbar {
background-color: #f7f7f7;
border: 1px solid #ddd;
font-size: 13px;
float: right;
padding: 7px;
width: 25%;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
}
#wiki-rightbar p {
margin: 13px 0 0;
}
#wiki-rightbar > p:first-child {
margin-top: 0;
}
#wiki-rightbar p.parent {
border-bottom: 1px solid #bbb;
font-weight: bold;
margin: 0 0 0.5em 0;
padding: 0 0 0.5em 0;
text-shadow: 0 1px 0 #fff;
}
/* Back arrow */
#wiki-rightbar p.parent:before {
color: #666;
content: "← ";
}
#wiki-rightbar h3 {
font-size: 1.2em;
color: #333;
margin: 1.2em 0 0;
padding: 0;
text-shadow: 0 1px 0 #fff;
}
#wiki-rightbar ul {
margin: 0.5em 0 1em;
padding: 0;
}
#wiki-rightbar ul li {
color: #bbb;
margin: 0 0 0 1em;
padding: 0;
line-height: 1.75em;
list-style-position: inside;
list-style-type: round;
}
#wiki-rightbar #nav ul li a {
font-weight: bold;
text-shadow: 0 1px 0 #fff;
}
/* @section footer */
#wiki-footer {
clear: both;
margin: 2em 0 5em;
}
.has-rightbar #wiki-footer {
width: 70%;
}
#wiki-footer #footer-content {
background-color: #f7f7f7;
border: 1px solid #ddd;
font-size: 1.2em;
line-height: 1.5em;
margin-top: 1.5em;
padding: 1em;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
}
#wiki-footer #footer-content h3 {
font-size: 1.2em;
color: #333;
margin: 0;
padding: 0 0 0.2em;
text-shadow: 0 1px 0 #fff;
}
#wiki-footer #footer-content p {
margin: 0.5em 0 0;
padding: 0;
}
#wiki-footer #footer-content ul.links {
margin: 0.5em 0 0;
overflow: hidden;
padding: 0;
}
#wiki-footer #footer-content ul.links li {
color: #999;
float: left;
list-style-position: inside;
list-style-type: square;
padding: 0;
margin-left: 0.75em;
}
#wiki-footer #footer-content ul.links li a {
font-weight: bold;
text-shadow: 0 1px 0 #fff;
}
#wiki-footer #footer-content ul.links li:first-child {
list-style-type: none;
margin: 0;
}
.ff #wiki-footer #footer-content ul.links li:first-child {
margin: 0 -0.75em 0 0;
}
/* @section page-footer */
.page #footer {
margin: 1em 0 7em;
}
#footer p#last-edit {
font-size: .9em;
line-height: 1.6em;
color: #999;
margin: 0.9em 0;
}
#footer p#last-edit span.username {
font-weight: bold;
}
/* @section history */
.history h1 {
color: #999;
font-weight: normal;
}
.history h1 strong {
color: #000;
font-weight: bold;
}
#wiki-history {
margin-top: 3em;
}
#wiki-history fieldset {
border: 0;
margin: 2em 0;
padding: 0;
}
#wiki-history table, #wiki-history tbody {
border-collapse: collapse;
padding: 0;
margin: 0;
width: 100%;
}
#wiki-history table tr {
padding: 0;
margin: 0;
}
#wiki-history table tr {
background-color: #ebf2f6;
}
#wiki-history table tr td {
border: 1px solid #c0dce9;
font-size: 1.2em;
line-height: 1.6em;
margin: 0;
padding: 0.3em 0.7em;
}
#wiki-history table tr td.checkbox {
min-width: 2em;
padding: 0.3em;
}
#wiki-history table tr td.checkbox input {
cursor: pointer;
display: block;
padding-right: 0;
padding-top: 0.4em;
margin-right: -0.2em;
}
#wiki-history table tr:nth-child(2n),
#wiki-history table tr.alt-row {
background-color: #f3f7fa;
}
#wiki-history table tr.selected {
background-color: #ffffea !important;
z-index: 100;
}
#wiki-history table tr td.commit-name {
border-left: 0;
}
#wiki-history table tr td.commit-name span.time-elapsed {
color: #999;
}
#wiki-history table tr td.author {
width: 20%;
}
#wiki-history table tr td.author a {
color: #000;
font-weight: bold;
}
#wiki-history table tr td.author a span.username {
display: block;
padding-top: 3px;
}
#wiki-history table tr td img {
background-color: #fff;
border: 1px solid #999;
display: block;
float: left;
height: 18px;
overflow: hidden;
margin: 0 0.5em 0 0;
width: 18px;
padding: 2px;
}
#wiki-history table tr td.commit-name a {
font-size: 0.9em;
font-family: 'Monaco', 'Andale Mono', Consolas, 'Courier New', monospace;
padding: 0 0.2em;
}
.history #wiki-history ul.actions li,
.history #footer ul.actions li {
margin: 0 0.6em 0 0;
}
/* @section edit */
.edit h1 {
color: #999;
font-weight: normal;
}
.edit h1 strong {
color: #000;
font-weight: bold;
}
/* @section search */
.results h1 {
color: #999;
font-weight: normal;
}
.results h1 strong {
color: #000;
font-weight: bold;
}
.results #results {
border-bottom: 1px solid #ccc;
margin-bottom: 2em;
padding-bottom: 2em;
}
.results #results ul {
margin: 2em 0 0 0;
padding: 0;
}
.results #results ul li {
font-size: 1.2em;
line-height: 1.6em;
list-style-position: outside;
padding: 0.2em 0;
}
.results #results ul li span.count {
color: #999;
}
.results p#no-results {
font-size: 1.2em;
line-height: 1.6em;
margin-top: 2em;
}
.results #footer ul.actions li {
margin: 0 1em 0 0;
}
/* @section compare */
.compare h1 {
color: #999;
font-weight: normal;
}
.compare h1 strong {
color: #000;
font-weight: bold;
}
.compare #compare-content {
margin-top: 3em;
}
.compare .data {
border: 1px solid #ddd;
margin-top: 1em;
overflow: auto;
}
.compare .data pre {
margin: 0;
padding: 0;
}
.compare .data pre div {
padding: 0 0 0 1em;
}
.compare .data tr td {
font-family: "Consolas", "Monaco", "Andale Mono", "Courier New", monospace;
font-size: 1.2em;
line-height: 1.8em;
margin: 0;
padding: 0;
}
.compare .data td.line_numbers {
background: #f7f7f7;
border-right: 1px solid #999;
color: #999;
padding: 0 0 0 0.5em;
}
.compare #compare-content ul.actions li,
.compare #footer ul.actions li {
margin-left: 0;
margin-right: 0.6em;
}
/* @control syntax */
.highlight { background: #ffffff; }
.highlight .c { color: #999988; font-style: italic }
.highlight .err { color: #a61717; background-color: #e3d2d2 }
.highlight .k { font-weight: bold }
.highlight .o { font-weight: bold }
.highlight .cm { color: #999988; font-style: italic }
.highlight .cp { color: #999999; font-weight: bold }
.highlight .c1 { color: #999988; font-style: italic }
.highlight .cs { color: #999999; font-weight: bold; font-style: italic }
.highlight .gd { color: #000000; background-color: #ffdddd }
.highlight .gd .x { color: #000000; background-color: #ffaaaa }
.highlight .ge { font-style: italic }
.highlight .gr { color: #aa0000 }
.highlight .gh { color: #999999 }
.highlight .gi { color: #000000; background-color: #ddffdd }
.highlight .gi .x { color: #000000; background-color: #aaffaa }
.highlight .gc { color: #999; background-color: #EAF2F5 }
.highlight .go { color: #888888 }
.highlight .gp { color: #555555 }
.highlight .gs { font-weight: bold }
.highlight .gu { color: #aaaaaa }
.highlight .gt { color: #aa0000 }
/* @control minibutton */
ul.actions {
display: block;
list-style-type: none;
overflow: hidden;
padding: 0;
}
ul.actions li {
float: left;
font-size: 1.2em;
margin-left: 0.6em;
}
.minibutton a {
background-color: #f7f7f7;
border: 1px solid #d4d4d4;
color: #333;
display: block;
font-weight: bold;
margin: 0;
padding: 0.4em 1em;
height: 1.4em;
text-shadow: 0 1px 0 #fff;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
background: -moz-linear-gradient(top, #f4f4f4, #ececec);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
#search-submit {
background-color: #f7f7f7;
border: 1px solid #d4d4d4;
color: #333;
display: block;
font-weight: bold;
margin: 0;
padding: 0.4em 1em;
text-shadow: 0 1px 0 #fff;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
background: -moz-linear-gradient(top, #f4f4f4, #ececec);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
.minibutton a:hover,
#search-submit:hover {
background: #3072b3;
border-color: #518cc6 #518cc6 #2a65a0;
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
text-decoration: none;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
background: -moz-linear-gradient(top, #599bdc, #3072b3);
}
.minibutton a:visited {
text-decoration: none;
}
/* @special error */
#wiki-wrapper.error {
height: 1px;
position: absolute;
overflow: visible;
top: 50%;
width: 100%;
}
#error {
background-color: #f9f9f9;
border: 1px solid #e4e4e4;
left: 50%;
overflow: hidden;
padding: 2%;
margin: -10% 0 0 -35%;
position: absolute;
width: 70%;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
}
#error h1 {
font-size: 3em;
line-height: normal;
margin: 0;
padding: 0;
}
#error p {
font-size: 1.2em;
line-height: 1.6em;
margin: 1em 0 0.5em;
padding: 0;
}
/* @control searchbar */
#head #searchbar {
float: right;
margin: 1em 0 0 0;
padding: 0;
overflow: hidden;
}
#head #searchbar #searchbar-fauxtext {
background: #fff;
border: 1px solid #d4d4d4;
overflow: hidden;
border-radius: 0.3em;
-moz-border-radius: 0.3em;
-webkit-border-radius: 0.3em;
}
#head #searchbar #searchbar-fauxtext input#search-query {
border: none;
color: #000;
float: left;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1.2em;
height: 1.8em;
-webkit-focus-ring: none;
}
.ff #head #searchbar #searchbar-fauxtext input#search-query {
padding: 0.2em 0 0.2em 0.5em;
}
.ie #head #searchbar #searchbar-fauxtext input#search-query {
padding: 0.4em 0 0 0.5em;
}
#head #searchbar #searchbar-fauxtext input#search-query.ph {
color: #999;
}
#head #searchbar #searchbar-fauxtext #search-submit {
border: 0;
border-left: 1px solid #d4d4d4;
cursor: pointer;
margin: 0 !important;
padding: 0;
float: right;
font-size: 1.2em;
border-radius: 0 3px 3px 0;
-moz-border-radius: 0 3px 3px 0;
-webkit-border-radius: 0 3px 3px 0;
}
#head #searchbar #searchbar-fauxtext #search-submit span {
background-image: url(/images/icon-sprite.png);
background-position: -431px -1px;
background-repeat: no-repeat;
display: block;
height: 2em;
overflow: hidden;
text-indent: -5000px;
width: 28px;
}
.ff #head #searchbar #searchbar-fauxtext #search-submit span,
.ie #head #searchbar #searchbar-fauxtext #search-submit span {
height: 2.2em;
}
#head #searchbar #searchbar-fauxtext #search-submit:hover span {
background-position: -431px -28px;
padding: 0;
}
@@ -1,381 +0,0 @@
/*
Gollum v3 Template
*/
/* margin & padding reset*/
* {
margin: 0;
padding: 0;
}
html, body {
color: black;
}
body {
font: 13.34px helvetica,arial,freesans,clean,sans-serif;
line-height: 1.4;
}
img {
border: 0;
}
#template {
font-size: 14px;
line-height: 1.4;
margin-bottom: 40px;
}
/* Link Colors */
a.absent {
color: #c00;
}
/* Primary Body Copy */
#template p {
margin: 1em 0;
padding: 0;
}
/* ReST first graf in nested list */
#template * li p.first {
display: inline-block;
}
/* Headings */
#template h1, #template h2, #template h3,
#template h4, #template h5, #template h6 {
margin: 0;
padding: 0;
}
#template h1 {
border-bottom: 1px solid #ccc;
font-size: 33px; /* was 32, GH is 33px */
line-height: normal;
padding: .08em 0 0 0;
margin: 0;
}
#template h2 {
font-size: 22px;
line-height: normal;
margin: 22px 0 0;
padding: 7px 0 0;
}
#template h3 {
font-size: 16px;
line-height: 26px;
padding: 26px 0 0;
}
#template h4 {
font-size: 14px;
line-height: 26px;
padding: 18px 0 4px;
font-weight: bold;
text-transform: uppercase;
}
#template h5 {
font-size: 13px;
line-height: 26px;
margin-bottom: -19px;
padding: 14px 0 0;
font-weight: bold;
text-transform: uppercase;
}
#template h6 {
color: #666;
font-size: 14px;
line-height: 26px;
margin-bottom: -19px;
padding: 18px 0 0;
font-weight: normal;
font-variant: italic;
}
#template hr {
background-color: #ccc;
color: #ccc;
border: 2px solid #ccc;
margin: 20px 0;
padding: 0;
}
/* Border Reset for headers with horizontal rules */
#template > h2:first-child,
#template > h1:first-child {
margin: 12px 0 0;
padding: 10px 0 0;
}
/* Lists, Blockquotes & Such */
#template ul,
#template ol {
margin-top: 1.5em;
margin-left: 2.6em;
}
/* Nested Lists */
#template ul li,
#template ol li,
#template ul li ul,
#template ol li ol,
#template ul li ol,
#template ol li ul,
#template ul ul,
#template ol ol {
padding: 0;
margin: .5em 0;
}
#template dl {
margin: 0;
padding: 20px 0 0;
}
#template dl dt {
font-size: 14px;
font-weight: bold;
line-height: normal;
margin: 0;
padding: 20px 0 0;
}
#template dl dt:first-child {
padding: 0;
}
#template dl dd {
font-size: 13px;
margin: 0;
padding: 3px 0 0;
}
/* Tables */
#template table {
border-collapse: collapse;
margin: 20px 0 0;
padding: 0;
}
#template table * tr {
border-top: 1px solid #ccc;
background-color: #fff;
margin: 0;
padding: 0;
}
#template table * tr:nth-child(2n) {
background-color: #f8f8f8;
}
#template table * tr th,
#template table * tr td {
border: 1px solid #ccc;
text-align: left;
margin: 0;
padding: 6px 13px;
}
/* Images & Stuff */
#template img {
max-width: 100%;
}
/* Gollum Image Tags */
/* Framed */
#template span.frame {
display: block;
overflow: hidden;
}
#template span.frame > span {
border: 1px solid #ddd;
display: block;
float: left;
overflow: hidden;
margin: 13px 0 0;
padding: 7px;
width: auto;
}
#template span.frame span img {
display: block;
float: left;
}
#template span.frame span span {
clear: both;
color: #333;
display: block;
padding: 5px 0 0;
}
#template span.align-center {
display: block;
overflow: hidden;
clear: both;
}
#template span.align-center > span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: center;
}
#template span.align-center span img {
margin: 0 auto;
text-align: center;
}
#template span.align-right {
display: block;
overflow: hidden;
clear: both;
}
#template span.align-right > span {
display: block;
overflow: hidden;
margin: 13px 0 0;
text-align: right;
}
#template span.align-right span img {
margin: 0;
text-align: right;
}
#template span.float-left {
display: block;
margin-right: 13px;
overflow: hidden;
float: left;
}
#template span.float-left span {
margin: 13px 0 0;
}
#template span.float-right {
display: block;
margin-left: 13px;
overflow: hidden;
float: right;
}
#template span.float-right > span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: right;
}
/* Code */
#template code, #template tt {
background-color: #f8f8f8;
border: 1px solid #dedede;
font-size: 13px;
padding: 0;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
#template .highlight pre, #template pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
pre, code {
font: 12px 'Bitstream Vera Sans Mono','Courier',monospace
}
#template pre code, #template pre tt {
background-color: transparent;
border: none;
}
/*
Highlight rules from pull req 191
https://github.com/eboto/gollum/commit/5df09477abf4a04c82c7fcaa2bd7ee2a85e7ec82
*/
#template .highlight { background:#fff; }
#template .highlight .c { color:#998;font-style:italic; }
#template .highlight .err { color:#a61717;background-color:#e3d2d2; }
#template .highlight .k { font-weight:bold; }
#template .highlight .o { font-weight:bold; }
#template .highlight .cm { color:#998;font-style:italic; }
#template .highlight .cp { color:#999;font-weight:bold; }
#template .highlight .c1 { color:#998;font-style:italic; }
#template .highlight .cs { color:#999;font-weight:bold;font-style:italic; }
#template .highlight .gd { color:#000;background-color:#fdd; }
#template .highlight .gd .x { color:#000;background-color:#faa; }
#template .highlight .ge { font-style:italic; }
#template .highlight .gr { color:#a00; }
#template .highlight .gh { color:#999; }
#template .highlight .gi { color:#000;background-color:#dfd; }
#template .highlight .gi .x { color:#000;background-color:#afa; }
#template .highlight .go { color:#888; }
#template .highlight .gp { color:#555; }
#template .highlight .gs { font-weight:bold; }
#template .highlight .gu { color:#800080;font-weight:bold; }
#template .highlight .gt { color:#a00; }
#template .highlight .kc { font-weight:bold; }
#template .highlight .kd { font-weight:bold; }
#template .highlight .kp { font-weight:bold; }
#template .highlight .kr { font-weight:bold; }
#template .highlight .kt { color:#458;font-weight:bold; }
#template .highlight .m { color:#099; }
#template .highlight .s { color:#d14; }
#template .highlight .na { color:#008080; }
#template .highlight .nb { color:#0086B3; }
#template .highlight .nc { color:#458;font-weight:bold; }
#template .highlight .no { color:#008080; }
#template .highlight .ni { color:#800080; }
#template .highlight .ne { color:#900;font-weight:bold; }
#template .highlight .nf { color:#900;font-weight:bold; }
#template .highlight .nn { color:#555; }
#template .highlight .nt { color:#000080; }
#template .highlight .nv { color:#008080; }
#template .highlight .ow { font-weight:bold; }
#template .highlight .w { color:#bbb; }
#template .highlight .mf { color:#099; }
#template .highlight .mh { color:#099; }
#template .highlight .mi { color:#099; }
#template .highlight .mo { color:#099; }
#template .highlight .sb { color:#d14; }
#template .highlight .sc { color:#d14; }
#template .highlight .sd { color:#d14; }
#template .highlight .s2 { color:#d14; }
#template .highlight .se { color:#d14; }
#template .highlight .sh { color:#d14; }
#template .highlight .si { color:#d14; }
#template .highlight .sx { color:#d14; }
#template .highlight .sr { color:#009926; }
#template .highlight .s1 { color:#d14; }
#template .highlight .ss { color:#990073; }
#template .highlight .bp { color:#999; }
#template .highlight .vc { color:#008080; }
#template .highlight .vg { color:#008080; }
#template .highlight .vi { color:#008080; }
#template .highlight .il { color:#099; }
@@ -1,161 +0,0 @@
// ua
$(document).ready(function() {
var nodeSelector = {
node1: null,
node2: null,
selectNodeRange: function( n1, n2 ) {
if ( nodeSelector.node1 && nodeSelector.node2 ) {
$('#wiki-history td.selected').removeClass('selected');
nodeSelector.node1.addClass('selected');
nodeSelector.node2.addClass('selected');
// swap the nodes around if they went in reverse
if ( nodeSelector.nodeComesAfter( nodeSelector.node1,
nodeSelector.node2 ) ) {
var n = nodeSelector.node1;
nodeSelector.node1 = nodeSelector.node2;
nodeSelector.node2 = n;
}
var s = true;
var $nextNode = nodeSelector.node1.next();
while ( $nextNode ) {
$nextNode.addClass('selected');
if ( $nextNode[0] == nodeSelector.node2[0] ) {
break;
}
$nextNode = $nextNode.next();
}
}
},
nodeComesAfter: function ( n1, n2 ) {
var s = false;
$(n1).prevAll().each(function() {
if ( $(this)[0] == $(n2)[0] ) {
s = true;
}
});
return s;
},
checkNode: function( nodeCheckbox ) {
var $nodeCheckbox = nodeCheckbox;
var $node = $(nodeCheckbox).parent().parent();
// if we're unchecking
if ( !$nodeCheckbox.is(':checked') ) {
// remove the range, since we're breaking it
$('#wiki-history tr.selected').each(function() {
if ( $(this).find('td.checkbox input').is(':checked') ) {
return;
}
$(this).removeClass('selected');
});
// no longer track this
if ( $node[0] == nodeSelector.node1[0] ) {
nodeSelector.node1 = null;
if ( nodeSelector.node2 ) {
nodeSelector.node1 = nodeSelector.node2;
nodeSelector.node2 = null;
}
} else if ( $node[0] == nodeSelector.node2[0] ) {
nodeSelector.node2 = null;
}
} else {
if ( !nodeSelector.node1 ) {
nodeSelector.node1 = $node;
nodeSelector.node1.addClass('selected');
} else if ( !nodeSelector.node2 ) {
// okay, we don't have a node 2 but have a node1
nodeSelector.node2 = $node;
nodeSelector.node2.addClass('selected');
nodeSelector.selectNodeRange( nodeSelector.node1,
nodeSelector.node2 );
} else {
// we have two selected already
$nodeCheckbox[0].checked = false;
}
}
}
};
// ua detection
if ($.browser.mozilla) {
$('body').addClass('ff');
} else if ($.browser.webkit) {
$('body').addClass('webkit');
} else if ($.browser.msie) {
$('body').addClass('ie');
if ($.browser.version == "7.0") {
$('body').addClass('ie7');
} else if ($.browser.version == "8.0") {
$('body').addClass('ie8');
}
}
if ($('#minibutton-new-page').length) {
$('#minibutton-new-page').removeClass('jaws');
$('#minibutton-new-page').click(function(e) {
e.preventDefault();
$.GollumDialog.init({
title: 'Create New Page',
fields: [
{
id: 'name',
name: 'Page Name',
type: 'text'
}
],
OK: function( res ) {
var n = 'New Page';
if ( res['name'] )
var n = res['name'];
n = encodeURIComponent( n );
window.location = '/' + n;
}
});
});
}
if ($('#wiki-wrapper').hasClass('history')) {
$('#wiki-history td.checkbox input').each(function() {
$(this).click(function() {
nodeSelector.checkNode($(this));
});
if ( $(this).is(':checked') ) {
nodeSelector.checkNode($(this));
}
});
if ($('.history a.action-compare-revision').length) {
$('.history a.action-compare-revision').click(function() {
$("#version-form").submit();
});
}
}
if ($('#searchbar a#search-submit').length) {
$.GollumPlaceholder.add($('#searchbar #search-query'));
$('#searchbar a#search-submit').click(function(e) {
e.preventDefault();
$('#searchbar #search-form')[0].submit();
});
$('#searchbar #search-form').submit(function(e) {
$.GollumPlaceholder.clearAll();
$(this).unbind('submit');
$(this).submit();
});
}
if ($('#gollum-revert-form').length &&
$('.gollum-revert-button').length ) {
$('a.gollum-revert-button').click(function(e) {
e.preventDefault();
$('#gollum-revert-form').submit();
});
}
});
File diff suppressed because it is too large Load Diff
@@ -1,17 +0,0 @@
<div id="wiki-wrapper">
<div id="head">
<h1>Create New Page</h1>
</div>
<div id="wiki-content" class="create edit">
<div class="has-rightbar">
{{>editor}}
</div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function() {
$.GollumEditor({ NewFile: true, MarkupType: '{{default_markup}}' });
});
</script>
{{something}}
@@ -1,28 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
<link rel="stylesheet" type="text/css" href="/css/gollum.css" media="all">
<link rel="stylesheet" type="text/css" href="/css/editor.css" media="all">
<link rel="stylesheet" type="text/css" href="/css/dialog.css" media="all">
<link rel="stylesheet" type="text/css" href="/css/template.css" media="all">
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="/css/ie7.css" media="all">
<![endif]-->
<script type="text/javascript" src="/javascript/jquery.js"></script>
<script type="text/javascript" src="/javascript/gollum.js"></script>
<script type="text/javascript" src="/javascript/gollum.dialog.js"></script>
<script type="text/javascript" src="/javascript/gollum.placeholder.js"></script>
<script type="text/javascript"
src="/javascript/editor/gollum.editor.js"></script>
<title>{{title}}</title>
</head>
<body>
{{{yield}}}
</body>
</html>
@@ -1,43 +0,0 @@
<div id="wiki-wrapper" class="page">
<div id="head">
<h1>{{title}}</h1>
<ul class="actions">
<li class="minibutton"><a href="/pages"
class="action-all-pages">All Pages</a></li>
<li class="minibutton" class="jaws">
<a href="#" id="minibutton-new-page">New Page</a></li>
{{#editable}}
<li class="minibutton"><a href="/edit/{{escaped_name}}"
class="action-edit-page">Edit Page</a></li>
{{/editable}}
<li class="minibutton"><a href="/history/{{escaped_name}}"
class="action-page-history">Page History</a></li>
</ul>
{{>searchbar}}
</div>
<div id="wiki-content">
<div class="wrap {{#has_footer}} has-footer {{/has_footer}} {{#has_sidebar}} has-rightbar{{/has_sidebar}}">
<div id="wiki-body" class="gollum-{{format}}-content">
<div id="template">
{{{content}}}
</div>
</div>
{{#has_sidebar}}
<div id="wiki-rightbar" class="gollum-{{sidebar_format}}-content">
{{{sidebar_content}}}
</div>
{{/has_sidebar}}
{{#has_footer}}
<div id="wiki-footer" class="gollum-{{footer_format}}-content">
<div id="footer-content">
{{{footer_content}}}
</div>
</div>
{{/has_footer}}
</div>
</div>
<div id="footer">
<p id="last-edit">Last edited by <b>{{author}}</b>, {{date}}</p>
</div>
</div>
@@ -1,35 +0,0 @@
<div id="wiki-wrapper" class="results">
<div id="head">
<h1>{{title}}</h1>
<ul class="actions">
<li class="minibutton"><a href="/"
class="action-edit-page">Home</a></li>
</ul>
{{>searchbar}}
</div>
<div id="results">
{{#has_results}}
<ul>
{{#results}}
<li>
<a href="/{{name}}">{{name}}</a>
</li>
{{/results}}
</ul>
{{/has_results}}
{{#no_results}}
<p id="no-results">
There are no pages in <strong>{{ref}}</strong>.
</p>
{{/no_results}}
</div>
<div id="footer">
<ul class="actions">
<li class="minibutton"><a href="#">Back to Top</a></li>
</ul>
</div>
</div>
-44
View File
@@ -1,44 +0,0 @@
module Precious
module Views
class History < Layout
attr_reader :page, :page_num
def title
@page.title
end
def versions
i = @versions.size + 1
@versions.map do |v|
i -= 1
{ :id => v.id,
:id7 => v.id[0..6],
:num => i,
:selected => @page.version.id == v.id,
:author => v.author.name,
:message => v.message,
:date => v.committed_date.strftime("%B %d, %Y"),
:gravatar => Digest::MD5.hexdigest(v.author.email) }
end
end
def previous_link
label = "&laquo; Previous"
if @page_num == 1
%(<span class="disabled">#{label}</span>)
else
%(<a href="/history/#{@page.name}?page=#{@page_num-1}" hotkey="h">#{label}</a>)
end
end
def next_link
label = "Next &raquo;"
if @versions.size == Gollum::Page.per_page
%(<a href="/history/#{@page.name}?page=#{@page_num+1}" hotkey="l">#{label}</a>)
else
%(<span class="disabled">#{label}</span>)
end
end
end
end
end
-57
View File
@@ -1,57 +0,0 @@
module Precious
module Views
class Page < Layout
attr_reader :content, :page, :footer
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
DEFAULT_AUTHOR = 'you'
def title
@page.title
end
def format
@page.format.to_s
end
def author
return DEFAULT_AUTHOR unless @page.version
@page.version.author.name
end
def date
return Time.now.strftime(DATE_FORMAT) unless @page.version
@page.version.authored_date.strftime(DATE_FORMAT)
end
def editable
@editable
end
def has_footer
@footer = (@page.footer || false) if @footer.nil?
!!@footer
end
def footer_content
has_footer && @footer.formatted_data
end
def footer_format
has_footer && @footer.format.to_s
end
def has_sidebar
@sidebar = (@page.sidebar || false) if @sidebar.nil?
!!@sidebar
end
def sidebar_content
has_sidebar && @sidebar.formatted_data
end
def sidebar_format
has_sidebar && @sidebar.format.to_s
end
end
end
end
-248
View File
@@ -1,248 +0,0 @@
module Gollum
# Controls all access to the Git objects from Gollum. Extend this class to
# add custom caching for special cases.
class GitAccess
# Initializes the GitAccess instance.
#
# path - The String path to the Git repository that holds the
# Gollum site.
# page_file_dir - String the directory in which all page files reside
#
# Returns this instance.
def initialize(path, page_file_dir = nil)
@page_file_dir = page_file_dir
@path = path
@repo = Grit::Repo.new(path)
clear
end
# Public: Determines whether the Git repository exists on disk.
#
# Returns true if it exists, or false.
def exist?
@repo.git.exist?
end
# Public: Converts a given Git reference to a SHA, using the cache if
# available.
#
# ref - a String Git reference (ex: "master")
#
# Returns a String, or nil if the ref isn't found.
def ref_to_sha(ref)
ref = ref.to_s
return if ref.empty?
sha =
if sha?(ref)
ref
else
get_cache(:ref, ref) { ref_to_sha!(ref) }
end.to_s
sha.empty? ? nil : sha
end
# Public: Gets a recursive list of Git blobs for the whole tree at the
# given commit.
#
# ref - A String Git reference or Git SHA to a commit.
#
# Returns an Array of BlobEntry instances.
def tree(ref)
if sha = ref_to_sha(ref)
get_cache(:tree, sha) { tree!(sha) }
else
[]
end
end
# Public: Fetches the contents of the Git blob at the given SHA.
#
# sha - A String Git SHA.
#
# Returns the String content of the blob.
def blob(sha)
cat_file!(sha)
end
# Public: Looks up the Git commit using the given Git SHA or ref.
#
# ref - A String Git SHA or ref.
#
# Returns a Grit::Commit.
def commit(ref)
if sha?(ref)
get_cache(:commit, ref) { commit!(ref) }
else
if sha = get_cache(:ref, ref)
commit(sha)
else
if cm = commit!(ref)
set_cache(:ref, ref, cm.id)
set_cache(:commit, cm.id, cm)
end
end
end
end
# Public: Clears all of the cached data that this GitAccess is tracking.
#
# Returns nothing.
def clear
@ref_map = {}
@tree_map = {}
@commit_map = {}
end
# Public: Refreshes just the cached Git reference data. This should
# be called after every Gollum update.
#
# Returns nothing.
def refresh
@ref_map.clear
end
#########################################################################
#
# Internal Methods
#
#########################################################################
# Gets the String path to the Git repository.
attr_reader :path
# Gets the Grit::Repo instance for the Git repository.
attr_reader :repo
# Gets a Hash cache of refs to commit SHAs.
#
# {"master" => "abc123", ...}
#
attr_reader :ref_map
# Gets a Hash cache of commit SHAs to a recursive tree of blobs.
#
# {"abc123" => [<BlobEntry>, <BlobEntry>]}
#
attr_reader :tree_map
# Gets a Hash cache of commit SHAs to the Grit::Commit instance.
#
# {"abcd123" => <Grit::Commit>}
#
attr_reader :commit_map
# Checks to see if the given String is a 40 character hex SHA.
#
# str - Possible String SHA.
#
# Returns true if the String is a SHA, or false.
def sha?(str)
!!(str =~ /^[0-9a-f]{40}$/)
end
# Looks up the Git SHA for the given Git ref.
#
# ref - String Git ref.
#
# Returns a String SHA.
def ref_to_sha!(ref)
@repo.git.rev_list({:max_count=>1}, ref)
rescue Grit::GitRuby::Repository::NoSuchShaFound
end
# Looks up the Git blobs for a given commit.
#
# sha - String commit SHA.
#
# Returns an Array of BlobEntry instances.
def tree!(sha)
tree = @repo.git.native(:ls_tree,
{:r => true, :l => true, :z => true}, sha)
if tree.respond_to?(:force_encoding)
tree.force_encoding("UTF-8")
end
items = tree.split("\0").inject([]) do |memo, line|
memo << parse_tree_line(line)
end
if dir = @page_file_dir
regex = /^#{dir}\//
items.select { |i| i.path =~ regex }
else
items
end
end
# Reads the content from the Git db at the given SHA.
#
# sha - The String SHA.
#
# Returns the String content of the Git object.
def cat_file!(sha)
@repo.git.cat_file({:p => true}, sha)
end
# Reads a Git commit.
#
# sha - The string SHA of the Git commit.
#
# Returns a Grit::Commit.
def commit!(sha)
@repo.commit(sha)
end
# Attempts to get the given data from a cache. If it doesn't exist, it'll
# pass the results of the yielded block to the cache for future accesses.
#
# name - The cache prefix used in building the full cache key.
# key - The unique cache key suffix, usually a String Git SHA.
#
# Yields a block to pass to the cache.
# Returns the cached result.
def get_cache(name, key)
cache = instance_variable_get("@#{name}_map")
value = cache[key]
if value.nil? && block_given?
set_cache(name, key, value = yield)
end
value == :_nil ? nil : value
end
# Writes some data to the internal cache.
#
# name - The cache prefix used in building the full cache key.
# key - The unique cache key suffix, usually a String Git SHA.
# value - The value to write to the cache.
#
# Returns nothing.
def set_cache(name, key, value)
cache = instance_variable_get("@#{name}_map")
cache[key] = value || :_nil
end
# Parses a line of output from the `ls-tree` command.
#
# line - A String line of output:
# "100644 blob 839c2291b30495b9a882c17d08254d3c90d8fb53 Home.md"
#
# Returns an Array of BlobEntry instances.
def parse_tree_line(line)
mode, type, sha, size, *name = line.split(/\s+/)
BlobEntry.new(sha, name.join(' '), size.to_i)
end
# Decode octal sequences (\NNN) in tree path names.
#
# path - String path name.
#
# Returns a decoded String.
def decode_git_path(path)
if path[0] == ?" && path[-1] == ?"
path = path[1...-1]
path.gsub!(/\\\d{3}/) { |m| m[1..-1].to_i(8).chr }
end
path.gsub!(/\\[rn"\\]/) { |m| eval(%("#{m.to_s}")) }
path
end
end
end
+43
View File
@@ -0,0 +1,43 @@
# ~*~ encoding: utf-8 ~*~
module Precious
module Helpers
# Extract the path string that Gollum::Wiki expects
def extract_path(file_path)
return nil if file_path.nil?
last_slash = file_path.rindex("/")
if last_slash
file_path[0, last_slash]
end
end
# Extract the 'page' name from the file_path
def extract_name(file_path)
if file_path[-1, 1] == "/"
return nil
end
# File.basename is too eager to please and will return the last
# component of the path even if it ends with a directory separator.
::File.basename(file_path)
end
def sanitize_empty_params(param)
[nil,''].include?(param) ? nil : CGI.unescape(param)
end
# Ensure path begins with a single leading slash
def clean_path(path)
if path
(path[0] != '/' ? path.insert(0, '/') : path).gsub(/\/{2,}/,'/')
end
end
# Remove all slashes from the start of string.
# Remove all double slashes
def clean_url url
return url if url.nil?
url.gsub('%2F','/').gsub(/^\/+/,'').gsub('//','/')
end
end
end
-489
View File
@@ -1,489 +0,0 @@
require 'digest/sha1'
require 'cgi'
require 'pygments'
require 'base64'
module Gollum
class Markup
# Initialize a new Markup object.
#
# page - The Gollum::Page.
#
# Returns a new Gollum::Markup object, ready for rendering.
def initialize(page)
@wiki = page.wiki
@name = page.filename
@data = page.text_data
@version = page.version.id if page.version
@format = page.format
@dir = ::File.dirname(page.path)
@tagmap = {}
@codemap = {}
@texmap = {}
@wsdmap = {}
@premap = {}
end
# Render the content with Gollum wiki syntax on top of the file's own
# markup language.
#
# no_follow - Boolean that determines if rel="nofollow" is added to all
# <a> tags.
# encoding - Encoding Constant or String.
#
# Returns the formatted String content.
def render(no_follow = false, encoding = nil)
sanitize = no_follow ?
@wiki.history_sanitizer :
@wiki.sanitizer
data = extract_tex(@data.dup)
data = extract_code(data)
data = extract_wsd(data)
data = extract_tags(data)
begin
data = GitHub::Markup.render(@name, data)
if data.nil?
raise "There was an error converting #{@name} to HTML."
end
rescue Object => e
data = %{<p class="gollum-error">#{e.message}</p>}
end
data = process_tags(data)
data = process_code(data, encoding)
if sanitize || block_given?
doc = Nokogiri::HTML::DocumentFragment.parse(data)
doc = sanitize.clean_node!(doc) if sanitize
yield doc if block_given?
data = doc.to_html
end
data = process_tex(data)
data = process_wsd(data)
data.gsub!(/<p><\/p>/, '')
data
end
#########################################################################
#
# TeX
#
#########################################################################
# Extract all TeX into the texmap and replace with placeholders.
#
# data - The raw String data.
#
# Returns the placeholder'd String data.
def extract_tex(data)
data.gsub(/\\\[\s*(.*?)\s*\\\]/m) do
tag = CGI.escapeHTML($1)
id = Digest::SHA1.hexdigest(tag)
@texmap[id] = [:block, tag]
id
end.gsub(/\\\(\s*(.*?)\s*\\\)/m) do
tag = CGI.escapeHTML($1)
id = Digest::SHA1.hexdigest(tag)
@texmap[id] = [:inline, tag]
id
end
end
# Process all TeX from the texmap and replace the placeholders with the
# final markup.
#
# data - The String data (with placeholders).
#
# Returns the marked up String data.
def process_tex(data)
@texmap.each do |id, spec|
type, tex = *spec
out = %{<img src="#{::File.join(@wiki.base_path, '_tex.png')}?type=#{type}&data=#{Base64.encode64(tex).chomp}" alt="#{CGI.escapeHTML(tex)}">}
data.gsub!(id, out)
end
data
end
#########################################################################
#
# Tags
#
#########################################################################
# Extract all tags into the tagmap and replace with placeholders.
#
# data - The raw String data.
#
# Returns the placeholder'd String data.
def extract_tags(data)
data.gsub!(/(.?)\[\[(.+?)\]\]([^\[]?)/m) do
if $1 == "'" && $3 != "'"
"[[#{$2}]]#{$3}"
elsif $2.include?('][')
if $2[0..4] == 'file:'
pre = $1
post = $3
parts = $2.split('][')
parts[0][0..4] = ""
link = "#{parts[1]}|#{parts[0].sub(/\.org/,'')}"
id = Digest::SHA1.hexdigest(link)
@tagmap[id] = link
"#{pre}#{id}#{post}"
else
$&
end
else
id = Digest::SHA1.hexdigest($2)
@tagmap[id] = $2
"#{$1}#{id}#{$3}"
end
end
data
end
# Process all tags from the tagmap and replace the placeholders with the
# final markup.
#
# data - The String data (with placeholders).
#
# Returns the marked up String data.
def process_tags(data)
@tagmap.each do |id, tag|
data.gsub!(id, process_tag(tag))
end
data
end
# Process a single tag into its final HTML form.
#
# tag - The String tag contents (the stuff inside the double
# brackets).
#
# Returns the String HTML version of the tag.
def process_tag(tag)
if html = process_image_tag(tag)
html
elsif html = process_file_link_tag(tag)
html
else
process_page_link_tag(tag)
end
end
# Attempt to process the tag as an image tag.
#
# tag - The String tag contents (the stuff inside the double brackets).
#
# Returns the String HTML if the tag is a valid image tag or nil
# if it is not.
def process_image_tag(tag)
parts = tag.split('|')
return if parts.size.zero?
name = parts[0].strip
path = if file = find_file(name)
::File.join @wiki.base_path, file.path
elsif name =~ /^https?:\/\/.+(jpg|png|gif|svg|bmp)$/i
name
end
if path
opts = parse_image_tag_options(tag)
containered = false
classes = [] # applied to whatever the outermost container is
attrs = [] # applied to the image
align = opts['align']
if opts['float']
containered = true
align ||= 'left'
if %w{left right}.include?(align)
classes << "float-#{align}"
end
elsif %w{top texttop middle absmiddle bottom absbottom baseline}.include?(align)
attrs << %{align="#{align}"}
elsif align
if %w{left center right}.include?(align)
containered = true
classes << "align-#{align}"
end
end
if width = opts['width']
if width =~ /^\d+(\.\d+)?(em|px)$/
attrs << %{width="#{width}"}
end
end
if height = opts['height']
if height =~ /^\d+(\.\d+)?(em|px)$/
attrs << %{height="#{height}"}
end
end
if alt = opts['alt']
attrs << %{alt="#{alt}"}
end
attr_string = attrs.size > 0 ? attrs.join(' ') + ' ' : ''
if opts['frame'] || containered
classes << 'frame' if opts['frame']
%{<span class="#{classes.join(' ')}">} +
%{<span>} +
%{<img src="#{path}" #{attr_string}/>} +
(alt ? %{<span>#{alt}</span>} : '') +
%{</span>} +
%{</span>}
else
%{<img src="#{path}" #{attr_string}/>}
end
end
end
# Parse any options present on the image tag and extract them into a
# Hash of option names and values.
#
# tag - The String tag contents (the stuff inside the double brackets).
#
# Returns the options Hash:
# key - The String option name.
# val - The String option value or true if it is a binary option.
def parse_image_tag_options(tag)
tag.split('|')[1..-1].inject({}) do |memo, attr|
parts = attr.split('=').map { |x| x.strip }
memo[parts[0]] = (parts.size == 1 ? true : parts[1])
memo
end
end
# Attempt to process the tag as a file link tag.
#
# tag - The String tag contents (the stuff inside the double
# brackets).
#
# Returns the String HTML if the tag is a valid file link tag or nil
# if it is not.
def process_file_link_tag(tag)
parts = tag.split('|')
return if parts.size.zero?
name = parts[0].strip
path = parts[1] && parts[1].strip
path = if path && file = find_file(path)
::File.join @wiki.base_path, file.path
elsif path =~ %r{^https?://}
path
else
nil
end
if name && path && file
%{<a href="#{::File.join @wiki.base_path, file.path}">#{name}</a>}
elsif name && path
%{<a href="#{path}">#{name}</a>}
else
nil
end
end
# Attempt to process the tag as a page link tag.
#
# tag - The String tag contents (the stuff inside the double
# brackets).
#
# Returns the String HTML if the tag is a valid page link tag or nil
# if it is not.
def process_page_link_tag(tag)
parts = tag.split('|')
parts.reverse! if @format == :mediawiki
name, page_name = *parts.compact.map(&:strip)
cname = @wiki.page_class.cname(page_name || name)
if name =~ %r{^https?://} && page_name.nil?
%{<a href="#{name}">#{name}</a>}
else
presence = "absent"
link_name = cname
page, extra = find_page_from_name(cname)
if page
link_name = @wiki.page_class.cname(page.name)
presence = "present"
end
link = ::File.join(@wiki.base_path, CGI.escape(link_name))
%{<a class="internal #{presence}" href="#{link}#{extra}">#{name}</a>}
end
end
# Find the given file in the repo.
#
# name - The String absolute or relative path of the file.
#
# Returns the Gollum::File or nil if none was found.
def find_file(name)
if name =~ /^\//
@wiki.file(name[1..-1], @version)
else
path = @dir == '.' ? name : ::File.join(@dir, name)
@wiki.file(path, @version)
end
end
# Find a page from a given cname. If the page has an anchor (#) and has
# no match, strip the anchor and try again.
#
# cname - The String canonical page name.
#
# Returns a Gollum::Page instance if a page is found, or an Array of
# [Gollum::Page, String extra] if a page without the extra anchor data
# is found.
def find_page_from_name(cname)
if page = @wiki.page(cname)
return page
end
if pos = cname.index('#')
[@wiki.page(cname[0...pos]), cname[pos..-1]]
end
end
#########################################################################
#
# Code
#
#########################################################################
# Extract all code blocks into the codemap and replace with placeholders.
#
# data - The raw String data.
#
# Returns the placeholder'd String data.
def extract_code(data)
data.gsub!(/^([ \t]*)``` ?([^\r\n]+)?\r?\n(.+?)\r?\n\1```\r?$/m) do
id = Digest::SHA1.hexdigest("#{$2}.#{$3}")
cached = check_cache(:code, id)
@codemap[id] = cached ?
{ :output => cached } :
{ :lang => $2, :code => $3, :indent => $1 }
"#{$1}#{id}" # print the SHA1 ID with the proper indentation
end
data
end
# Remove the leading space from a code block. Leading space
# is only removed if every single line in the block has leading
# whitespace.
#
# code - The code block to remove spaces from
# regex - A regex to match whitespace
def remove_leading_space(code, regex)
if code.lines.all? { |line| line =~ /\A\r?\n\Z/ || line =~ regex }
code.gsub!(regex, '')
end
end
# Process all code from the codemap and replace the placeholders with the
# final HTML.
#
# data - The String data (with placeholders).
# encoding - Encoding Constant or String.
#
# Returns the marked up String data.
def process_code(data, encoding = nil)
return data if data.nil? || data.size.zero? || @codemap.size.zero?
blocks = []
@codemap.each do |id, spec|
next if spec[:output] # cached
code = spec[:code]
remove_leading_space(code, /^#{spec[:indent]}/m)
remove_leading_space(code, /^( |\t)/m)
blocks << [spec[:lang], code]
end
highlighted = begin
encoding ||= 'utf-8'
blocks.map { |lang, code|
Pygments.highlight(code, :lexer => lang, :options => {:encoding => encoding.to_s})
}
rescue ::RubyPython::PythonError
[]
end
@codemap.each do |id, spec|
body = spec[:output] || begin
if (body = highlighted.shift.to_s).size > 0
update_cache(:code, id, body)
body
else
"<pre><code>#{CGI.escapeHTML(spec[:code])}</code></pre>"
end
end
data.gsub!(id, body)
end
data
end
#########################################################################
#
# Sequence Diagrams
#
#########################################################################
# Extract all sequence diagram blocks into the wsdmap and replace with
# placeholders.
#
# data - The raw String data.
#
# Returns the placeholder'd String data.
def extract_wsd(data)
data.gsub(/^\{\{\{ ?(.+?)\r?\n(.+?)\r?\n\}\}\}\r?$/m) do
id = Digest::SHA1.hexdigest($2)
@wsdmap[id] = { :style => $1, :code => $2 }
id
end
end
# Process all diagrams from the wsdmap and replace the placeholders with
# the final HTML.
#
# data - The String data (with placeholders).
#
# Returns the marked up String data.
def process_wsd(data)
@wsdmap.each do |id, spec|
style = spec[:style]
code = spec[:code]
data.gsub!(id, Gollum::WebSequenceDiagram.new(code, style).to_tag)
end
data
end
# Hook for getting the formatted value of extracted tag data.
#
# type - Symbol value identifying what type of data is being extracted.
# id - String SHA1 hash of original extracted tag data.
#
# Returns the String cached formatted data, or nil.
def check_cache(type, id)
end
# Hook for caching the formatted value of extracted tag data.
#
# type - Symbol value identifying what type of data is being extracted.
# id - String SHA1 hash of original extracted tag data.
# data - The String formatted value to be cached.
#
# Returns nothing.
def update_cache(type, id, data)
end
end
MarkupGFM = Markup
end
-430
View File
@@ -1,430 +0,0 @@
module Gollum
class Page
include Pagination
Wiki.page_class = self
VALID_PAGE_RE = /^(.+)\.(md|mkdn?|mdown|markdown|textile|rdoc|org|creole|re?st(\.txt)?|asciidoc|pod|(media)?wiki)$/i
FORMAT_NAMES = { :markdown => "Markdown",
:textile => "Textile",
:rdoc => "RDoc",
:org => "Org-mode",
:creole => "Creole",
:rest => "reStructuredText",
:asciidoc => "AsciiDoc",
:mediawiki => "MediaWiki",
:pod => "Pod" }
# Sets a Boolean determing whether this page is a historical version.
#
# Returns nothing.
attr_writer :historical
# Checks if a filename has a valid extension understood by GitHub::Markup.
#
# filename - String filename, like "Home.md".
#
# Returns the matching String basename of the file without the extension.
def self.valid_filename?(filename)
filename && filename.to_s =~ VALID_PAGE_RE && $1
end
# Checks if a filename has a valid extension understood by GitHub::Markup.
# Also, checks if the filename has no "_" in the front (such as
# _Footer.md).
#
# filename - String filename, like "Home.md".
#
# Returns the matching String basename of the file without the extension.
def self.valid_page_name?(filename)
match = valid_filename?(filename)
filename =~ /^_/ ? false : match
end
# Public: The format of a given filename.
#
# filename - The String filename.
#
# Returns the Symbol format of the page. One of:
# [ :markdown | :textile | :rdoc | :org | :rest | :asciidoc | :pod |
# :roff ]
def self.format_for(filename)
case filename.to_s
when /\.(md|mkdn?|mdown|markdown)$/i
:markdown
when /\.(textile)$/i
:textile
when /\.(rdoc)$/i
:rdoc
when /\.(org)$/i
:org
when /\.(creole)$/i
:creole
when /\.(re?st(\.txt)?)$/i
:rest
when /\.(asciidoc)$/i
:asciidoc
when /\.(pod)$/i
:pod
when /\.(\d)$/i
:roff
when /\.(media)?wiki$/i
:mediawiki
else
nil
end
end
# Reusable filter to turn a filename (without path) into a canonical name.
# Strips extension, converts dashes to spaces.
#
# Returns the filtered String.
def self.canonicalize_filename(filename)
strip_filename(filename).gsub('-', ' ')
end
# Reusable filter to strip extension and path from filename
#
# filename - The string path or filename to strip
#
# Returns the stripped String.
def self.strip_filename(filename)
::File.basename(filename, ::File.extname(filename))
end
# Public: Initialize a page.
#
# wiki - The Gollum::Wiki in question.
#
# Returns a newly initialized Gollum::Page.
def initialize(wiki)
@wiki = wiki
@blob = @footer = @sidebar = nil
end
# Public: The on-disk filename of the page including extension.
#
# Returns the String name.
def filename
@blob && @blob.name
end
# Public: The on-disk filename of the page with extension stripped.
#
# Returns the String name.
def filename_stripped
self.class.strip_filename(filename)
end
# Public: The canonical page name without extension, and dashes converted
# to spaces.
#
# Returns the String name.
def name
self.class.canonicalize_filename(filename)
end
# Public: If the first element of a formatted page is an <h1> tag it can
# be considered the title of the page and used in the display. If the
# first element is NOT an <h1> tag, the title will be constructed from the
# filename by stripping the extension and replacing any dashes with
# spaces.
#
# Returns the fully sanitized String title.
def title
doc = Nokogiri::HTML(%{<div id="gollum-root">} + self.formatted_data + %{</div>})
header =
case self.format
when :asciidoc
doc.css("div#gollum-root > div#header > h1:first-child")
when :org
doc.css("div#gollum-root > p.title:first-child")
when :pod
doc.css("div#gollum-root > a.dummyTopAnchor:first-child + h1")
when :rest
doc.css("div#gollum-root > div > div > h1:first-child")
else
doc.css("div#gollum-root > h1:first-child")
end
if !header.empty?
Sanitize.clean(header.to_html)
else
Sanitize.clean(name)
end.strip
end
# Public: The path of the page within the repo.
#
# Returns the String path.
attr_reader :path
# Public: The raw contents of the page.
#
# Returns the String data.
def raw_data
@blob && @blob.data
end
# Public: A text data encoded in specified encoding.
#
# encoding - An Encoding or nil
#
# Returns a character encoding aware String.
def text_data(encoding=nil)
if raw_data.respond_to?(:encoding)
raw_data.force_encoding(encoding || Encoding::UTF_8)
else
raw_data
end
end
# Public: The formatted contents of the page.
#
# encoding - Encoding Constant or String.
#
# Returns the String data.
def formatted_data(encoding = nil, &block)
@blob && markup_class.render(historical?, encoding, &block)
end
# Public: The format of the page.
#
# Returns the Symbol format of the page. One of:
# [ :markdown | :textile | :rdoc | :org | :rest | :asciidoc | :pod |
# :roff ]
def format
self.class.format_for(@blob.name)
end
# Gets the Gollum::Markup instance that will render this page's content.
#
# Returns a Gollum::Markup instance.
def markup_class
@markup_class ||= @wiki.markup_classes[format].new(self)
end
# Public: The current version of the page.
#
# Returns the Grit::Commit.
attr_reader :version
# Public: All of the versions that have touched the Page.
#
# options - The options Hash:
# :page - The Integer page number (default: 1).
# :per_page - The Integer max count of items to return.
# :follow - Follow's a file across renames, but falls back
# to a slower Grit native call. (default: false)
#
# Returns an Array of Grit::Commit.
def versions(options = {})
if options[:follow]
options[:pretty] = 'raw'
options.delete :max_count
options.delete :skip
log = @wiki.repo.git.native "log", options, @wiki.ref, "--", @path
Grit::Commit.list_from_string(@wiki.repo, log)
else
@wiki.repo.log(@wiki.ref, @path, log_pagination_options(options))
end
end
# Public: The footer Page.
#
# Returns the footer Page or nil if none exists.
def footer
@footer ||= find_sub_page(:footer)
end
# Public: The sidebar Page.
#
# Returns the sidebar Page or nil if none exists.
def sidebar
@sidebar ||= find_sub_page(:sidebar)
end
# Gets a Boolean determining whether this page is a historical version.
# Historical pages are pulled using exact SHA hashes and format all links
# with rel="nofollow"
#
# Returns true if the page is pulled from a named branch or tag, or false.
def historical?
!!@historical
end
#########################################################################
#
# Class Methods
#
#########################################################################
# Convert a human page name into a canonical page name.
#
# name - The String human page name.
# char_white_sub - Substitution for whitespace
# char_other_sub - Substitution for other special chars
#
# Examples
#
# Page.cname("Bilbo Baggins")
# # => 'Bilbo-Baggins'
#
# Page.cname("Bilbo Baggins",'_')
# # => 'Bilbo_Baggins'
#
# Returns the String canonical name.
def self.cname(name, char_white_sub = '-', char_other_sub = '-')
name.respond_to?(:gsub) ?
name.gsub(%r{\s},char_white_sub).gsub(%r{[/<>+]}, char_other_sub) :
''
end
# Convert a format Symbol into an extension String.
#
# format - The format Symbol.
#
# Returns the String extension (no leading period).
def self.format_to_ext(format)
case format
when :markdown then 'md'
when :textile then 'textile'
when :rdoc then 'rdoc'
when :org then 'org'
when :creole then 'creole'
when :rest then 'rest'
when :asciidoc then 'asciidoc'
when :pod then 'pod'
when :mediawiki then 'mediawiki'
end
end
#########################################################################
#
# Internal Methods
#
#########################################################################
# The underlying wiki repo.
#
# Returns the Gollum::Wiki containing the page.
attr_reader :wiki
# Set the Grit::Commit version of the page.
#
# Returns nothing.
attr_writer :version
# Find a page in the given Gollum repo.
#
# name - The human or canonical String page name to find.
# version - The String version ID to find.
#
# Returns a Gollum::Page or nil if the page could not be found.
def find(name, version)
map = @wiki.tree_map_for(version.to_s)
if page = find_page_in_tree(map, name)
page.version = version.is_a?(Grit::Commit) ?
version : @wiki.commit_for(version)
page.historical = page.version.to_s == version.to_s
page
end
rescue Grit::GitRuby::Repository::NoSuchShaFound
end
# Find a page in a given tree.
#
# map - The Array tree map from Wiki#tree_map.
# name - The canonical String page name.
# checked_dir - Optional String of the directory a matching page needs
# to be in. The string should
#
# Returns a Gollum::Page or nil if the page could not be found.
def find_page_in_tree(map, name, checked_dir = nil)
return nil if !map || name.to_s.empty?
if checked_dir = BlobEntry.normalize_dir(checked_dir)
checked_dir.downcase!
end
map.each do |entry|
next if entry.name.to_s.empty?
next unless checked_dir.nil? || entry.dir.downcase == checked_dir
next unless page_match(name, entry.name)
return entry.page(@wiki, @version)
end
return nil # nothing was found
end
# Populate the Page with information from the Blob.
#
# blob - The Grit::Blob that contains the info.
# path - The String directory path of the page file.
#
# Returns the populated Gollum::Page.
def populate(blob, path=nil)
@blob = blob
@path = "#{path}/#{blob.name}"[1..-1]
self
end
# The full directory path for the given tree.
#
# treemap - The Hash treemap containing parentage information.
# tree - The Grit::Tree for which to compute the path.
#
# Returns the String path.
def tree_path(treemap, tree)
if ptree = treemap[tree]
tree_path(treemap, ptree) + '/' + tree.name
else
''
end
end
# Compare the canonicalized versions of the two names.
#
# name - The human or canonical String page name.
# filename - the String filename on disk (including extension).
#
# Returns a Boolean.
def page_match(name, filename)
if match = self.class.valid_filename?(filename)
@wiki.ws_subs.each do |sub|
return true if Page.cname(name).downcase == Page.cname(match, sub).downcase
end
end
false
end
# Loads a sub page. Sub page nanes (footers) are prefixed with
# an underscore to distinguish them from other Pages.
#
# name - String page name.
#
# Returns the Page or nil if none exists.
def find_sub_page(name)
return nil unless self.version
return nil if self.filename =~ /^_/
name = "_#{name.to_s.capitalize}"
return nil if page_match(name, self.filename)
dirs = self.path.split('/')
dirs.pop
map = @wiki.tree_map_for(self.version.id)
while !dirs.empty?
if page = find_page_in_tree(map, name, dirs.join('/'))
return page
end
dirs.pop
end
find_page_in_tree(map, name, '')
end
def inspect
%(#<#{self.class.name}:#{object_id} #{name} (#{format}) @wiki=#{@wiki.repo.path.inspect}>)
end
end
end
-61
View File
@@ -1,61 +0,0 @@
module Gollum
module Pagination
def self.included(klass)
klass.extend ClassMethods
class << klass
# Default Integer max count of items to return in git commands.
attr_accessor :per_page
end
klass.per_page = 30
end
module ClassMethods
# Turns a page number into an offset number for the git skip option.
#
# page - Integer page number.
#
# Returns an Integer.
def page_to_skip(page)
([1, page.to_i].max - 1) * per_page
end
# Fills in git-specific options for the log command using simple
# pagination options.
#
# options - Hash of options:
# page - Optional Integer page number (default: 1)
# per_page - Optional Integer max count of items to return.
# Defaults to #per_class class method.
#
# Returns Hash with :max_count and :skip keys.
def log_pagination_options(options = {})
skip = page_to_skip(options.delete(:page))
options[:max_count] = [options.delete(:per_page).to_i, per_page].max
options[:skip] = skip if skip > 0
options
end
end
# Turns a page number into an offset number for the git skip option.
#
# page - Integer page number.
#
# Returns an Integer.
def page_to_skip(page)
self.class.page_to_skip(page)
end
# Fills in git-specific options for the log command using simple
# pagination options.
#
# options - Hash of options:
# page - Optional Integer page number (default: 1)
# per_page - Optional Integer max count of items to return.
# Defaults to #per_class class method.
#
# Returns Hash with :max_count and :skip keys.
def log_pagination_options(options = {})
self.class.log_pagination_options(options)
end
end
end
+128
View File
@@ -0,0 +1,128 @@
*, html {
font-family: Verdana, Arial, Helvetica, sans-serif;
}
#results a:hover {
background-color: #4c4c4c;
}
#home_button {
position: absolute;
top: 10px;
left: 50%;
}
#home_button .minibutton {
font-size: 1em;
text-align: center;
}
#results {
position: absolute;
top: 60px;
left: 10px;
}
body, form, ul, li, p, h1, h2, h3, h4, h5 {
margin: 0;
padding: 0;
}
body {
background-color: #606061;
color: #ffffff;
margin: 0;
}
img {
border: none;
}
p {
font-size: 1em;
margin: 0 0 1em 0;
}
html { font-size: 100%; /* IE hack */ }
body { font-size: 1em; /* Sets base font size to 16px */ }
table { font-size: 100%; /* IE hack */ }
input, select, textarea, th, td { font-size: 1em; }
/* Prevent wrapping on large file names. */
li.file {
white-space: nowrap;
}
/* CSS Tree menu styles */
ol.tree
{
padding: 0 0 0 30px;
width: 300px;
}
li
{
position: relative;
margin-left: -15px;
list-style: none;
}
li.file
{
margin-left: -1px !important;
height: 1.5em;
}
li.file a
{
color: #fff;
text-decoration: none;
display: inline-block;
}
li.file a span.icon
{
width: 14px;
height: 18px;
background: url(../images/fileview/document.png) 0 0 no-repeat;
display: inline-block;
margin-right: 7px;
vertical-align: text-top;
}
li.file a[href *= '.pdf'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href *= '.html'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.css'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.js'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li input
{
position: absolute;
left: 0;
margin-left: 0;
opacity: 0;
z-index: 2;
cursor: pointer;
height: 1em;
width: 1em;
top: 0;
}
li input + ol
{
background: url(../images/fileview/toggle-small-expand.png) 40px 0 no-repeat;
margin: -1.188em 0 0 -44px; /* 15px */
height: 1.5em;
}
li input + ol > li { display: none; margin-left: -14px !important; padding-left: 1px; }
li label
{
background: url(../images/fileview/folder-horizontal.png) 15px 1px no-repeat;
cursor: pointer;
display: block;
padding-left: 37px;
}
li input:checked + ol
{
background: url(../images/fileview/toggle-small.png) 40px 5px no-repeat;
margin: -1.5em 0 0 -44px; /* 20px */
padding: 1.563em 0 0 80px;
height: auto;
}
li input:checked + ol > li { display: block; margin: 0 0 0.125em; /* 2px */}
li input:checked + ol > li:last-child { margin: 0 0 0.063em; /* 1px */ }
@@ -80,13 +80,23 @@
line-height: 1.6em;
margin: 0.3em 0 0 0;
padding: 0.3em 0.5em;
width: 96.5%;
width: 94%;
}
#gollum-dialog-dialog-body fieldset .field input.code {
font-family: 'Monaco', 'Courier New', Courier, monospace;
}
#gollum-dialog-dialog-body fieldset .field span.context {
font-size: .9em;
color: #666;
}
#gollum-dialog-dialog-body fieldset .field span.context span.path {
font-family: 'Monaco', 'Courier New', Courier, monospace;
font-weight: bold;
}
#gollum-dialog-dialog-body fieldset .field:last-child {
margin: 0 0 1em 0;
}
@@ -138,4 +148,4 @@
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
background: -moz-linear-gradient(top, #599bdc, #3072b3);
}
}
@@ -30,6 +30,7 @@ a {
-webkit-border-radius: 1em;
}
.ff #gollum-editor,
.ie #gollum-editor {
padding-bottom: 1em;
}
@@ -51,9 +52,9 @@ a {
background: #fff;
border: 1px solid #ddd;
color: #000;
font-size: 1.3em;
font-size: 1.1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.8em;
line-height: 1.5em;
margin: 1em 0 0.4em;
padding: 0.5em;
width: 98%;
@@ -63,6 +64,12 @@ a {
color: #999;
}
#gollum-editor .path_note {
text-align: right;
font-size: small;
padding-right: 5px;
}
#gollum-editor-title-field input#gollum-editor-page-title {
font-weight: bold;
margin-top: 0;
@@ -192,62 +199,54 @@ a#function-help:hover span { background-position: -405px -28px; }
#gollum-editor #gollum-editor-function-bar #gollum-editor-format-selector {
overflow: hidden;
padding: 0 0 1.1em 0;
padding: .2em 0 .5em 0;
}
#gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector select {
background-color: #f9f9f9;
border: 1px solid transparent;
border: 1px solid #ddd;
color: #333;
float: right;
font-size: 1.1em;
font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold;
line-height: 1.6em;
padding: 0.5em 0.7em;
margin-bottom: 0;
padding: 0.3em 0.4em;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
-moz-outline: none;
}
#gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector select:hover {
background-color: #fff;
border: 1px solid #ddd;
-moz-outline: none;
}
#gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector label {
color: #999;
float: right;
font-size: 1.1em;
font-size: 1em;
font-weight: bold;
line-height: 1.6em;
padding: 0.6em 0.5em 0 0;
padding: .3em 0.5em 0 0;
}
#gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector label:after {
#gollum-editor-format-selector label:after {
content: ':';
}
/* @section form-fields */
#gollum-editor textarea#gollum-editor-body {
#gollum-editor textarea {
background: #fff;
border: 1px solid #ddd;
font-size: 1.3em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.8em;
font-size: 1em;
font-family: Consolas, "Liberation Mono", Courier, monospace;
line-height: 1.4em;
margin: 1em 0 0.4em;
padding: 0.5em; /* I don't really like mixing pct & em here… */
padding: 0.5em;
width: 98%;
height: 20em;
}
@@ -259,7 +258,7 @@ a#function-help:hover span { background-position: -405px -28px; }
cursor: pointer;
display: block;
float: left;
font-size: 1.2em;
font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold;
margin: 0;
@@ -301,7 +300,7 @@ a#function-help:hover span { background-position: -405px -28px; }
border-bottom: 1px solid #ddd;
display: block;
overflow: hidden;
padding: 1em 0 0.5em;
padding: 0.5em 0 0;
}
#gollum-editor #gollum-editor-body + .collapsed,
@@ -337,12 +336,15 @@ a#function-help:hover span { background-position: -405px -28px; }
font-size: 1.6em;
float: left;
margin: 0;
padding: 0.4em 0 0 0.3em;
padding: 0.15em 0 0 0.3em;
text-shadow: 0 -1px 0 #fff;
}
#gollum-editor .collapsed h4 {
color: #bbb;
}
#gollum-editor .collapsed a.button:hover,
#gollum-editor .expanded h4 a.button:hover {
#gollum-editor .expanded a.button:hover {
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
text-decoration: none;
@@ -385,10 +387,10 @@ a#function-help:hover span { background-position: -405px -28px; }
border: 1px solid #ddd;
clear: both;
display: block;
font-size: 1.3em;
font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
height: 7em;
line-height: 1.8em;
line-height: 1.4em;
margin: 0.7em 0;
padding: 0.5em;
width: 98%;
@@ -403,7 +405,7 @@ a#function-help:hover span { background-position: -405px -28px; }
color: #333;
cursor: pointer;
display: block;
font-size: 1.2em;
font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold;
line-height: 1.2em;
+734
View File
@@ -0,0 +1,734 @@
#wiki-wrapper #template blockquote {
margin: 1em 0;
border-left: 4px solid #ddd;
padding-left: .8em;
color: #555;
}
/*
gollum.css
A basic stylesheet for Gollum
*/
/* @section core */
body, html {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 10px;
margin: 0;
padding: 0;
}
#wiki-wrapper {
margin: 0 auto;
overflow: visible;
width: 920px;
padding-left:20px;
padding-right:20px;
}
a:link {
color: #4183c4;
text-decoration: none;
}
a:hover, a:visited {
color: #4183c4;
text-decoration: underline;
}
/* @section head */
#head {
border-bottom: 1px solid #ddd;
margin: 4em 0 1.5em;
padding-bottom: 0.3em;
overflow: hidden;
}
#head h1 {
font-size: 33px;
float: left;
line-height: normal;
margin: 0;
padding: 2px 0 0 0;
}
#head ul.actions {
float: right;
}
/* @section content */
#wiki-content {
height: 1%;
overflow: visible;
}
#wiki-content .wrap {
height: 1%;
overflow: auto;
}
/* @section comments */
#wiki-body #inline-comment {
display: none; /* todo */
}
/* @section body */
.has-leftbar #wiki-body {
float: right;
clear: right;
}
#wiki-body {
display: block;
float: left;
clear: left;
margin-right: 3%;
margin-bottom: 40px;
width: 100%;
}
.has-sidebar #wiki-body {
width: 68%;
}
/* @section toc */
#wiki-toc-main {
background-color: #F7F7F7;
border: 1px solid #DDD;
font-size: 13px;
padding: 0px 5px;
float: left;
margin-bottom: 20px;
min-width: 33%;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
}
#wiki-toc-main > div {
border: none;
}
/* @section sidebar */
.has-leftbar #wiki-sidebar {
float: left;
}
.has-rightbar #wiki-sidebar {
float: right;
}
#wiki-sidebar {
background-color: #f7f7f7;
border: 1px solid #ddd;
font-size: 13px;
padding: 7px;
width: 25%;
color: #555;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
}
#wiki-sidebar p {
margin: 13px 0 0;
}
#wiki-sidebar > p:first-child {
margin-top: 10px;
}
#wiki-sidebar p.parent {
border-bottom: 1px solid #bbb;
font-weight: bold;
margin: 0 0 0.5em 0;
padding: 0 0 0.5em 0;
text-shadow: 0 1px 0 #fff;
}
/* Back arrow */
#wiki-sidebar p.parent:before {
color: #666;
content: "← ";
}
/* @section footer */
#wiki-footer {
clear: both;
margin: 2em 0 5em;
}
.has-sidebar #wiki-footer {
width: 70%;
}
#wiki-header #header-content,
#wiki-footer #footer-content {
background-color: #f7f7f7;
border: 1px solid #ddd;
padding: 1em;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
}
#wiki-header #header-content {
margin-bottom: 1.5em;
}
#wiki-footer #footer-content {
margin-top: 1.5em;
}
#wiki-footer #footer-content h3 {
font-size: 1.2em;
color: #333;
margin: 0;
padding: 0 0 0.2em;
text-shadow: 0 1px 0 #fff;
}
#wiki-footer #footer-content p {
margin: 0.5em 0 0;
padding: 0;
}
#wiki-footer #footer-content ul.links {
margin: 0.5em 0 0;
overflow: hidden;
padding: 0;
}
#wiki-footer #footer-content ul.links li {
color: #999;
float: left;
list-style-position: inside;
list-style-type: square;
padding: 0;
margin-left: 0.75em;
}
#wiki-footer #footer-content ul.links li a {
font-weight: bold;
text-shadow: 0 1px 0 #fff;
}
#wiki-footer #footer-content ul.links li:first-child {
list-style-type: none;
margin: 0;
}
.ff #wiki-footer #footer-content ul.links li:first-child {
margin: 0 -0.75em 0 0;
}
/* @section page-footer */
.page #footer {
clear: both;
border-top: 1px solid #ddd;
margin: 1em 0 7em;
}
#footer p#last-edit {
font-size: .9em;
line-height: 1.6em;
color: #999;
margin: 0.9em 0;
}
#footer p#last-edit span.username {
font-weight: bold;
}
/* @section history */
.history h1 {
color: #999;
font-weight: normal;
}
.history h1 strong {
color: #000;
font-weight: bold;
}
#wiki-history {
margin-top: 2em;
}
#wiki-history fieldset {
border: 0;
margin: 1em 0;
padding: 0;
}
#wiki-history table, #wiki-history tbody {
border-collapse: collapse;
padding: 0;
margin: 0;
width: 100%;
}
#wiki-history table tr {
padding: 0;
margin: 0;
}
#wiki-history table tr {
background-color: #ebf2f6;
}
#wiki-history table tr td {
border: 1px solid #c0dce9;
font-size: 1em;
line-height: 1.6em;
margin: 0;
padding: 0.3em 0.7em;
}
#wiki-history table tr td.checkbox {
width: 4em;
padding: 0.3em;
}
#wiki-history table tr td.checkbox input {
cursor: pointer;
display: block;
padding-right: 0;
padding-top: 0.4em;
margin: 0 auto;
width: 1.2em;
height: 1.2em;
}
#wiki-history table tr:nth-child(2n),
#wiki-history table tr.alt-row {
background-color: #f3f7fa;
}
#wiki-history table tr.selected {
background-color: #ffffea !important;
z-index: 100;
}
#wiki-history table tr td.commit-name {
border-left: 0;
}
#wiki-history table tr td.commit-name span.time-elapsed {
color: #999;
}
#wiki-history table tr td.author {
width: 20%;
}
#wiki-history table tr td.author a {
color: #000;
font-weight: bold;
}
#wiki-history table tr td.author a span.username {
display: block;
padding-top: 3px;
}
#wiki-history table tr td img {
background-color: #fff;
border: 1px solid #999;
display: block;
float: left;
height: 18px;
overflow: hidden;
margin: 0 0.5em 0 0;
width: 18px;
padding: 2px;
}
#wiki-history table tr td.commit-name a {
font-size: 0.9em;
font-family: 'Monaco', 'Andale Mono', Consolas, 'Courier New', monospace;
padding: 0 0.2em;
}
.history #footer {
margin-bottom: 7em;
}
.history #wiki-history ul.actions li,
.history #footer ul.actions li {
margin: 0 0.6em 0 0;
}
/* @section edit */
.edit h1 {
color: #999;
font-weight: normal;
}
.edit h1 strong {
color: #000;
font-weight: bold;
}
/* @section search */
.results h1 {
color: #999;
font-weight: normal;
}
.results h1 strong {
color: #000;
font-weight: bold;
}
.results #results {
border-bottom: 1px solid #ccc;
margin-bottom: 2em;
padding-bottom: 2em;
}
.results #results ul {
margin: 2em 0 0 0;
padding: 0;
}
.results #results ul li {
font-size: 1.2em;
line-height: 1.6em;
list-style-position: outside;
padding: 0.2em 0;
}
.results #results ul li span.count {
color: #999;
}
.results p#no-results {
font-size: 1.2em;
line-height: 1.6em;
margin-top: 2em;
}
.results #footer ul.actions li {
margin: 0 1em 0 0;
}
/* @section compare */
.compare h1 {
color: #999;
font-weight: normal;
}
.compare h1 strong {
color: #000;
font-weight: bold;
}
.compare #compare-content {
margin-top: 3em;
}
.compare .data {
border: 1px solid #ddd;
margin: 1em 0 2em;
overflow: auto;
}
.compare .data table {
width: 100%;
}
.compare .data pre {
margin: 0;
padding: 0;
}
.compare .data pre div {
padding: 0 0 0 1em;
}
.compare .data tr td {
font-family: "Consolas", "Monaco", "Andale Mono", "Courier New", monospace;
font-size: 1.2em;
line-height: 1.2em;
margin: 0;
padding: 0;
}
.compare .data tr td + td + td {
width: 100%;
}
.compare .data td.line_numbers {
background: #f7f7f7;
border-right: 1px solid #999;
color: #999;
padding: 0 0 0 0.5em;
}
.compare #compare-content ul.actions li,
.compare #footer ul.actions li {
margin-left: 0;
margin-right: 0.6em;
}
.compare #footer {
margin-bottom: 7em;
}
/* @control syntax */
.highlight { background: #ffffff; }
.highlight .c { color: #999988; font-style: italic }
.highlight .err { color: #a61717; background-color: #e3d2d2 }
.highlight .k { font-weight: bold }
.highlight .o { font-weight: bold }
.highlight .cm { color: #999988; font-style: italic }
.highlight .cp { color: #999999; font-weight: bold }
.highlight .c1 { color: #999988; font-style: italic }
.highlight .cs { color: #999999; font-weight: bold; font-style: italic }
.highlight .gd { color: #000000; background-color: #ffdddd }
.highlight .gd .x { color: #000000; background-color: #ffaaaa }
.highlight .ge { font-style: italic }
.highlight .gr { color: #aa0000 }
.highlight .gh { color: #999999 }
.highlight .gi { color: #000000; background-color: #ddffdd }
.highlight .gi .x { color: #000000; background-color: #aaffaa }
.highlight .gc { color: #999; background-color: #EAF2F5 }
.highlight .go { color: #888888 }
.highlight .gp { color: #555555 }
.highlight .gs { font-weight: bold }
.highlight .gu { color: #aaaaaa }
.highlight .gt { color: #aa0000 }
/* @control minibutton */
ul.actions {
display: block;
list-style-type: none;
overflow: hidden;
padding: 0;
}
ul.actions li {
float: left;
font-size: 0.9em;
margin-left: 0.6em;
margin-bottom: 0.6em;
}
.minibutton a {
background-color: #f7f7f7;
border: 1px solid #d4d4d4;
color: #333;
display: block;
font-weight: bold;
margin: 0;
padding: 0.4em 1em;
height: 1.4em;
text-shadow: 0 1px 0 #fff;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
background: -moz-linear-gradient(top, #f4f4f4, #ececec);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
#search-submit {
background-color: #f7f7f7;
border: 1px solid #d4d4d4;
color: #333;
display: block;
font-weight: bold;
margin: 0;
padding: 0.4em 1em;
text-shadow: 0 1px 0 #fff;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
background: -moz-linear-gradient(top, #f4f4f4, #ececec);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
.minibutton a:hover,
#search-submit:hover {
background: #3072b3;
border-color: #518cc6 #518cc6 #2a65a0;
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
text-decoration: none;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
background: -moz-linear-gradient(top, #599bdc, #3072b3);
}
.minibutton a:visited {
text-decoration: none;
}
/* @special error */
#wiki-wrapper.error {
height: 1px;
position: absolute;
overflow: visible;
top: 50%;
width: 100%;
}
#error {
background-color: #f9f9f9;
border: 1px solid #e4e4e4;
left: 50%;
overflow: hidden;
padding: 2%;
margin: -10% 0 0 -35%;
position: absolute;
width: 70%;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
}
#error h1 {
font-size: 3em;
line-height: normal;
margin: 0;
padding: 0;
}
#error p {
font-size: 1.2em;
line-height: 1.6em;
margin: 1em 0 0.5em;
padding: 0;
}
/* @control searchbar */
#head #searchbar {
float: right;
padding: 0;
overflow: hidden;
}
#head #searchbar #searchbar-fauxtext {
background: #fff;
border: 1px solid #d4d4d4;
overflow: hidden;
height: 2.2em;
border-radius: 0.3em;
-moz-border-radius: 0.3em;
-webkit-border-radius: 0.3em;
}
#head #searchbar #searchbar-fauxtext input#search-query {
border: none;
color: #000;
float: left;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1em;
height: inherit;
padding: 0 .5em;
-webkit-focus-ring: none;
}
.ie8 #head #searchbar #searchbar-fauxtext input#search-query {
padding: 0.5em 0 0 0.5em;
}
#head #searchbar #searchbar-fauxtext input#search-query.ph {
color: #999;
}
#head #searchbar #searchbar-fauxtext #search-submit {
border: 0;
border-left: 1px solid #d4d4d4;
cursor: pointer;
margin: 0 !important;
padding: 0;
float: right;
height: inherit;
border-radius: 0 3px 3px 0;
-moz-border-radius: 0 3px 3px 0;
-webkit-border-radius: 0 3px 3px 0;
}
#head #searchbar #searchbar-fauxtext #search-submit span {
background-image: url(../images/icon-sprite.png);
background-position: -431px -1px;
background-repeat: no-repeat;
display: block;
height: inherit;
overflow: hidden;
text-indent: -5000px;
width: 28px;
}
.ff #head #searchbar #searchbar-fauxtext #search-submit span,
.ie #head #searchbar #searchbar-fauxtext #search-submit span {
height: 2.2em;
}
#head #searchbar #searchbar-fauxtext #search-submit:hover span {
background-position: -431px -28px;
padding: 0;
}
/* @section pages */
#pages {
font-size: 1.2em;
margin-bottom: 20px;
}
#pages ul {
list-style: none;
margin: 0;
padding: 0;
}
#pages li a.file,
#pages li a.folder {
background-image: url(../images/fileview/document.png);
background-position: 0 1px;
background-repeat: no-repeat;
padding-left: 20px;
}
#pages li a.folder {
background-image: url(../images/fileview/folder-horizontal.png);
}
#pages .breadcrumb {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0;
padding: 0.25em;
}
.clearfloats {
clear: both;
}
+630
View File
@@ -0,0 +1,630 @@
/*
Gollum v3 Template
*/
/* margin & padding reset*/
* {
margin: 0;
padding: 0;
}
html, body {
color: #333;
}
body {
font: 13.34px helvetica,arial,freesans,clean,sans-serif;
line-height: 1.4;
}
img {
border: 0;
}
a {
color: #4183C4;
text-decoration: none;
}
a.absent {
color: #c00;
}
.markdown-body a[id].wiki-toc-anchor {
color: inherit;
text-decoration: none;
}
.markdown-body {
font-size: 14px;
line-height: 1.6;
}
.markdown-body>*:first-child {
margin-top: 0!important;
}
.markdown-body>*:last-child {
margin-bottom: 0!important;
}
.markdown-body a.absent {
color: #c00;
}
.markdown-body a.anchor {
display: block;
padding-left: 30px;
margin-left: -30px;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
bottom: 0;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
cursor: text;
position: relative;
}
.markdown-body h1:hover a.anchor,
.markdown-body h2:hover a.anchor,
.markdown-body h3:hover a.anchor,
.markdown-body h4:hover a.anchor,
.markdown-body h5:hover a.anchor,
.markdown-body h6:hover a.anchor {
background: url(../images/pin-20.png) no-repeat left center;
text-decoration: none;
}
.markdown-body h1 tt,
.markdown-body h1 code,
.markdown-body h2 tt,
.markdown-body h2 code,
.markdown-body h3 tt,
.markdown-body h3 code,
.markdown-body h4 tt,
.markdown-body h4 code,
.markdown-body h5 tt,
.markdown-body h5 code,
.markdown-body h6 tt,
.markdown-body h6 code {
font-size: inherit;
}
.markdown-body h1 {
font-size: 28px;
color: #000;
margin-top: 20px;
margin-bottom: 10px;
}
.markdown-body h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
}
.markdown-body h3 {
font-size: 18px;
}
.markdown-body h4 {
font-size: 16px;
}
.markdown-body h5 {
font-size: 14px;
}
.markdown-body h6 {
color: #777;
font-size: 14px;
}
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre,
.markdown-body hr {
margin: 0px 0;
margin-bottom: 15px;
}
.markdown-body li {
margin: 0px;
}
.markdown-body hr {
background: transparent url(../images/dirty-shade.png) repeat-x 0 0;
border: 0 none;
color: #ccc;
height: 4px;
padding: 0;
}
.markdown-body>h1:first-child,
.markdown-body>h2:first-child,
.markdown-body>h3:first-child,
.markdown-body>h4:first-child,
.markdown-body>h5:first-child,
.markdown-body>h6:first-child {
}
.markdown-body h1+h2+h3{
margin-top: 30px;
}
.markdown-body a:first-child h1,
.markdown-body a:first-child h2,
.markdown-body a:first-child h3,
.markdown-body a:first-child h4,
.markdown-body a:first-child h5,
.markdown-body a:first-child h6 {
margin-top: 0;
padding-top: 0;
}
.markdown-body h1+p,
.markdown-body h2+p,
.markdown-body h3+p,
.markdown-body h4+p,
.markdown-body h5+p,
.markdown-body h6+p {
margin-top: 0;
}
.markdown-body li p.first {
display: inline-block;
}
.markdown-body ul,
.markdown-body ol {
padding-left: 30px;
}
.markdown-body ul li>:first-child,
.markdown-body ol li>:first-child {
margin-top: 0;
}
.markdown-body ul li>:last-child,
.markdown-body ol li>:last-child {
margin-bottom: 0;
}
.markdown-body dl {
padding: 0;
}
.markdown-body dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}
.markdown-body dl dt:first-child {
padding: 0;
}
.markdown-body dl dt>:first-child {
margin-top: 0;
}
.markdown-body dl dt>:last-child {
margin-bottom: 0;
}
.markdown-body dl dd {
margin: 0 0 15px;
padding: 0 15px;
}
.markdown-body dl dd>:first-child {
margin-top: 0;
}
.markdown-body dl dd>:last-child {
margin-bottom: 0;
}
.markdown-body blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}
.markdown-body blockquote>:first-child {
margin-top: 0;
}
.markdown-body blockquote>:last-child {
margin-bottom: 0;
}
.markdown-body table {
padding: 0;
border-collapse: collapse;
border-spacing: 0;
}
.markdown-body table tr {
border-top: 1px solid #ccc;
background-color: #fff;
margin: 0;
padding: 0;
}
.markdown-body table tr:nth-child(2n) {
background-color: #f8f8f8;
}
.markdown-body table tr th {
font-weight: bold;
}
.markdown-body table tr th,
.markdown-body table tr td {
border: 1px solid #ccc;
text-align: left;
margin: 0;
padding: 6px 13px;
}
.markdown-body table tr th>:first-child,
.markdown-body table tr td>:first-child {
margin-top: 0;
}
.markdown-body table tr th>:last-child,
.markdown-body table tr td>:last-child {
margin-bottom: 0;
}
.markdown-body img {
max-width: 100%;
}
.markdown-body span.frame {
display: block;
overflow: hidden;
}
.markdown-body span.frame>span {
border: 1px solid #ddd;
display: block;
float: left;
overflow: hidden;
margin: 13px 0 0;
padding: 7px;
width: auto;
}
.markdown-body span.frame span img {
display: block;
float: left;
}
.markdown-body span.frame span span {
clear: both;
color: #333;
display: block;
padding: 5px 0 0;
}
.markdown-body span.align-center {
display: block;
overflow: hidden;
clear: both;
}
.markdown-body span.align-center>span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: center;
}
.markdown-body span.align-center span img {
margin: 0 auto;
text-align: center;
}
.markdown-body span.align-right {
display: block;
overflow: hidden;
clear: both;
}
.markdown-body span.align-right>span {
display: block;
overflow: hidden;
margin: 13px 0 0;
text-align: right;
}
.markdown-body span.align-right span img {
margin: 0;
text-align: right;
}
.markdown-body span.float-left {
display: block;
margin-right: 13px;
overflow: hidden;
float: left;
}
.markdown-body span.float-left span {
margin: 13px 0 0;
}
.markdown-body span.float-right {
display: block;
margin-left: 13px;
overflow: hidden;
float: right;
}
.markdown-body span.float-right>span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: right;
}
.markdown-body code,
.markdown-body tt {
margin: 0 2px;
padding: 0 5px;
white-space: nowrap;
border: 1px solid #ddd;
background-color: #f8f8f8;
border-radius: 3px;
}
.markdown-body pre>tt,
.markdown-body pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
}
.markdown-body pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
}
.markdown-body pre pre,
.markdown-body pre code,
.markdown-body pre tt {
background-color: transparent;
border: none;
}
.markdown-body pre pre {
margin: 0;
padding: 0;
}
.toc {
background-color: #F7F7F7;
border: 1px solid #ddd;
padding: 5px 10px;
margin: 0;
border-radius: 3px;
}
.toc-title {
color: #888;
font-size: 14px;
line-height: 1.6;
padding: 2px;
border-bottom: 1px solid #ddd;
margin-bottom: 3px;
}
.toc ul {
padding-left: 10px;
margin: 0;
}
.toc>ul {
margin-left: 10px;
font-size: 17px;
}
.toc ul ul {
font-size: 15px;
}
.toc ul ul ul {
font-size: 14px;
}
.toc ul li{
margin: 0;
}
#header-content .toc,
#footer-content .toc,
#sidebar-content .toc {
border: none;
}
.highlight {
background: #fff;
}
.highlight .c {
color: #998;
font-style: italic;
}
.highlight .err {
color: #a61717;
background-color: #e3d2d2;
}
.highlight .k {
font-weight: bold;
}
.highlight .o {
font-weight: bold;
}
.highlight .cm {
color: #998;
font-style: italic;
}
.highlight .cp {
color: #999;
font-weight: bold;
}
.highlight .c1 {
color: #998;
font-style: italic;
}
.highlight .cs {
color: #999;
font-weight: bold;
font-style: italic;
}
.highlight .gd {
color: #000;
background-color: #fdd;
}
.highlight .gd .x {
color: #000;
background-color: #faa;
}
.highlight .ge {
font-style: italic;
}
.highlight .gr {
color: #a00;
}
.highlight .gh {
color: #999;
}
.highlight .gi {
color: #000;
background-color: #dfd;
}
.highlight .gi .x {
color: #000;
background-color: #afa;
}
.highlight .go {
color: #888;
}
.highlight .gp {
color: #555;
}
.highlight .gs {
font-weight: bold;
}
.highlight .gu {
color: #800080;
font-weight: bold;
}
.highlight .gt {
color: #a00;
}
.highlight .kc {
font-weight: bold;
}
.highlight .kd {
font-weight: bold;
}
.highlight .kn {
font-weight: bold;
}
.highlight .kp {
font-weight: bold;
}
.highlight .kr {
font-weight: bold;
}
.highlight .kt {
color: #458;
font-weight: bold;
}
.highlight .m {
color: #099;
}
.highlight .s {
color: #d14;
}
.highlight .na {
color: #008080;
}
.highlight .nb {
color: #0086B3;
}
.highlight .nc {
color: #458;
font-weight: bold;
}
.highlight .no {
color: #008080;
}
.highlight .ni {
color: #800080;
}
.highlight .ne {
color: #900;
font-weight: bold;
}
.highlight .nf {
color: #900;
font-weight: bold;
}
.highlight .nn {
color: #555;
}
.highlight .nt {
color: #000080;
}
.highlight .nv {
color: #008080;
}
.highlight .ow {
font-weight: bold;
}
.highlight .w {
color: #bbb;
}
.highlight .mf {
color: #099;
}
.highlight .mh {
color: #099;
}
.highlight .mi {
color: #099;
}
.highlight .mo {
color: #099;
}
.highlight .sb {
color: #d14;
}
.highlight .sc {
color: #d14;
}
.highlight .sd {
color: #d14;
}
.highlight .s2 {
color: #d14;
}
.highlight .se {
color: #d14;
}
.highlight .sh {
color: #d14;
}
.highlight .si {
color: #d14;
}
.highlight .sx {
color: #d14;
}
.highlight .sr {
color: #009926;
}
.highlight .s1 {
color: #d14;
}
.highlight .ss {
color: #990073;
}
.highlight .bp {
color: #999;
}
.highlight .vc {
color: #008080;
}
.highlight .vg {
color: #008080;
}
.highlight .vi {
color: #008080;
}
.highlight .il {
color: #099;
}
.highlight .gc {
color: #999;
background-color: #EAF2F5;
}
.type-csharp .highlight .k {
color: #00F;
}
.type-csharp .highlight .kt {
color: #00F;
}
.type-csharp .highlight .nf {
color: #000;
font-weight: normal;
}
.type-csharp .highlight .nc {
color: #2B91AF;
}
.type-csharp .highlight .nn {
color: #000;
}
.type-csharp .highlight .s {
color: #A31515;
}
.type-csharp .highlight .sc {
color: #A31515;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -24,7 +24,6 @@
* You don't need to do anything. Just run this on DOM ready.
*/
$.GollumEditor = function( IncomingOptions ) {
ActiveOptions = $.extend( DefaultOptions, IncomingOptions );
debug('GollumEditor loading');
@@ -39,7 +38,9 @@
$.GollumEditor.Placeholder.add($('#gollum-editor-edit-summary input'));
$('#gollum-editor form[name="gollum-editor"]').submit(function( e ) {
e.preventDefault();
$.GollumEditor.Placeholder.clearAll();
// Do not clear default place holder text
// Updated home (markdown)
// $.GollumEditor.Placeholder.clearAll();
debug('submitting');
$(this).unbind('submit');
$(this).submit();
@@ -64,6 +65,8 @@
var $form = $($('#gollum-editor form').get(0));
$form.attr('action', this.href || '/preview');
$form.attr('target', '_blank');
var paths = window.location.pathname.split('/');
$form.attr('page', paths[ paths.length - 1 ] || '')
$form.submit();
@@ -94,11 +97,8 @@
$('#gollum-editor-help').hide();
$('#gollum-editor-help').removeClass('jaws');
}
}
// EditorHas.functionBar
}
// EditorHas.baseEditorMarkup
} // EditorHas.functionBar
} // EditorHas.baseEditorMarkup
};
@@ -168,6 +168,11 @@
},
setActiveLanguage: function( name ) {
// On first load _ACTIVE_LANG.length is 0 and evtChangeFormat isn't called.
if ( LanguageDefinition._ACTIVE_LANG != null && LanguageDefinition._ACTIVE_LANG.length <= 0 ) {
FormatSelector.updateCommitMessage( name );
}
if(LanguageDefinition.getHookFunctionFor("deactivate")) {
LanguageDefinition.getHookFunctionFor("deactivate")();
}
@@ -192,6 +197,29 @@
if(LanguageDefinition.getHookFunctionFor("activate")) {
LanguageDefinition.getHookFunctionFor("activate")();
}
function hotkey( e, cmd ) {
e.preventDefault();
var def = LanguageDefinition.getDefinitionFor( cmd );
if ( typeof def == 'object' ) {
FunctionBar.executeAction( def );
}
// Prevent bubbling of hotkey.
return false;
}
Mousetrap.bind(['command+1', 'ctrl+1'], function( e ){ hotkey( e, 'function-h1' ); });
Mousetrap.bind(['command+2', 'ctrl+2'], function( e ){ hotkey( e, 'function-h2' ); });
Mousetrap.bind(['command+3', 'ctrl+3'], function( e ){ hotkey( e, 'function-h3' ); });
Mousetrap.bind(['command+b', 'ctrl+b'], function( e ){ hotkey( e, 'function-bold' ); });
Mousetrap.bind(['command+i', 'ctrl+i'], function( e ){ hotkey( e, 'function-italic' ); });
Mousetrap.bind(['command+s', 'ctrl+s'], function( e ){
e.preventDefault();
$("#gollum-editor-submit").trigger("click");
return false;
});
} );
} else {
LanguageDefinition._ACTIVE_LANG = name;
@@ -262,7 +290,7 @@
}
// attempt to load the definition for this language
var script_uri = '/javascript/editor/langs/' + markup_name + '.js';
var script_uri = baseUrl + '/javascript/editor/langs/' + markup_name + '.js';
$.ajax({
url: script_uri,
dataType: 'script',
@@ -747,9 +775,18 @@
*/
evtChangeFormat: function( e ) {
var newMarkup = $(this).val();
FormatSelector.updateCommitMessage( newMarkup );
LanguageDefinition.setActiveLanguage( newMarkup );
},
updateCommitMessage: function( newMarkup ) {
var msg = document.getElementById( "gollum-editor-message-field" );
var val = msg.value;
// Must start with created or updated.
if (/^(?:created|updated)/i.test(val)) {
msg.value = val.replace( /\([^\)]*\)$/, "(" + newMarkup + ")" );
}
},
/**
* FormatSelector.init
@@ -47,7 +47,8 @@ var ASCIIDoc = {
id: 'text',
name: 'Link Text',
type: 'text',
help: 'The text to display to the user.'
help: 'The text to display to the user.',
defaultValue: selText
},
{
id: 'href',
@@ -46,7 +46,8 @@ var Creole = {
id: 'text',
name: 'Link Text',
type: 'text',
help: 'The text to display to the user.'
help: 'The text to display to the user.',
defaultValue: selText
},
{
id: 'href',
@@ -32,7 +32,7 @@ var MarkDown = {
},
'function-code' : {
search: /(^[\n]+)([\n\s]*)/g,
search: /([^\n]+)([\n\s]*)/g,
replace: "`$1`$2"
},
@@ -44,11 +44,22 @@ var MarkDown = {
search: /(.+)([\n]?)/g,
replace: "* $1$2"
},
/* This looks silly but is completely valid Markdown */
/* based on rdoc.js */
'function-ol' : {
search: /(.+)([\n]?)/g,
replace: "1. $1$2"
exec: function( txt, selText, $field ) {
var count = 1;
// split into lines
var repText = '';
var lines = selText.split("\n");
var hasContent = /[\w]+/;
for ( var i = 0; i < lines.length; i++ ) {
if ( hasContent.test(lines[i]) ) {
repText += (i + 1).toString() + '. ' +
lines[i] + "\n";
}
}
$.GollumEditor.replaceSelection( repText );
}
},
'function-blockquote' : {
@@ -80,7 +91,8 @@ var MarkDown = {
{
id: 'text',
name: 'Link Text',
type: 'text'
type: 'text',
defaultValue: selText
},
{
id: 'href',
@@ -60,7 +60,8 @@ var OrgMode = {
{
id: 'text',
name: 'Link Text',
type: 'text'
type: 'text',
defaultValue: selText
},
{
id: 'href',
@@ -44,7 +44,8 @@ var Pod = {
{
id: 'text',
name: 'Link Text',
type: 'text'
type: 'text',
defaultValue: selText
},
{
id: 'href',
@@ -49,7 +49,8 @@ var Textile = {
id: 'text',
name: 'Link Text',
type: 'text',
help: 'The text to display to the user.'
help: 'The text to display to the user.',
defaultValue: selText
},
{
id: 'href',
@@ -37,11 +37,14 @@
fieldMarkup += '<div class="field">';
switch ( fieldArray[i].type ) {
// only text is supported for now
case 'text':
fieldMarkup += Dialog.createFieldText( fieldArray[i] );
break;
case 'file':
fieldMarkup += Dialog.createFieldFile( fieldArray[i] );
break;
default:
break;
@@ -60,7 +63,7 @@
if ( fieldAttributes.name ) {
html += '<label';
if ( fieldAttributes.id ) {
html += ' for="' + fieldAttributes.name + '"';
html += ' for="gollum-dialog-dialog-generated-field-' + fieldAttributes.id + '"';
}
html += '>' + fieldAttributes.name + '</label>';
}
@@ -72,10 +75,33 @@
if ( fieldAttributes.type == 'code' ) {
html+= ' class="code"';
}
if ( fieldAttributes.defaultValue ) {
html+= ' value="' + fieldAttributes.defaultValue.split('"').join('&quot;') + '"';
}
html += ' id="gollum-dialog-dialog-generated-field-' +
fieldAttributes.id + '">';
}
if( fieldAttributes.context ){
html += '<span class="context">' + fieldAttributes.context + '</span>';
}
return html;
},
createFieldFile: function( fieldAttributes ) {
// Not actually a field, but an embedded form.
var html = '';
var id = fieldAttributes.id || 'upload';
var name = fieldAttributes.name || 'file';
var action = fieldAttributes.action || 'uploadFile';
html += '<form method=post enctype="multipart/form-data" ' +
'action="' + action + '" ' + 'id="' + id + '">';
html += '<input type=file name="' + name + '">';
html += '</form>';
return html;
},
@@ -230,6 +256,7 @@
$('#gollum-dialog-dialog').animate({ opacity: 1 }, {
duration: 500
});
$($('#gollum-dialog-dialog input[type="text"]').get(0)).focus();
}
});
}
+331
View File
@@ -0,0 +1,331 @@
// Helpers
function pageName(){
// "my/dir/file" => "file"
return typeof(pageFullPath) == 'undefined' ? undefined : pageFullPath.split('/').pop();
}
function pagePath(){
// "my/dir/file" => "my/dir"
return typeof(pageFullPath) == 'undefined' ? undefined : pageFullPath.split('/').slice(0,-1).join('/');
}
// Generic HTML escape function
function htmlEscape( str ) {
// The (slower) alternative is: return $('<div/>').text(str).html();
// http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding/7124052#7124052
return String(str)
.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
// Given a page name and a current path, returns a fully qualified path.
function abspath(path, name){
// Make sure the given path starts at the root.
if(name[0] != '/'){
name = '/' + name;
if (path) {
name = '/' + path + name;
}
}
var name_parts = name.split('/');
var newPath = name_parts.slice(0, -1).join('/');
var newName = name_parts.pop();
// return array of [path, name]
return [newPath, newName];
}
// ua
$(document).ready(function() {
$('#delete-link').click( function(e) {
var ok = confirm($(this).data('confirm'));
if ( ok ) {
var loc = baseUrl + '/delete/' + pageFullPath;
window.location = loc;
}
// Don't navigate on cancel.
e.preventDefault();
} );
var nodeSelector = {
node1: null,
node2: null,
selectNodeRange: function( n1, n2 ) {
if ( nodeSelector.node1 && nodeSelector.node2 ) {
$('#wiki-history td.selected').removeClass('selected');
nodeSelector.node1.addClass('selected');
nodeSelector.node2.addClass('selected');
// swap the nodes around if they went in reverse
if ( nodeSelector.nodeComesAfter( nodeSelector.node1,
nodeSelector.node2 ) ) {
var n = nodeSelector.node1;
nodeSelector.node1 = nodeSelector.node2;
nodeSelector.node2 = n;
}
var s = true;
var $nextNode = nodeSelector.node1.next();
while ( $nextNode ) {
$nextNode.addClass('selected');
if ( $nextNode[0] == nodeSelector.node2[0] ) {
break;
}
$nextNode = $nextNode.next();
}
}
},
nodeComesAfter: function ( n1, n2 ) {
var s = false;
$(n1).prevAll().each(function() {
if ( $(this)[0] == $(n2)[0] ) {
s = true;
}
});
return s;
},
checkNode: function( nodeCheckbox ) {
var $nodeCheckbox = nodeCheckbox;
var $node = $(nodeCheckbox).parent().parent();
// if we're unchecking
if ( !$nodeCheckbox.is(':checked') ) {
// remove the range, since we're breaking it
$('#wiki-history tr.selected').each(function() {
if ( $(this).find('td.checkbox input').is(':checked') ) {
return;
}
$(this).removeClass('selected');
});
// no longer track this
if ( $node[0] == nodeSelector.node1[0] ) {
nodeSelector.node1 = null;
if ( nodeSelector.node2 ) {
nodeSelector.node1 = nodeSelector.node2;
nodeSelector.node2 = null;
}
} else if ( $node[0] == nodeSelector.node2[0] ) {
nodeSelector.node2 = null;
}
} else {
if ( !nodeSelector.node1 ) {
nodeSelector.node1 = $node;
nodeSelector.node1.addClass('selected');
} else if ( !nodeSelector.node2 ) {
// okay, we don't have a node 2 but have a node1
nodeSelector.node2 = $node;
nodeSelector.node2.addClass('selected');
nodeSelector.selectNodeRange( nodeSelector.node1,
nodeSelector.node2 );
} else {
// we have two selected already
$nodeCheckbox[0].checked = false;
}
}
}
};
// ua detection
if ($.browser.mozilla) {
$('body').addClass('ff');
} else if ($.browser.webkit) {
$('body').addClass('webkit');
} else if ($.browser.msie) {
$('body').addClass('ie');
if ($.browser.version == "7.0") {
$('body').addClass('ie7');
} else if ($.browser.version == "8.0") {
$('body').addClass('ie8');
}
}
if ($('#minibutton-upload-page').length) {
$('#minibutton-upload-page').parent().removeClass('jaws');
$('#minibutton-upload-page').click(function(e) {
e.preventDefault();
$.GollumDialog.init({
title: 'Upload File',
fields: [
{
type: 'file'
}
],
OK: function( res ) {
$('#upload').submit();
}
});
});
}
if ($('#minibutton-rename-page').length) {
$('#minibutton-rename-page').parent().removeClass('jaws');
$('#minibutton-rename-page').click(function(e) {
e.preventDefault();
var path = pagePath();
var oldName = pageName();
var context_blurb =
"Renamed page will be under " +
"<span class='path'>" + htmlEscape('/' + path) + "</span>" +
" unless an absolute path is given."
$.GollumDialog.init({
title: 'Rename Page',
fields: [
{
id: 'name',
name: 'Rename to',
type: 'text',
defaultValue: oldName || '',
context: context_blurb
}
],
OK: function( res ) {
var newName = 'Rename Page';
if ( res['name'] ) {
newName = res['name'];
}
var name_parts = abspath(path, newName);
var newPath = name_parts[0];
var msg = '/' + path == newPath ? 'Renamed ' + oldName + ' to ' + newName
: 'Renamed ' + oldName + ' to ' + name_parts.join('/');
// Fill in the rename form
// This is preferable to AJAX so that we automatically follow the 302 response.
var rename_form = $("form[name=rename]");
rename_form.children("input[name=rename]").val(name_parts.join('/'));
rename_form.children("input[name=message]").val(msg);
rename_form.submit();
}
});
});
}
if ($('#minibutton-new-page').length) {
$('#minibutton-new-page').parent().removeClass('jaws');
$('#minibutton-new-page').click(function(e) {
e.preventDefault();
var path = pagePath();
if( path === undefined && $('#file-browser').length != 0 ){
// In the pages view, pageFullPath isn't defined.
// The new button will still expect a value however.
// So we try to figure one out from window.location
path = baseUrl == '' ? window.location.pathname.substr(1)
: window.location.pathname.substr(baseUrl.length + 1);
// Remove the page viewer part of the url.
path = path.replace(/^pages\/?/,'')
// For consistency remove the trailing /
path = path.replace(/\/$/,'')
}
var context_blurb =
"Page will be created under " +
"<span class='path'>" + htmlEscape('/' + path) + "</span>" +
" unless an absolute path is given."
$.GollumDialog.init({
title: 'Create New Page',
fields: [
{
id: 'name',
name: 'Page Name',
type: 'text',
defaultValue: '',
context: context_blurb
}
],
OK: function( res ) {
var name = 'New Page';
if ( res['name'] ) {
name = res['name'];
}
var name_encoded = [];
var name_parts = abspath(path, name).join('/').split('/');
// Split and encode each component individually.
for( var i=0; i < name_parts.length; i++ ){
name_encoded.push(encodeURIComponent(name_parts[i]));
}
window.location = baseUrl + name_encoded.join('/');
}
});
});
}
if ($('#wiki-wrapper').hasClass('history')) {
$('#wiki-history td.checkbox input').each(function() {
$(this).click(function() {
nodeSelector.checkNode($(this));
});
if ( $(this).is(':checked') ) {
nodeSelector.checkNode($(this));
}
});
if ($('.history a.action-compare-revision').length) {
$('.history a.action-compare-revision').click(function() {
$("#version-form").submit();
});
}
}
if ($('#searchbar a#search-submit').length) {
$.GollumPlaceholder.add($('#searchbar #search-query'));
$('#searchbar a#search-submit').click(function(e) {
e.preventDefault();
$('#searchbar #search-form')[0].submit();
});
$('#searchbar #search-form').submit(function(e) {
$.GollumPlaceholder.clearAll();
$(this).unbind('submit');
$(this).submit();
});
}
if ($('#gollum-revert-form').length &&
$('.gollum-revert-button').length ) {
$('a.gollum-revert-button').click(function(e) {
e.preventDefault();
$('#gollum-revert-form').submit();
});
}
if( $('#wiki-wrapper.edit').length ){
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
$("#gollum-editor-body").one('change', function(){
window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
});
$.GollumEditor();
}
if( $('#wiki-wrapper.create').length ){
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
$("#gollum-editor-body").one('change', function(){
window.onbeforeunload = function(){ return "Leaving will not create a new page!" };
});
$.GollumEditor({ NewFile: true, MarkupType: default_markup });
}
if( $('#wiki-history').length ){
var lookup = {};
$('img.identicon').each(function(index, element){
var $item = $(element);
var code = parseInt($item.data('identicon'), 10);
var img_bin = lookup[code];
if( img_bin === undefined ){
var size = 16;
var canvas = $('<canvas width=16 height=16/>').get(0);
render_identicon(canvas, code, 16);
img_bin = canvas.toDataURL("image/png");
lookup[code] = img_bin;
}
$item.attr('src', img_bin);
});
}
});
@@ -0,0 +1,111 @@
/*
Client-side Canvas tag based Identicon rendering code
@author Don Park
@version 0.2
@date January 21th, 2007
*/
var patch0 = new Array( 0, 4, 24, 20 );
var patch1 = new Array( 0, 4, 20 );
var patch2 = new Array( 2, 24, 20 );
var patch3 = new Array( 0, 2, 20, 22 );
var patch4 = new Array( 2, 14, 22, 10 );
var patch5 = new Array( 0, 14, 24, 22 );
var patch6 = new Array( 2, 24, 22, 13, 11, 22, 20 );
var patch7 = new Array( 0, 14, 22 );
var patch8 = new Array( 6, 8, 18, 16 );
var patch9 = new Array( 4, 20, 10, 12, 2 );
var patch10 = new Array( 0, 2, 12, 10 );
var patch11 = new Array( 10, 14, 22 );
var patch12 = new Array( 20, 12, 24 );
var patch13 = new Array( 10, 2, 12 );
var patch14 = new Array( 0, 2, 10 );
var patchTypes = new Array( patch0, patch1, patch2, patch3, patch4,
patch5, patch6, patch7, patch8, patch9, patch10, patch11,
patch12, patch13, patch14, patch0 );
var centerPatchTypes = new Array(0, 4, 8, 15);
function render_identicon_patch(ctx, x, y, size, patch, turn, invert, foreColor, backColor) {
patch %= patchTypes.length;
turn %= 4;
if (patch == 15)
invert = !invert;
var vertices = patchTypes[patch];
var offset = size / 2;
var scale = size / 4;
ctx.save();
// paint background
ctx.fillStyle = invert ? foreColor : backColor;
ctx.fillRect(x, y, size, size);
// build patch path
ctx.translate(x + offset, y + offset);
ctx.rotate(turn * Math.PI / 2);
ctx.beginPath();
ctx.moveTo((vertices[0] % 5 * scale - offset), (Math.floor(vertices[0] / 5) * scale - offset));
for (var i = 1; i < vertices.length; i++)
ctx.lineTo((vertices[i] % 5 * scale - offset), (Math.floor(vertices[i] / 5) * scale - offset));
ctx.closePath();
// offset and rotate coordinate space by patch position (x, y) and
// 'turn' before rendering patch shape
// render rotated patch using fore color (back color if inverted)
ctx.fillStyle = invert ? backColor : foreColor;
ctx.fill();
// restore rotation
ctx.restore();
}
function render_identicon(node, code, size) {
if (!node || !code || !size) return;
var patchSize = size / 3;
var middleType = centerPatchTypes[code & 3];
var middleInvert = ((code >> 2) & 1) != 0;
var cornerType = (code >> 3) & 15;
var cornerInvert = ((code >> 7) & 1) != 0;
var cornerTurn = (code >> 8) & 3;
var sideType = (code >> 10) & 15;
var sideInvert = ((code >> 14) & 1) != 0;
var sideTurn = (code >> 15) & 3;
var blue = (code >> 16) & 31;
var green = (code >> 21) & 31;
var red = (code >> 27) & 31;
var foreColor = "rgb(" + (red << 3) + "," + (green << 3) + "," + (blue << 3) + ")";
var backColor = "rgb(255,255,255)";
var ctx = node.getContext("2d");
// middle patch
render_identicon_patch(ctx, patchSize, patchSize, patchSize, middleType, 0, middleInvert, foreColor, backColor);
// side patchs, starting from top and moving clock-wise
render_identicon_patch(ctx, patchSize, 0, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
render_identicon_patch(ctx, patchSize * 2, patchSize, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
render_identicon_patch(ctx, patchSize, patchSize * 2, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
render_identicon_patch(ctx, 0, patchSize, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
// corner patchs, starting from top left and moving clock-wise
render_identicon_patch(ctx, 0, 0, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
render_identicon_patch(ctx, patchSize * 2, 0, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
render_identicon_patch(ctx, patchSize * 2, patchSize * 2, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
render_identicon_patch(ctx, 0, patchSize * 2, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
}
function render_identicon_canvases(prefix) {
var canvases = document.getElementsByTagName("canvas");
var n = canvases.length;
for (var i = 0; i < n; i++) {
var node = canvases[i];
if (node.title && node.title.indexOf(prefix) == 0) {
if (node.style.display == 'none') node.style.display = "inline";
var code = node.title.substring(prefix.length) * 1;
var size = node.width;
render_identicon(node, code, size);
}
}
}
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
/* mousetrap v1.1.2 craig.is/killing/mice */
window.Mousetrap=function(){function o(a,c,b){if(a.addEventListener)return a.addEventListener(c,b,!1);a.attachEvent("on"+c,b)}function u(a){return"keypress"==a.type?String.fromCharCode(a.which):h[a.which]?h[a.which]:v[a.which]?v[a.which]:String.fromCharCode(a.which).toLowerCase()}function p(a){var a=a||{},c=!1,b;for(b in l)a[b]?c=!0:l[b]=0;c||(n=!1)}function w(a,c,b,d,C){var g,e,f=[];if(!j[a])return[];"keyup"==b&&q(a)&&(c=[a]);for(g=0;g<j[a].length;++g)if(e=j[a][g],!(e.seq&&l[e.seq]!=e.level)&&b==
e.action&&("keypress"==b||c.sort().join(",")===e.modifiers.sort().join(",")))d&&e.combo==C&&j[a].splice(g,1),f.push(e);return f}function r(a,c){!1===a(c)&&(c.preventDefault&&c.preventDefault(),c.stopPropagation&&c.stopPropagation(),c.returnValue=!1,c.cancelBubble=!0)}function s(a){a.which="number"==typeof a.which?a.which:a.keyCode;var c=u(a);if(c)if("keyup"==a.type&&t==c)t=!1;else{var b=a.target||a.srcElement,d=b.tagName;if(!(-1<(" "+b.className+" ").indexOf(" mousetrap ")?0:"INPUT"==d||"SELECT"==
d||"TEXTAREA"==d||b.contentEditable&&"true"==b.contentEditable)){b=[];a.shiftKey&&b.push("shift");a.altKey&&b.push("alt");a.ctrlKey&&b.push("ctrl");a.metaKey&&b.push("meta");for(var b=w(c,b,a.type),f={},g=!1,d=0;d<b.length;++d)b[d].seq?(g=!0,f[b[d].seq]=1,r(b[d].callback,a)):!g&&!n&&r(b[d].callback,a);a.type==n&&!q(c)&&p(f)}}}function q(a){return"shift"==a||"ctrl"==a||"alt"==a||"meta"==a}function x(a,c,b){if(!b){if(!k){k={};for(var d in h)95<d&&112>d||h.hasOwnProperty(d)&&(k[h[d]]=d)}b=k[a]?"keydown":
"keypress"}"keypress"==b&&c.length&&(b="keydown");return b}function y(a,c,b,d,f){var a=a.replace(/\s+/g," "),g=a.split(" "),e,h,i=[];if(1<g.length){var k=a,m=b;l[k]=0;m||(m=x(g[0],[]));a=function(){n=m;++l[k];clearTimeout(z);z=setTimeout(p,1E3)};b=function(a){r(c,a);"keyup"!==m&&(t=u(a));setTimeout(p,10)};for(d=0;d<g.length;++d)y(g[d],d<g.length-1?a:b,m,k,d)}else{h="+"===a?["+"]:a.split("+");for(g=0;g<h.length;++g)e=h[g],A[e]&&(e=A[e]),b&&("keypress"!=b&&B[e])&&(e=B[e],i.push("shift")),q(e)&&i.push(e);
b=x(e,i,b);j[e]||(j[e]=[]);w(e,i,b,!d,a);j[e][d?"unshift":"push"]({callback:c,modifiers:i,action:b,seq:d,level:f,combo:a})}}for(var h={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},v={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},B=
{"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},A={option:"alt",command:"meta","return":"enter",escape:"esc"},k,j={},i={},l={},z,t=!1,n=!1,f=1;20>f;++f)h[111+f]="f"+f;for(f=0;9>=f;++f)h[f+96]=f;o(document,"keypress",s);o(document,"keydown",s);o(document,"keyup",s);return{bind:function(a,c,b){for(var d=a instanceof Array?a:[a],f=0;f<d.length;++f)y(d[f],c,b);i[a+":"+b]=c},unbind:function(a,c){i[a+
":"+c]&&(delete i[a+":"+c],this.bind(a,function(){},c))},trigger:function(a,c){i[a+":"+c]()},reset:function(){j={};i={}}}}();
@@ -0,0 +1,132 @@
body {
overflow: hidden;
}
#editor .ace_sb {
overflow-y: auto !important;
}
#darkness {
visibility: hidden;
position: absolute;
left: 0px;
top: 0px;
background-color: black;
opacity: 0.8;
z-index: 1001; /* must be > 1000 to overlay ace gutter */
}
#commenttoolpanel {
visibility: hidden;
z-index: 1002; /* > 1001 to not be hidden by darkness */
}
#comment, #editor {
margin: 0;
padding: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
/* Set font size of both ace editors. */
font-size: 16px;
}
/*
Must set ace-line to preserve whitespace in empty lines.
Ace editor sets the height inline. The static highlight ext does not.
<div class="ace_line" style="height:15px"></div>
*/
#previewframe #contentframe .ace-github .ace_editor.ace_scroller.ace_text-layer .ace_line {
height: 15px;
}
/* Set comment to have a higher z-index
so editor doesn't display in the background. */
#comment {
visibility: hidden;
z-index: 1003; /* > 1002 to not be hidden by toolpanel */
}
#contentframe {
margin: 0 auto;
overflow: visible;
width: 90%;
}
#previewframe {
margin: 0;
padding: 0;
position: absolute;
overflow: auto;
top: 0;
bottom: 0;
left: 10px;
right: 0;
}
.editor_bg {
position: fixed;
top: 0;
margin: 0;
padding: 0;
background: black;
width: 50%;
height: 100%;
z-index: -2;
}
.toolpanel_bg {
position: fixed;
background: #666;
top: 0;
height: 30px;
width: 100%;
padding: 5px 0;
margin: 0;
z-index: -1;
}
/* -- Start from notepag.es -- */
.toolpanel {
position: fixed;
background: #666;
top: 0;
height: 30px;
width: 50%;
vertical-align: middle;
padding: 5px 0;
margin: 0;
text-align: center;
}
.toolpanel.edit a.edit {
opacity: 0.4;
/* Make it appear as a link even though save
doesn't have a href attribute. */
cursor: pointer;
display: inline-block;
}
.toolpanel a {
color: white;
text-decoration: none;
margin: 0 5px;
display: none;
padding: 4px;
font-family: sans-serif;
}
.toolpanel a img {
vertical-align: middle;
margin-left: 5px;
margin: 0;
padding: 0;
}
a img {
border: none;
}
/* -- End from notepag.es -- */
Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<title>Live Preview</title>
<link rel='stylesheet' type='text/css' href='../css/template.css' />
<link rel='stylesheet' type='text/css' href='css/custom.css' />
</head>
<body>
<div id='editor'></div>
<div id='previewframe'><div id='contentframe' class='markdown-body'></div></div>
<!-- tool panel from notepage.es. save & savecomment icons from Retina Display Icon Set. -->
<div id='toolpanel' class='toolpanel edit' style='width: 500px; right: 0px; visibility: hidden;'>
<a id='preview' class='edit'><img src='images/globe_24.png' alt='Preview' title='Preview'></a>
<a id='save' class='edit'><img src='images/save_24.png' alt='Save' title='Save'></a>
<a id='savecomment' class='edit'><img src='images/savecomment_24.png' alt='Save with comment' title='Save with comment'></a>
<a id='toggle' class='edit' href='javascript:void(0)' onclick='jsm.toggleLeftRight();'><img src='images/lr_24.png' alt='Toggle left to right' title='Toggle left to right'></a>
</div>
<div id='editor_bg' class='editor_bg'></div>
<div class='toolpanel_bg'></div>
<div id='commenttoolpanel' class='toolpanel edit' style='width: 500px; right: 0px; '>
<a id='savecommentconfirm' class='edit'><img src='images/savecomment_24.png' alt='Confirm save with comment' title='Confirm save with comment'></a>
<a id='commentcancel' class='edit'><img src='images/cancel_24.png' alt='Cancel save with comment' title='Cancel save with comment'></a>
</div>
<div id='comment'></div>
<div id='darkness'></div>
<script>
var require = {
paths: {
ace: 'js/ace/lib/ace'
}
};
</script>
<script src='js/requirejs.min.js'></script>
<script src='../javascript/jquery-1.7.2.min.js'></script>
<script src='js/jquery.ba-throttle-debounce.min.js'></script>
<script src='js/sundown.js'></script>
<script src='js/md_sundown.js'></script>
<script src='js/livepreview.js'></script>
</body>
</html>
@@ -0,0 +1,107 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
/**
* The main class required to set up an Ace instance in the browser.
*
* @class Ace
**/
define(function(require, exports, module) {
"use strict";
require("./lib/fixoldbrowsers");
var dom = require("./lib/dom");
var event = require("./lib/event");
var Editor = require("./editor").Editor;
var EditSession = require("./edit_session").EditSession;
var UndoManager = require("./undomanager").UndoManager;
var Renderer = require("./virtual_renderer").VirtualRenderer;
var MultiSelect = require("./multi_select").MultiSelect;
// The following require()s are for inclusion in the built ace file
require("./worker/worker_client");
require("./keyboard/hash_handler");
require("./placeholder");
require("./mode/folding/fold_mode");
exports.config = require("./config");
/**
* Provides access to require in packed noconflict mode
* @param {String} moduleName
* @returns {Object}
*
**/
exports.require = require;
/**
* Embeds the Ace editor into the DOM, at the element provided by `el`.
* @param {String | DOMElement} el Either the id of an element, or the element itself
*
**/
exports.edit = function(el) {
if (typeof(el) == "string") {
var _id = el;
var el = document.getElementById(_id);
if (!el)
throw "ace.edit can't find div #" + _id;
}
if (el.env && el.env.editor instanceof Editor)
return el.env.editor;
var doc = exports.createEditSession(dom.getInnerText(el));
el.innerHTML = '';
var editor = new Editor(new Renderer(el));
new MultiSelect(editor);
editor.setSession(doc);
var env = {
document: doc,
editor: editor,
onResize: editor.resize.bind(editor)
};
event.addListener(window, "resize", env.onResize);
el.env = editor.env = env;
return editor;
};
exports.createEditSession = function(text, mode) {
var doc = new EditSession(text, doc);
doc.setUndoManager(new UndoManager());
return doc;
}
exports.EditSession = EditSession;
exports.UndoManager = UndoManager;
});
@@ -0,0 +1,248 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("./lib/oop");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
/**
*
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.
*
* @class Anchor
**/
/**
* Creates a new `Anchor` and associates it with a document.
*
* @param {Document} doc The document to associate with the anchor
* @param {Number} row The starting row position
* @param {Number} column The starting column position
*
* @constructor
**/
var Anchor = exports.Anchor = function(doc, row, column) {
this.document = doc;
if (typeof column == "undefined")
this.setPosition(row.row, row.column);
else
this.setPosition(row, column);
this.$onChange = this.onChange.bind(this);
doc.on("change", this.$onChange);
};
(function() {
oop.implement(this, EventEmitter);
/**
* Returns an object identifying the `row` and `column` position of the current anchor.
* @returns {Object}
**/
this.getPosition = function() {
return this.$clipPositionToDocument(this.row, this.column);
};
/**
*
* Returns the current document.
* @returns {Document}
**/
this.getDocument = function() {
return this.document;
};
/**
* Fires whenever the anchor position changes.
*
* Both of these objects have a `row` and `column` property corresponding to the position.
*
* Events that can trigger this function include [[Anchor.setPosition `setPosition()`]].
*
* @event change
* @param {Object} e An object containing information about the anchor position. It has two properties:
* - `old`: An object describing the old Anchor position
* - `value`: An object describing the new Anchor position
*
*
**/
this.onChange = function(e) {
var delta = e.data;
var range = delta.range;
if (range.start.row == range.end.row && range.start.row != this.row)
return;
if (range.start.row > this.row)
return;
if (range.start.row == this.row && range.start.column > this.column)
return;
var row = this.row;
var column = this.column;
if (delta.action === "insertText") {
if (range.start.row === row && range.start.column <= column) {
if (range.start.row === range.end.row) {
column += range.end.column - range.start.column;
}
else {
column -= range.start.column;
row += range.end.row - range.start.row;
}
}
else if (range.start.row !== range.end.row && range.start.row < row) {
row += range.end.row - range.start.row;
}
} else if (delta.action === "insertLines") {
if (range.start.row <= row) {
row += range.end.row - range.start.row;
}
}
else if (delta.action == "removeText") {
if (range.start.row == row && range.start.column < column) {
if (range.end.column >= column)
column = range.start.column;
else
column = Math.max(0, column - (range.end.column - range.start.column));
} else if (range.start.row !== range.end.row && range.start.row < row) {
if (range.end.row == row) {
column = Math.max(0, column - range.end.column) + range.start.column;
}
row -= (range.end.row - range.start.row);
}
else if (range.end.row == row) {
row -= range.end.row - range.start.row;
column = Math.max(0, column - range.end.column) + range.start.column;
}
} else if (delta.action == "removeLines") {
if (range.start.row <= row) {
if (range.end.row <= row)
row -= range.end.row - range.start.row;
else {
row = range.start.row;
column = 0;
}
}
}
this.setPosition(row, column, true);
};
/**
* Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.
* @param {Number} row The row index to move the anchor to
* @param {Number} column The column index to move the anchor to
* @param {Boolean} noClip Identifies if you want the position to be clipped
*
*
*
**/
this.setPosition = function(row, column, noClip) {
var pos;
if (noClip) {
pos = {
row: row,
column: column
};
}
else {
pos = this.$clipPositionToDocument(row, column);
}
if (this.row == pos.row && this.column == pos.column)
return;
var old = {
row: this.row,
column: this.column
};
this.row = pos.row;
this.column = pos.column;
this._emit("change", {
old: old,
value: pos
});
};
/**
* When called, the `'change'` event listener is removed.
*
**/
this.detach = function() {
this.document.removeEventListener("change", this.$onChange);
};
/**
* Clips the anchor position to the specified row and column.
* @param {Number} row The row index to clip the anchor to
* @param {Number} column The column index to clip the anchor to
*
*
*
**/
this.$clipPositionToDocument = function(row, column) {
var pos = {};
if (row >= this.document.getLength()) {
pos.row = Math.max(0, this.document.getLength() - 1);
pos.column = this.document.getLine(pos.row).length;
}
else if (row < 0) {
pos.row = 0;
pos.column = 0;
}
else {
pos.row = row;
pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
}
if (column < 0)
pos.column = 0;
return pos;
};
}).call(Anchor.prototype);
});
@@ -0,0 +1,177 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var Document = require("./document").Document;
var Anchor = require("./anchor").Anchor;
var Range = require("./range").Range;
var assert = require("./test/assertions");
module.exports = {
"test create anchor" : function() {
var doc = new Document("juhu");
var anchor = new Anchor(doc, 0, 0);
assert.position(anchor.getPosition(), 0, 0);
assert.equal(anchor.getDocument(), doc);
},
"test insert text in same row before cursor should move anchor column": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4);
doc.insert({row: 1, column: 1}, "123");
assert.position(anchor.getPosition(), 1, 7);
},
"test insert lines before cursor should move anchor row": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4);
doc.insertLines(1, ["123", "456"]);
assert.position(anchor.getPosition(), 3, 4);
},
"test insert new line before cursor should move anchor column": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4);
doc.insertNewLine({row: 0, column: 0});
assert.position(anchor.getPosition(), 2, 4);
},
"test insert new line in anchor line before anchor should move anchor column and row": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4);
doc.insertNewLine({row: 1, column: 2});
assert.position(anchor.getPosition(), 2, 2);
},
"test delete text in anchor line before anchor should move anchor column": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4);
doc.remove(new Range(1, 1, 1, 3));
assert.position(anchor.getPosition(), 1, 2);
},
"test remove range which contains the anchor should move the anchor to the start of the range": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 0, 3);
doc.remove(new Range(0, 1, 1, 3));
assert.position(anchor.getPosition(), 0, 1);
},
"test delete character before the anchor should have no effect": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4);
doc.remove(new Range(1, 4, 1, 5));
assert.position(anchor.getPosition(), 1, 4);
},
"test delete lines in anchor line before anchor should move anchor row": function() {
var doc = new Document("juhu\n1\n2\nkinners");
var anchor = new Anchor(doc, 3, 4);
doc.removeLines(1, 2);
assert.position(anchor.getPosition(), 1, 4);
},
"test remove new line before the cursor": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4);
doc.removeNewLine(0);
assert.position(anchor.getPosition(), 0, 8);
},
"test delete range which contains the anchor should move anchor to the end of the range": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4);
doc.remove(new Range(0, 2, 1, 2));
assert.position(anchor.getPosition(), 0, 4);
},
"test delete line which contains the anchor should move anchor to the end of the range": function() {
var doc = new Document("juhu\nkinners\n123");
var anchor = new Anchor(doc, 1, 5);
doc.removeLines(1, 1);
assert.position(anchor.getPosition(), 1, 0);
},
"test remove after the anchor should have no effect": function() {
var doc = new Document("juhu\nkinners\n123");
var anchor = new Anchor(doc, 1, 2);
doc.remove(new Range(1, 4, 2, 2));
assert.position(anchor.getPosition(), 1, 2);
},
"test anchor changes triggered by document changes should emit change event": function(next) {
var doc = new Document("juhu\nkinners\n123");
var anchor = new Anchor(doc, 1, 5);
anchor.on("change", function(e) {
assert.position(anchor.getPosition(), 0, 0);
next();
});
doc.remove(new Range(0, 0, 2, 1));
},
"test only fire change event if position changes": function() {
var doc = new Document("juhu\nkinners\n123");
var anchor = new Anchor(doc, 1, 5);
anchor.on("change", function(e) {
assert.fail();
});
doc.remove(new Range(2, 0, 2, 1));
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}
@@ -0,0 +1,254 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("./lib/oop");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
// tokenizing lines longer than this makes editor very slow
var MAX_LINE_LENGTH = 5000;
/**
*
*
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use.
*
* If a certain row is changed, everything below that row is re-tokenized.
*
* @class BackgroundTokenizer
**/
/**
* Creates a new `BackgroundTokenizer` object.
* @param {Tokenizer} tokenizer The tokenizer to use
* @param {Editor} editor The editor to associate with
*
*
*
* @constructor
**/
var BackgroundTokenizer = function(tokenizer, editor) {
this.running = false;
this.lines = [];
this.states = [];
this.currentLine = 0;
this.tokenizer = tokenizer;
var self = this;
this.$worker = function() {
if (!self.running) { return; }
var workerStart = new Date();
var startLine = self.currentLine;
var doc = self.doc;
var processedLines = 0;
var len = doc.getLength();
while (self.currentLine < len) {
self.$tokenizeRow(self.currentLine);
while (self.lines[self.currentLine])
self.currentLine++;
// only check every 5 lines
processedLines ++;
if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {
self.fireUpdateEvent(startLine, self.currentLine-1);
self.running = setTimeout(self.$worker, 20);
return;
}
}
self.running = false;
self.fireUpdateEvent(startLine, len - 1);
};
};
(function(){
oop.implement(this, EventEmitter);
/**
* Sets a new tokenizer for this object.
*
* @param {Tokenizer} tokenizer The new tokenizer to use
*
**/
this.setTokenizer = function(tokenizer) {
this.tokenizer = tokenizer;
this.lines = [];
this.states = [];
this.start(0);
};
/**
* Sets a new document to associate with this object.
* @param {Document} doc The new document to associate with
**/
this.setDocument = function(doc) {
this.doc = doc;
this.lines = [];
this.states = [];
this.stop();
};
/**
* Fires whenever the background tokeniziers between a range of rows are going to be updated.
*
* @event update
* @param {Object} e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated.
*
**/
/**
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
* @param {Number} firstRow The starting row region
* @param {Number} lastRow The final row region
*
**/
this.fireUpdateEvent = function(firstRow, lastRow) {
var data = {
first: firstRow,
last: lastRow
};
this._emit("update", {data: data});
};
/**
* Starts tokenizing at the row indicated.
*
* @param {Number} startRow The row to start at
*
**/
this.start = function(startRow) {
this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
// remove all cached items below this line
this.lines.splice(this.currentLine, this.lines.length);
this.states.splice(this.currentLine, this.states.length);
this.stop();
// pretty long delay to prevent the tokenizer from interfering with the user
this.running = setTimeout(this.$worker, 700);
};
this.$updateOnChange = function(delta) {
var range = delta.range;
var startRow = range.start.row;
var len = range.end.row - startRow;
if (len === 0) {
this.lines[startRow] = null;
} else if (delta.action == "removeText" || delta.action == "removeLines") {
this.lines.splice(startRow, len + 1, null);
this.states.splice(startRow, len + 1, null);
} else {
var args = Array(len + 1);
args.unshift(startRow, 1);
this.lines.splice.apply(this.lines, args);
this.states.splice.apply(this.states, args);
}
this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
this.stop();
// pretty long delay to prevent the tokenizer from interfering with the user
this.running = setTimeout(this.$worker, 700);
};
/**
* Stops tokenizing.
*
**/
this.stop = function() {
if (this.running)
clearTimeout(this.running);
this.running = false;
};
/**
* Gives list of tokens of the row. (tokens are cached)
*
* @param {Number} row The row to get tokens at
*
*
*
**/
this.getTokens = function(row) {
return this.lines[row] || this.$tokenizeRow(row);
};
/**
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
*
* @param {Number} row The row to get state at
**/
this.getState = function(row) {
if (this.currentLine == row)
this.$tokenizeRow(row);
return this.states[row] || "start";
};
this.$tokenizeRow = function(row) {
var line = this.doc.getLine(row);
var state = this.states[row - 1];
if (line.length > MAX_LINE_LENGTH) {
var overflow = {value: line.substr(MAX_LINE_LENGTH), type: "text"};
line = line.slice(0, MAX_LINE_LENGTH);
}
var data = this.tokenizer.getLineTokens(line, state);
if (overflow) {
data.tokens.push(overflow);
data.state = "start";
}
if (this.states[row] !== data.state) {
this.states[row] = data.state;
this.lines[row + 1] = null;
if (this.currentLine > row + 1)
this.currentLine = row + 1;
} else if (this.currentLine == row) {
this.currentLine = row + 1;
}
return this.lines[row] = data.tokens;
};
}).call(BackgroundTokenizer.prototype);
exports.BackgroundTokenizer = BackgroundTokenizer;
});
@@ -0,0 +1,85 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var EditSession = require("./edit_session").EditSession;
var JavaScriptMode = require("./mode/javascript").Mode;
var Range = require("./range").Range;
var assert = require("./test/assertions");
function forceTokenize(session){
for (var i = 0, l = session.getLength(); i < l; i++)
session.getTokens(i)
}
function testStates(session, states) {
for (var i = 0, l = session.getLength(); i < l; i++)
assert.equal(session.bgTokenizer.states[i], states[i])
assert.ok(l == states.length)
}
module.exports = {
"test background tokenizer update on session change" : function() {
var doc = new EditSession([
"/*",
"*/",
"var juhu"
]);
doc.setMode("./mode/javascript")
forceTokenize(doc)
testStates(doc, ["comment", "start", "start"])
doc.remove(new Range(0,2,1,2))
testStates(doc, [null, "start"])
forceTokenize(doc)
testStates(doc, ["comment", "comment"])
doc.insert({row:0, column:2}, "\n*/")
testStates(doc, [undefined, undefined, "comment"])
forceTokenize(doc)
testStates(doc, ["comment", "start", "start"])
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}
@@ -0,0 +1,121 @@
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var HashHandler = require("../keyboard/hash_handler").HashHandler;
var EventEmitter = require("../lib/event_emitter").EventEmitter;
/**
* @class CommandManager
*
*
**/
/**
* new CommandManager(platform, commands)
* @param {String} platform Identifier for the platform; must be either `'mac'` or `'win'`
* @param {Array} commands A list of commands
*
*
*
*
**/
var CommandManager = function(platform, commands) {
this.platform = platform;
this.commands = this.byName = {};
this.commmandKeyBinding = {};
this.addCommands(commands);
this.setDefaultHandler("exec", function(e) {
return e.command.exec(e.editor, e.args || {});
});
};
oop.inherits(CommandManager, HashHandler);
(function() {
oop.implement(this, EventEmitter);
this.exec = function(command, editor, args) {
if (typeof command === 'string')
command = this.commands[command];
if (!command)
return false;
if (editor && editor.$readOnly && !command.readOnly)
return false;
var retvalue = this._emit("exec", {
editor: editor,
command: command,
args: args
});
return retvalue === false ? false : true;
};
this.toggleRecording = function(editor) {
if (this.$inReplay)
return;
editor && editor._emit("changeStatus");
if (this.recording) {
this.macro.pop();
this.removeEventListener("exec", this.$addCommandToMacro);
if (!this.macro.length)
this.macro = this.oldMacro;
return this.recording = false;
}
if (!this.$addCommandToMacro) {
this.$addCommandToMacro = function(e) {
this.macro.push([e.command, e.args]);
}.bind(this);
}
this.oldMacro = this.macro;
this.macro = [];
this.on("exec", this.$addCommandToMacro);
return this.recording = true;
};
this.replay = function(editor) {
if (this.$inReplay || !this.macro)
return;
if (this.recording)
return this.toggleRecording(editor);
try {
this.$inReplay = true;
this.macro.forEach(function(x) {
if (typeof x == "string")
this.exec(x, editor);
else
this.exec(x[0], editor, x[1]);
}, this);
} finally {
this.$inReplay = false;
}
};
this.trimMacro = function(m) {
return m.map(function(x){
if (typeof x[0] != "string")
x[0] = x[0].name;
if (!x[1])
x = x[0];
return x;
});
};
}).call(CommandManager.prototype);
exports.CommandManager = CommandManager;
});
@@ -0,0 +1,199 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var CommandManager = require("./command_manager").CommandManager;
var keys = require("../lib/keys");
var assert = require("../test/assertions");
module.exports = {
setUp: function() {
this.command = {
name: "gotoline",
bindKey: {
mac: "Command-L",
win: "Ctrl-L"
},
called: false,
exec: function(editor) { this.called = true; }
};
this.cm = new CommandManager("mac", [this.command]);
},
"test: register command": function() {
this.cm.exec("gotoline");
assert.ok(this.command.called);
},
"test: mac hotkeys": function() {
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
assert.equal(command, this.command);
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "l");
assert.equal(command, undefined);
},
"test: win hotkeys": function() {
var cm = new CommandManager("win", [this.command]);
var command = cm.findKeyCommand(keys.KEY_MODS.command, "l");
assert.equal(command, undefined);
var command = cm.findKeyCommand(keys.KEY_MODS.ctrl, "l");
assert.equal(command, this.command);
},
"test: remove command by object": function() {
this.cm.removeCommand(this.command);
this.cm.exec("gotoline");
assert.ok(!this.command.called);
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
assert.equal(command, null);
},
"test: remove command by name": function() {
this.cm.removeCommand("gotoline");
this.cm.exec("gotoline");
assert.ok(!this.command.called);
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
assert.equal(command, null);
},
"test: adding a new command with the same name as an existing one should remove the old one first": function() {
var command = {
name: "gotoline",
bindKey: {
mac: "Command-L",
win: "Ctrl-L"
},
called: false,
exec: function(editor) { this.called = true; }
};
this.cm.addCommand(command);
this.cm.exec("gotoline");
assert.ok(command.called);
assert.ok(!this.command.called);
assert.equal(this.cm.findKeyCommand(keys.KEY_MODS.command, "l"), command);
},
"test: adding commands and recording a macro": function() {
var called = "";
this.cm.addCommands({
togglerecording: function(editor) {
editor.cm.toggleRecording(editor);
},
replay: function(editor) {
editor.cm.replay();
},
cm1: function(editor, arg) {
called += "1" + (arg || "");
},
cm2: function(editor) {
called += "2";
}
});
var statusUpdateEmitted = false;
this._emit = function() {statusUpdateEmitted = true};
this.cm.exec("togglerecording", this);
assert.ok(this.cm.recording);
assert.ok(statusUpdateEmitted);
this.cm.exec("cm1", this, "-");
this.cm.exec("cm2");
this.cm.exec("replay", this);
assert.ok(!this.cm.recording);
assert.equal(called, "1-2");
called = "";
this.cm.exec("replay", this);
assert.equal(called, "1-2");
},
"test: bindkeys": function() {
this.cm.bindKeys({
"Ctrl-L|Command-C": "cm1",
"Ctrl-R": "cm2"
});
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "c");
assert.equal(command, "cm1");
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r");
assert.equal(command, "cm2");
this.cm.bindKeys({
"Ctrl-R": null
});
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r");
assert.equal(command, null);
},
"test: binding keys without modifiers": function() {
this.cm.bindKeys({
"R": "cm1",
"Shift-r": "cm2",
"Return": "cm4",
"Enter": "cm3"
});
var command = this.cm.findKeyCommand(-1, "r");
assert.equal(command, "cm1");
var command = this.cm.findKeyCommand(-1, "R");
assert.equal(command, "cm2");
var command = this.cm.findKeyCommand(0, "return");
assert.equal(command, "cm3");
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
}
@@ -0,0 +1,467 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var lang = require("../lib/lang");
function bindKey(win, mac) {
return {
win: win,
mac: mac
};
}
exports.commands = [{
name: "selectall",
bindKey: bindKey("Ctrl-A", "Command-A"),
exec: function(editor) { editor.selectAll(); },
readOnly: true
}, {
name: "centerselection",
bindKey: bindKey(null, "Ctrl-L"),
exec: function(editor) { editor.centerSelection(); },
readOnly: true
}, {
name: "gotoline",
bindKey: bindKey("Ctrl-L", "Command-L"),
exec: function(editor) {
var line = parseInt(prompt("Enter line number:"), 10);
if (!isNaN(line)) {
editor.gotoLine(line);
}
},
readOnly: true
}, {
name: "fold",
bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
exec: function(editor) { editor.session.toggleFold(false); },
readOnly: true
}, {
name: "unfold",
bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
exec: function(editor) { editor.session.toggleFold(true); },
readOnly: true
}, {
name: "foldall",
bindKey: bindKey("Alt-0", "Command-Option-0"),
exec: function(editor) { editor.session.foldAll(); },
readOnly: true
}, {
name: "unfoldall",
bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
exec: function(editor) { editor.session.unfold(); },
readOnly: true
}, {
name: "findnext",
bindKey: bindKey("Ctrl-K", "Command-G"),
exec: function(editor) { editor.findNext(); },
readOnly: true
}, {
name: "findprevious",
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
exec: function(editor) { editor.findPrevious(); },
readOnly: true
}, {
name: "find",
bindKey: bindKey("Ctrl-F", "Command-F"),
exec: function(editor) {
var needle = prompt("Find:", editor.getCopyText());
editor.find(needle);
},
readOnly: true
}, {
name: "overwrite",
bindKey: "Insert",
exec: function(editor) { editor.toggleOverwrite(); },
readOnly: true
}, {
name: "selecttostart",
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
exec: function(editor) { editor.getSelection().selectFileStart(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "gotostart",
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
exec: function(editor) { editor.navigateFileStart(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selectup",
bindKey: bindKey("Shift-Up", "Shift-Up"),
exec: function(editor) { editor.getSelection().selectUp(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "golineup",
bindKey: bindKey("Up", "Up|Ctrl-P"),
exec: function(editor, args) { editor.navigateUp(args.times); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selecttoend",
bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
exec: function(editor) { editor.getSelection().selectFileEnd(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "gotoend",
bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
exec: function(editor) { editor.navigateFileEnd(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selectdown",
bindKey: bindKey("Shift-Down", "Shift-Down"),
exec: function(editor) { editor.getSelection().selectDown(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "golinedown",
bindKey: bindKey("Down", "Down|Ctrl-N"),
exec: function(editor, args) { editor.navigateDown(args.times); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selectwordleft",
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
exec: function(editor) { editor.getSelection().selectWordLeft(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "gotowordleft",
bindKey: bindKey("Ctrl-Left", "Option-Left"),
exec: function(editor) { editor.navigateWordLeft(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selecttolinestart",
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
exec: function(editor) { editor.getSelection().selectLineStart(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "gotolinestart",
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
exec: function(editor) { editor.navigateLineStart(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selectleft",
bindKey: bindKey("Shift-Left", "Shift-Left"),
exec: function(editor) { editor.getSelection().selectLeft(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "gotoleft",
bindKey: bindKey("Left", "Left|Ctrl-B"),
exec: function(editor, args) { editor.navigateLeft(args.times); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selectwordright",
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
exec: function(editor) { editor.getSelection().selectWordRight(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "gotowordright",
bindKey: bindKey("Ctrl-Right", "Option-Right"),
exec: function(editor) { editor.navigateWordRight(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selecttolineend",
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
exec: function(editor) { editor.getSelection().selectLineEnd(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "gotolineend",
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
exec: function(editor) { editor.navigateLineEnd(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selectright",
bindKey: bindKey("Shift-Right", "Shift-Right"),
exec: function(editor) { editor.getSelection().selectRight(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "gotoright",
bindKey: bindKey("Right", "Right|Ctrl-F"),
exec: function(editor, args) { editor.navigateRight(args.times); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selectpagedown",
bindKey: "Shift-PageDown",
exec: function(editor) { editor.selectPageDown(); },
readOnly: true
}, {
name: "pagedown",
bindKey: bindKey(null, "Option-PageDown"),
exec: function(editor) { editor.scrollPageDown(); },
readOnly: true
}, {
name: "gotopagedown",
bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
exec: function(editor) { editor.gotoPageDown(); },
readOnly: true
}, {
name: "selectpageup",
bindKey: "Shift-PageUp",
exec: function(editor) { editor.selectPageUp(); },
readOnly: true
}, {
name: "pageup",
bindKey: bindKey(null, "Option-PageUp"),
exec: function(editor) { editor.scrollPageUp(); },
readOnly: true
}, {
name: "gotopageup",
bindKey: "PageUp",
exec: function(editor) { editor.gotoPageUp(); },
readOnly: true
}, {
name: "scrollup",
bindKey: bindKey("Ctrl-Up", null),
exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },
readOnly: true
}, {
name: "scrolldown",
bindKey: bindKey("Ctrl-Down", null),
exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },
readOnly: true
}, {
name: "selectlinestart",
bindKey: "Shift-Home",
exec: function(editor) { editor.getSelection().selectLineStart(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selectlineend",
bindKey: "Shift-End",
exec: function(editor) { editor.getSelection().selectLineEnd(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "togglerecording",
bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
exec: function(editor) { editor.commands.toggleRecording(editor); },
readOnly: true
}, {
name: "replaymacro",
bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
exec: function(editor) { editor.commands.replay(editor); },
readOnly: true
}, {
name: "jumptomatching",
bindKey: bindKey("Ctrl-P", "Ctrl-Shift-P"),
exec: function(editor) { editor.jumpToMatching(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selecttomatching",
bindKey: bindKey("Ctrl-Shift-P", null),
exec: function(editor) { editor.jumpToMatching(true); },
readOnly: true
},
// commands disabled in readOnly mode
{
name: "cut",
exec: function(editor) {
var range = editor.getSelectionRange();
editor._emit("cut", range);
if (!editor.selection.isEmpty()) {
editor.session.remove(range);
editor.clearSelection();
}
},
multiSelectAction: "forEach"
}, {
name: "removeline",
bindKey: bindKey("Ctrl-D", "Command-D"),
exec: function(editor) { editor.removeLines(); },
multiSelectAction: "forEach"
}, {
name: "duplicateSelection",
bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
exec: function(editor) { editor.duplicateSelection(); },
multiSelectAction: "forEach"
}, {
name: "sortlines",
bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
exec: function(editor) { editor.sortLines(); },
multiSelectAction: "forEach"
}, {
name: "togglecomment",
bindKey: bindKey("Ctrl-/", "Command-/"),
exec: function(editor) { editor.toggleCommentLines(); },
multiSelectAction: "forEach"
}, {
name: "modifyNumberUp",
bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
exec: function(editor) { editor.modifyNumber(1); },
multiSelectAction: "forEach"
}, {
name: "modifyNumberDown",
bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
exec: function(editor) { editor.modifyNumber(-1); },
multiSelectAction: "forEach"
}, {
name: "replace",
bindKey: bindKey("Ctrl-R", "Command-Option-F"),
exec: function(editor) {
var needle = prompt("Find:", editor.getCopyText());
if (!needle)
return;
var replacement = prompt("Replacement:");
if (!replacement)
return;
editor.replace(replacement, {needle: needle});
}
}, {
name: "replaceall",
bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-Option-F"),
exec: function(editor) {
var needle = prompt("Find:");
if (!needle)
return;
var replacement = prompt("Replacement:");
if (!replacement)
return;
editor.replaceAll(replacement, {needle: needle});
}
}, {
name: "undo",
bindKey: bindKey("Ctrl-Z", "Command-Z"),
exec: function(editor) { editor.undo(); }
}, {
name: "redo",
bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
exec: function(editor) { editor.redo(); }
}, {
name: "copylinesup",
bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
exec: function(editor) { editor.copyLinesUp(); }
}, {
name: "movelinesup",
bindKey: bindKey("Alt-Up", "Option-Up"),
exec: function(editor) { editor.moveLinesUp(); }
}, {
name: "copylinesdown",
bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
exec: function(editor) { editor.copyLinesDown(); }
}, {
name: "movelinesdown",
bindKey: bindKey("Alt-Down", "Option-Down"),
exec: function(editor) { editor.moveLinesDown(); }
}, {
name: "del",
bindKey: bindKey("Delete", "Delete|Ctrl-D"),
exec: function(editor) { editor.remove("right"); },
multiSelectAction: "forEach"
}, {
name: "backspace",
bindKey: bindKey(
"Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
),
exec: function(editor) { editor.remove("left"); },
multiSelectAction: "forEach"
}, {
name: "removetolinestart",
bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
exec: function(editor) { editor.removeToLineStart(); },
multiSelectAction: "forEach"
}, {
name: "removetolineend",
bindKey: bindKey("Alt-Delete", "Ctrl-K"),
exec: function(editor) { editor.removeToLineEnd(); },
multiSelectAction: "forEach"
}, {
name: "removewordleft",
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
exec: function(editor) { editor.removeWordLeft(); },
multiSelectAction: "forEach"
}, {
name: "removewordright",
bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
exec: function(editor) { editor.removeWordRight(); },
multiSelectAction: "forEach"
}, {
name: "outdent",
bindKey: bindKey("Shift-Tab", "Shift-Tab"),
exec: function(editor) { editor.blockOutdent(); },
multiSelectAction: "forEach"
}, {
name: "indent",
bindKey: bindKey("Tab", "Tab"),
exec: function(editor) { editor.indent(); },
multiSelectAction: "forEach"
}, {
name: "insertstring",
exec: function(editor, str) { editor.insert(str); },
multiSelectAction: "forEach"
}, {
name: "inserttext",
exec: function(editor, args) {
editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
},
multiSelectAction: "forEach"
}, {
name: "splitline",
bindKey: bindKey(null, "Ctrl-O"),
exec: function(editor) { editor.splitLine(); },
multiSelectAction: "forEach"
}, {
name: "transposeletters",
bindKey: bindKey("Ctrl-T", "Ctrl-T"),
exec: function(editor) { editor.transposeLetters(); },
multiSelectAction: function(editor) {editor.transposeSelections(1); }
}, {
name: "touppercase",
bindKey: bindKey("Ctrl-U", "Ctrl-U"),
exec: function(editor) { editor.toUpperCase(); },
multiSelectAction: "forEach"
}, {
name: "tolowercase",
bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
exec: function(editor) { editor.toLowerCase(); },
multiSelectAction: "forEach"
}];
});
@@ -0,0 +1,97 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
// commands to enter multiselect mode
exports.defaultCommands = [{
name: "addCursorAbove",
exec: function(editor) { editor.selectMoreLines(-1); },
bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"},
readonly: true
}, {
name: "addCursorBelow",
exec: function(editor) { editor.selectMoreLines(1); },
bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"},
readonly: true
}, {
name: "addCursorAboveSkipCurrent",
exec: function(editor) { editor.selectMoreLines(-1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"},
readonly: true
}, {
name: "addCursorBelowSkipCurrent",
exec: function(editor) { editor.selectMoreLines(1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"},
readonly: true
}, {
name: "selectMoreBefore",
exec: function(editor) { editor.selectMore(-1); },
bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"},
readonly: true
}, {
name: "selectMoreAfter",
exec: function(editor) { editor.selectMore(1); },
bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"},
readonly: true
}, {
name: "selectNextBefore",
exec: function(editor) { editor.selectMore(-1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"},
readonly: true
}, {
name: "selectNextAfter",
exec: function(editor) { editor.selectMore(1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
readonly: true
}, {
name: "splitIntoLines",
exec: function(editor) { editor.multiSelect.splitIntoLines(); },
bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
readonly: true
}, {
name: "alignCursors",
exec: function(editor) { editor.alignCursors(); },
bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
}];
// commands active only in multiselect mode
exports.multiSelectCommands = [{
name: "singleSelection",
bindKey: "esc",
exec: function(editor) { editor.exitMultiSelectMode(); },
readonly: true,
isAvailable: function(editor) {return editor && editor.inMultiSelectMode}
}];
var HashHandler = require("../keyboard/hash_handler").HashHandler;
exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
});
@@ -0,0 +1,139 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"no use strict";
var lang = require("./lib/lang");
var global = (function() {
return this;
})();
var options = {
packaged: false,
workerPath: null,
modePath: null,
themePath: null,
basePath: "",
suffix: ".js",
$moduleUrls: {}
};
exports.get = function(key) {
if (!options.hasOwnProperty(key))
throw new Error("Unknown config key: " + key);
return options[key];
};
exports.set = function(key, value) {
if (!options.hasOwnProperty(key))
throw new Error("Unknown config key: " + key);
options[key] = value;
};
exports.all = function() {
return lang.copyObject(options);
};
exports.moduleUrl = function(name, component) {
if (options.$moduleUrls[name])
return options.$moduleUrls[name];
var parts = name.split("/");
component = component || parts[parts.length - 2] || "";
var base = parts[parts.length - 1].replace(component, "").replace(/(^[\-_])|([\-_]$)/, "");
if (!base && parts.length > 1)
base = parts[parts.length - 2];
var path = options[component + "Path"];
if (path == null)
path = options.basePath;
if (path && path.slice(-1) != "/")
path += "/";
return path + component + "-" + base + this.get("suffix");
};
exports.setModuleUrl = function(name, subst) {
return options.$moduleUrls[name] = subst;
};
exports.init = function() {
options.packaged = require.packaged || module.packaged || (global.define && define.packaged);
if (!global.document)
return "";
var scriptOptions = {};
var scriptUrl = "";
var scripts = document.getElementsByTagName("script");
for (var i=0; i<scripts.length; i++) {
var script = scripts[i];
var src = script.src || script.getAttribute("src");
if (!src)
continue;
var attributes = script.attributes;
for (var j=0, l=attributes.length; j < l; j++) {
var attr = attributes[j];
if (attr.name.indexOf("data-ace-") === 0) {
scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, ""))] = attr.value;
}
}
var m = src.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);
if (m)
scriptUrl = m[1];
}
if (scriptUrl) {
scriptOptions.base = scriptOptions.base || scriptUrl;
scriptOptions.packaged = true;
}
scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;
scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;
scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;
delete scriptOptions.base;
for (var key in scriptOptions)
if (typeof scriptOptions[key] !== "undefined")
exports.set(key, scriptOptions[key]);
};
function deHyphenate(str) {
return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
}
});
@@ -0,0 +1,71 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var config = require("./config");
var assert = require("./test/assertions");
module.exports = {
"test path resolution" : function() {
config.set("packaged", "true");
var url = config.moduleUrl("kr_theme", "theme");
assert.equal(url, "theme-kr.js");
config.set("basePath", "a/b");
url = config.moduleUrl("m/theme", "theme");
assert.equal(url, "a/b/theme-m.js");
url = config.moduleUrl("m/theme", "ext");
assert.equal(url, "a/b/ext-theme.js");
config.set("workerPath", "c/");
url = config.moduleUrl("foo/1", "worker");
assert.equal(url, "c/worker-1.js");
config.setModuleUrl("foo/1", "a/b1.js");
url = config.moduleUrl("foo/1", "theme");
assert.equal(url, "a/b1.js");
assert.equal();
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

@@ -0,0 +1,368 @@
.ace_editor {
position: absolute;
overflow: hidden;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
font-size: 12px;
}
.ace_scroller {
position: absolute;
overflow: hidden;
}
.ace_content {
position: absolute;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: text;
}
.ace_gutter {
position: absolute;
overflow : hidden;
height: 100%;
width: auto;
cursor: default;
z-index: 4;
}
.ace_gutter-active-line {
position: absolute;
left: 0;
right: 0;
}
.ace_scroller.ace_scroll-left {
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
}
.ace_gutter-cell {
padding-left: 19px;
padding-right: 6px;
background-repeat: no-repeat;
}
.ace_gutter-cell.ace_error {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTQ4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTU4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBMjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBMzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkgXxbAAAAJbSURBVHjapFNNaBNBFH4zs5vdZLP5sQmNpT82QY209heh1ioWisaDRcSKF0WKJ0GQnrzrxasHsR6EnlrwD0TagxJabaVEpFYxLWlLSS822tr87m66ccfd2GKyVhA6MMybgfe97/vmPUQphd0sZjto9XIn9OOsvlu2nkqRzVU+6vvlzPf8W6bk8dxQ0NPbxAALgCgg2JkaQuhzQau/El0zbmUA7U0Es8v2CiYmKQJHGO1QICCLoqilMhkmurDAyapKgqItezi/USRdJqEYY4D5jCy03ht2yMkkvL91jTTX10qzyyu2hruPRN7jgbH+EOsXcMLgYiThEgAMhABW85oqy1DXdRIdvP1AHJ2acQXvDIrVHcdQNrEKNYSVMSZGMjEzIIAwDXIo+6G/FxcGnzkC3T2oMhLjre49sBB+RRcHLqdafK6sYdE/GGBwU1VpFNj0aN8pJbe+BkZyevUrvLl6Xmm0W9IuTc0DxrDNAJd5oEvI/KRsNC3bQyNjPO9yQ1YHcfj2QvfQc/5TUhJTBc2iM0U7AWDQtc1nJHvD/cfO2s7jaGkiTEfa/Ep8coLu7zmNmh8+dc5lZDuUeFAGUNA/OY6JVaypQ0vjr7XYjUvJM37vt+j1vuTK5DgVfVUoTjVe+y3/LxMxY2GgU+CSLy4cpfsYorRXuXIOi0Vt40h67uZFTdIo6nLaZcwUJWAzwNS0tBnqqKzQDnjdG/iPyZxo46HaKUpbvYkj8qYRTZsBhge+JHhZyh0x9b95JqjVJkT084kZIPwu/mPWqPgfQ5jXh2+92Ay7HedfAgwA6KDWafb4w3cAAAAASUVORK5CYII=");
background-repeat: no-repeat;
background-position: 2px center;
}
.ace_gutter-cell.ace_warning {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg==");
background-position: 2px center;
}
.ace_gutter-cell.ace_info {
background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7");
background-position: 2px center;
}
.ace_dark .ace_gutter-cell.ace_info {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=");
}
.ace_scrollbar {
position: absolute;
overflow-x: hidden;
overflow-y: scroll;
right: 0;
}
.ace_scrollbar-inner {
position: absolute;
width: 1px;
left: 0;
}
.ace_print-margin {
position: absolute;
height: 100%;
}
.ace_text-input {
position: absolute;
z-index: 0;
width: 0.5em;
height: 1em;
opacity: 0;
background: transparent;
-moz-appearance: none;
appearance: none;
border: none;
resize: none;
outline: none;
overflow: hidden;
}
.ace_text-input.ace_composition {
background: #fff;
color: #000;
z-index: 1000;
opacity: 1;
border: solid lightgray 1px;
margin: -1px
}
.ace_layer {
z-index: 1;
position: absolute;
overflow: hidden;
white-space: nowrap;
height: 100%;
width: 100%;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
/* setting pointer-events: auto; on node under the mouse, which changes
during scroll, will break mouse wheel scrolling in Safari */
pointer-events: none;
}
.ace_gutter-layer {
position: relative;
width: auto;
text-align: right;
pointer-events: auto;
}
.ace_text-layer {
color: black;
font: inherit !important;
}
.ace_cjk {
display: inline-block;
text-align: center;
}
.ace_cursor-layer {
z-index: 4;
}
.ace_cursor {
z-index: 4;
position: absolute;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.ace_hidden-cursors .ace_cursor {
opacity: 0.2;
}
.ace_smooth-blinking .ace_cursor {
-moz-transition: opacity 0.18s;
-webkit-transition: opacity 0.18s;
-o-transition: opacity 0.18s;
-ms-transition: opacity 0.18s;
transition: opacity 0.18s;
}
.ace_cursor[style*="opacity: 0"]{
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
}
.ace_editor.ace_multiselect .ace_cursor {
border-left-width: 1px;
}
.ace_line {
white-space: nowrap;
}
.ace_marker-layer .ace_step {
position: absolute;
z-index: 3;
}
.ace_marker-layer .ace_selection {
position: absolute;
z-index: 5;
}
.ace_marker-layer .ace_bracket {
position: absolute;
z-index: 6;
}
.ace_marker-layer .ace_active-line {
position: absolute;
z-index: 2;
}
.ace_marker-layer .ace_selected-word {
position: absolute;
z-index: 4;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.ace_line .ace_fold {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
display: inline-block;
height: 11px;
margin-top: -2px;
vertical-align: middle;
background-image:
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82"),
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%3AIDAT8%11c%FC%FF%FF%7F%18%03%1A%60%01%F2%3F%A0%891%80%04%FF%11-%F8%17%9BJ%E2%05%B1ZD%81v%26t%E7%80%F8%A3%82h%A12%1A%20%A3%01%02%0F%01%BA%25%06%00%19%C0%0D%AEF%D5%3ES%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat, repeat-x;
background-position: center center, top left;
color: transparent;
border: 1px solid black;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
cursor: pointer;
pointer-events: auto;
}
.ace_dark .ace_fold {
}
.ace_fold:hover{
background-image:
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82"),
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%003IDAT8%11c%FC%FF%FF%7F%3E%03%1A%60%01%F2%3F%A3%891%80%04%FFQ%26%F8w%C0%B43%A1%DB%0C%E2%8F%0A%A2%85%CAh%80%8C%06%08%3C%04%E8%96%18%00%A3S%0D%CD%CF%D8%C1%9D%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat, repeat-x;
background-position: center center, top left;
}
.ace_editor.ace_dragging .ace_content {
cursor: move;
}
.ace_gutter-tooltip {
background-color: #FFFFD5;
border: 1px solid gray;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
color: black;
display: inline-block;
padding: 4px;
position: absolute;
z-index: 300;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: default;
white-space: pre-line;
word-wrap: break-word;
}
.ace_folding-enabled > .ace_gutter-cell {
padding-right: 13px;
}
.ace_fold-widget {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0 -12px 0 1px;
display: inline-block;
width: 11px;
vertical-align: top;
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat;
background-position: center;
border-radius: 3px;
border: 1px solid transparent;
}
.ace_fold-widget.ace_end {
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82");
}
.ace_fold-widget.ace_closed {
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82");
}
.ace_fold-widget:hover {
border: 1px solid rgba(0, 0, 0, 0.3);
background-color: rgba(255, 255, 255, 0.2);
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
}
.ace_fold-widget:active {
border: 1px solid rgba(0, 0, 0, 0.4);
background-color: rgba(0, 0, 0, 0.05);
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}
/**
* Dark version for fold widgets
*/
.ace_dark .ace_fold-widget {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
}
.ace_dark .ace_fold-widget.ace_end {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget.ace_closed {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget:hover {
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
background-color: rgba(255, 255, 255, 0.1);
}
.ace_dark .ace_fold-widget:active {
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
}
.ace_fold-widget.ace_invalid {
background-color: #FFB4B4;
border-color: #DE5555;
}
.ace_fade-fold-widgets .ace_fold-widget {
-moz-transition: opacity 0.4s ease 0.05s;
-webkit-transition: opacity 0.4s ease 0.05s;
-o-transition: opacity 0.4s ease 0.05s;
-ms-transition: opacity 0.4s ease 0.05s;
transition: opacity 0.4s ease 0.05s;
opacity: 0;
}
.ace_fade-fold-widgets:hover .ace_fold-widget {
-moz-transition: opacity 0.05s ease 0.05s;
-webkit-transition: opacity 0.05s ease 0.05s;
-o-transition: opacity 0.05s ease 0.05s;
-ms-transition: opacity 0.05s ease 0.05s;
transition: opacity 0.05s ease 0.05s;
opacity:1;
}
.ace_underline {
text-decoration: underline;
}
.ace_bold {
font-weight: bold;
}
.ace_nobold .ace_bold {
font-weight: normal;
}
.ace_italic {
font-style: italic;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

@@ -0,0 +1,598 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("./lib/oop");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
var Range = require("./range").Range;
var Anchor = require("./anchor").Anchor;
/**
* Contains the text of the document. Document can be attached to several [[EditSession `EditSession`]]s.
*
* At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
*
* @class Document
**/
/**
*
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
* @param {String | Array} text The starting text
* @constructor
**/
var Document = function(text) {
this.$lines = [];
// There has to be one line at least in the document. If you pass an empty
// string to the insert function, nothing will happen. Workaround.
if (text.length == 0) {
this.$lines = [""];
} else if (Array.isArray(text)) {
this.insertLines(0, text);
} else {
this.insert({row: 0, column:0}, text);
}
};
(function() {
oop.implement(this, EventEmitter);
/**
* Replaces all the lines in the current `Document` with the value of `text`.
*
* @param {String} text The text to use
**/
this.setValue = function(text) {
var len = this.getLength();
this.remove(new Range(0, 0, len, this.getLine(len-1).length));
this.insert({row: 0, column:0}, text);
};
/**
* Returns all the lines in the document as a single string, split by the new line character.
**/
this.getValue = function() {
return this.getAllLines().join(this.getNewLineCharacter());
};
/**
* Creates a new `Anchor` to define a floating point in the document.
* @param {Number} row The row number to use
* @param {Number} column The column number to use
*
*
**/
this.createAnchor = function(row, column) {
return new Anchor(this, row, column);
};
/**
* Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
*
* @method $split
* @param {String} text The text to work with
* @returns {String} A String array, with each index containing a piece of the original `text` string.
*
*
**/
// check for IE split bug
if ("aaa".split(/a/).length == 0)
this.$split = function(text) {
return text.replace(/\r\n|\r/g, "\n").split("\n");
}
else
this.$split = function(text) {
return text.split(/\r\n|\r|\n/);
};
this.$detectNewLine = function(text) {
var match = text.match(/^.*?(\r\n|\r|\n)/m);
if (match) {
this.$autoNewLine = match[1];
} else {
this.$autoNewLine = "\n";
}
};
/**
* Returns the newline character that's being used, depending on the value of `newLineMode`.
* @returns {String} If `newLineMode == windows`, `\r\n` is returned.
* If `newLineMode == unix`, `\n` is returned.
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
*
*
*
*
**/
this.getNewLineCharacter = function() {
switch (this.$newLineMode) {
case "windows":
return "\r\n";
case "unix":
return "\n";
case "auto":
return this.$autoNewLine;
}
};
this.$autoNewLine = "\n";
this.$newLineMode = "auto";
/**
* [Sets the new line mode.]{: #Document.setNewLineMode.desc}
* @param {String} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
*
*
**/
this.setNewLineMode = function(newLineMode) {
if (this.$newLineMode === newLineMode)
return;
this.$newLineMode = newLineMode;
};
/**
* [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode}
* @returns String
**/
this.getNewLineMode = function() {
return this.$newLineMode;
};
/**
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
* @param {String} text The text to check
*
*
*
**/
this.isNewLine = function(text) {
return (text == "\r\n" || text == "\r" || text == "\n");
};
/**
* Returns a verbatim copy of the given line as it is in the document
* @param {Number} row The row index to retrieve
*
*
*
**/
this.getLine = function(row) {
return this.$lines[row] || "";
};
/**
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
* @param {Number} firstRow The first row index to retrieve
* @param {Number} lastRow The final row index to retrieve
*
*
*
**/
this.getLines = function(firstRow, lastRow) {
return this.$lines.slice(firstRow, lastRow + 1);
};
/**
* Returns all lines in the document as string array. Warning: The caller should not modify this array!
**/
this.getAllLines = function() {
return this.getLines(0, this.getLength());
};
/**
* Returns the number of rows in the document.
**/
this.getLength = function() {
return this.$lines.length;
};
/**
* [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
* @param {Range} range The range to work with
*
*
**/
this.getTextRange = function(range) {
if (range.start.row == range.end.row) {
return this.$lines[range.start.row].substring(range.start.column,
range.end.column);
}
else {
var lines = this.getLines(range.start.row+1, range.end.row-1);
lines.unshift((this.$lines[range.start.row] || "").substring(range.start.column));
lines.push((this.$lines[range.end.row] || "").substring(0, range.end.column));
return lines.join(this.getNewLineCharacter());
}
};
this.$clipPosition = function(position) {
var length = this.getLength();
if (position.row >= length) {
position.row = Math.max(0, length - 1);
position.column = this.getLine(length-1).length;
}
return position;
};
/**
* Inserts a block of `text` and the indicated `position`.
* @param {Object} position The position to start inserting at
* @param {String} text A chunk of text to insert
* @returns {Object} The position ({row, column}) of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
*
**/
this.insert = function(position, text) {
if (!text || text.length === 0)
return position;
position = this.$clipPosition(position);
// only detect new lines if the document has no line break yet
if (this.getLength() <= 1)
this.$detectNewLine(text);
var lines = this.$split(text);
var firstLine = lines.splice(0, 1)[0];
var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
position = this.insertInLine(position, firstLine);
if (lastLine !== null) {
position = this.insertNewLine(position); // terminate first line
position = this.insertLines(position.row, lines);
position = this.insertInLine(position, lastLine || "");
}
return position;
};
/**
* Fires whenever the document changes.
*
* Several methods trigger different `"change"` events. Below is a list of each action type, followed by each property that's also available:
*
* * `"insertLines"` (emitted by [[Document.insertLines]])
* * `range`: the [[Range]] of the change within the document
* * `lines`: the lines in the document that are changing
* * `"insertText"` (emitted by [[Document.insertNewLine]])
* * `range`: the [[Range]] of the change within the document
* * `text`: the text that's being added
* * `"removeLines"` (emitted by [[Document.insertLines]])
* * `range`: the [[Range]] of the change within the document
* * `lines`: the lines in the document that were removed
* * `nl`: the new line character (as defined by [[Document.getNewLineCharacter]])
* * `"removeText"` (emitted by [[Document.removeInLine]] and [[Document.removeNewLine]])
* * `range`: the [[Range]] of the change within the document
* * `text`: the text that's being removed
*
* @event change
* @param {Object} e Contains at least one property called `"action"`. `"action"` indicates the action that triggered the change. Each action also has a set of additional properties.
*
**/
/**
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
* @param {Number} row The index of the row to insert at
* @param {Array} lines An array of strings
* @returns {Object} Contains the final row and column, like this:
* ```
* {row: endRow, column: 0}
* ```
* If `lines` is empty, this function returns an object containing the current row, and column, like this:
* ```
* {row: row, column: 0}
* ```
*
*
*
*
**/
this.insertLines = function(row, lines) {
if (lines.length == 0)
return {row: row, column: 0};
// apply doesn't work for big arrays (smallest threshold is on safari 0xFFFF)
// to circumvent that we have to break huge inserts into smaller chunks here
if (lines.length > 0xFFFF) {
var end = this.insertLines(row, lines.slice(0xFFFF));
lines = lines.slice(0, 0xFFFF);
}
var args = [row, 0];
args.push.apply(args, lines);
this.$lines.splice.apply(this.$lines, args);
var range = new Range(row, 0, row + lines.length, 0);
var delta = {
action: "insertLines",
range: range,
lines: lines
};
this._emit("change", { data: delta });
return end || range.end;
};
/**
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
* @param {Object} position The position to insert at
* @returns {Object} Returns an object containing the final row and column, like this:<br/>
* ```
* {row: endRow, column: 0}
* ```
*
**/
this.insertNewLine = function(position) {
position = this.$clipPosition(position);
var line = this.$lines[position.row] || "";
this.$lines[position.row] = line.substring(0, position.column);
this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
var end = {
row : position.row + 1,
column : 0
};
var delta = {
action: "insertText",
range: Range.fromPoints(position, end),
text: this.getNewLineCharacter()
};
this._emit("change", { data: delta });
return end;
};
/**
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
* @param {Object} position The position to insert at
* @param {String} text A chunk of text
* @returns {Object} Returns an object containing the final row and column, like this:
* ```
* {row: endRow, column: 0}
* ```
*
**/
this.insertInLine = function(position, text) {
if (text.length == 0)
return position;
var line = this.$lines[position.row] || "";
this.$lines[position.row] = line.substring(0, position.column) + text
+ line.substring(position.column);
var end = {
row : position.row,
column : position.column + text.length
};
var delta = {
action: "insertText",
range: Range.fromPoints(position, end),
text: text
};
this._emit("change", { data: delta });
return end;
};
/**
* Removes the `range` from the document.
* @param {Range} range A specified Range to remove
* @returns {Object} Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
*
*
**/
this.remove = function(range) {
// clip to document
range.start = this.$clipPosition(range.start);
range.end = this.$clipPosition(range.end);
if (range.isEmpty())
return range.start;
var firstRow = range.start.row;
var lastRow = range.end.row;
if (range.isMultiLine()) {
var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
var lastFullRow = lastRow - 1;
if (range.end.column > 0)
this.removeInLine(lastRow, 0, range.end.column);
if (lastFullRow >= firstFullRow)
this.removeLines(firstFullRow, lastFullRow);
if (firstFullRow != firstRow) {
this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
this.removeNewLine(range.start.row);
}
}
else {
this.removeInLine(firstRow, range.start.column, range.end.column);
}
return range.start;
};
/**
* Removes the specified columns from the `row`. This method also triggers the `'change'` event.
* @param {Number} row The row to remove from
* @param {Number} startColumn The column to start removing at
* @param {Number} endColumn The column to stop removing at
* @returns {Object} Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.<br/>If `startColumn` is equal to `endColumn`, this function returns nothing.
*
*
**/
this.removeInLine = function(row, startColumn, endColumn) {
if (startColumn == endColumn)
return;
var range = new Range(row, startColumn, row, endColumn);
var line = this.getLine(row);
var removed = line.substring(startColumn, endColumn);
var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
this.$lines.splice(row, 1, newLine);
var delta = {
action: "removeText",
range: range,
text: removed
};
this._emit("change", { data: delta });
return range.start;
};
/**
* Removes a range of full lines. This method also triggers the `'change'` event.
* @param {Number} firstRow The first row to be removed
* @param {Number} lastRow The last row to be removed
* @returns {[String]} Returns all the removed lines.
*
*
**/
this.removeLines = function(firstRow, lastRow) {
var range = new Range(firstRow, 0, lastRow + 1, 0);
var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
var delta = {
action: "removeLines",
range: range,
nl: this.getNewLineCharacter(),
lines: removed
};
this._emit("change", { data: delta });
return removed;
};
/**
* Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
* @param {Number} row The row to check
*
**/
this.removeNewLine = function(row) {
var firstLine = this.getLine(row);
var secondLine = this.getLine(row+1);
var range = new Range(row, firstLine.length, row+1, 0);
var line = firstLine + secondLine;
this.$lines.splice(row, 2, line);
var delta = {
action: "removeText",
range: range,
text: this.getNewLineCharacter()
};
this._emit("change", { data: delta });
};
/**
* Replaces a range in the document with the new `text`.
* @param {Range} range A specified Range to replace
* @param {String} text The new text to use as a replacement
* @returns {Object} Returns an object containing the final row and column, like this:
* {row: endRow, column: 0}
* If the text and range are empty, this function returns an object containing the current `range.start` value.
* If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
*
*
**/
this.replace = function(range, text) {
if (text.length == 0 && range.isEmpty())
return range.start;
// Shortcut: If the text we want to insert is the same as it is already
// in the document, we don't have to replace anything.
if (text == this.getTextRange(range))
return range.end;
this.remove(range);
if (text) {
var end = this.insert(range.start, text);
}
else {
end = range.start;
}
return end;
};
/**
* Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
**/
this.applyDeltas = function(deltas) {
for (var i=0; i<deltas.length; i++) {
var delta = deltas[i];
var range = Range.fromPoints(delta.range.start, delta.range.end);
if (delta.action == "insertLines")
this.insertLines(range.start.row, delta.lines);
else if (delta.action == "insertText")
this.insert(range.start, delta.text);
else if (delta.action == "removeLines")
this.removeLines(range.start.row, range.end.row - 1);
else if (delta.action == "removeText")
this.remove(range);
}
};
/**
* Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
**/
this.revertDeltas = function(deltas) {
for (var i=deltas.length-1; i>=0; i--) {
var delta = deltas[i];
var range = Range.fromPoints(delta.range.start, delta.range.end);
if (delta.action == "insertLines")
this.removeLines(range.start.row, range.end.row - 1);
else if (delta.action == "insertText")
this.remove(range);
else if (delta.action == "removeLines")
this.insertLines(range.start.row, delta.lines);
else if (delta.action == "removeText")
this.insert(range.start, delta.text);
}
};
}).call(Document.prototype);
exports.Document = Document;
});
@@ -0,0 +1,306 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
require("./test/mockdom");
}
define(function(require, exports, module) {
"use strict";
var Document = require("./document").Document;
var Range = require("./range").Range;
var assert = require("./test/assertions");
module.exports = {
"test: insert text in line" : function() {
var doc = new Document(["12", "34"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.insert({row: 0, column: 1}, "juhu");
assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n"));
var d = deltas.concat();
doc.revertDeltas(d);
assert.equal(doc.getValue(), ["12", "34"].join("\n"));
doc.applyDeltas(d);
assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n"));
},
"test: insert new line" : function() {
var doc = new Document(["12", "34"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.insertNewLine({row: 0, column: 1});
assert.equal(doc.getValue(), ["1", "2", "34"].join("\n"));
var d = deltas.concat();
doc.revertDeltas(d);
assert.equal(doc.getValue(), ["12", "34"].join("\n"));
doc.applyDeltas(d);
assert.equal(doc.getValue(), ["1", "2", "34"].join("\n"));
},
"test: insert lines at the beginning" : function() {
var doc = new Document(["12", "34"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.insertLines(0, ["aa", "bb"]);
assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n"));
var d = deltas.concat();
doc.revertDeltas(d);
assert.equal(doc.getValue(), ["12", "34"].join("\n"));
doc.applyDeltas(d);
assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n"));
},
"test: insert lines at the end" : function() {
var doc = new Document(["12", "34"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.insertLines(2, ["aa", "bb"]);
assert.equal(doc.getValue(), ["12", "34", "aa", "bb"].join("\n"));
},
"test: insert lines in the middle" : function() {
var doc = new Document(["12", "34"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.insertLines(1, ["aa", "bb"]);
assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n"));
var d = deltas.concat();
doc.revertDeltas(d);
assert.equal(doc.getValue(), ["12", "34"].join("\n"));
doc.applyDeltas(d);
assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n"));
},
"test: insert multi line string at the start" : function() {
var doc = new Document(["12", "34"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.insert({row: 0, column: 0}, "aa\nbb\ncc");
assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n"));
var d = deltas.concat();
doc.revertDeltas(d);
assert.equal(doc.getValue(), ["12", "34"].join("\n"));
doc.applyDeltas(d);
assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n"));
},
"test: insert multi line string at the end" : function() {
var doc = new Document(["12", "34"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.insert({row: 2, column: 0}, "aa\nbb\ncc");
assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n"));
var d = deltas.concat();
doc.revertDeltas(d);
assert.equal(doc.getValue(), ["12", "34"].join("\n"));
doc.applyDeltas(d);
assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n"));
},
"test: insert multi line string in the middle" : function() {
var doc = new Document(["12", "34"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.insert({row: 0, column: 1}, "aa\nbb\ncc");
assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n"));
var d = deltas.concat();
doc.revertDeltas(d);
assert.equal(doc.getValue(), ["12", "34"].join("\n"));
doc.applyDeltas(d);
assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n"));
},
"test: delete in line" : function() {
var doc = new Document(["1234", "5678"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.remove(new Range(0, 1, 0, 3));
assert.equal(doc.getValue(), ["14", "5678"].join("\n"));
var d = deltas.concat();
doc.revertDeltas(d);
assert.equal(doc.getValue(), ["1234", "5678"].join("\n"));
doc.applyDeltas(d);
assert.equal(doc.getValue(), ["14", "5678"].join("\n"));
},
"test: delete new line" : function() {
var doc = new Document(["1234", "5678"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.remove(new Range(0, 4, 1, 0));
assert.equal(doc.getValue(), ["12345678"].join("\n"));
var d = deltas.concat();
doc.revertDeltas(d);
assert.equal(doc.getValue(), ["1234", "5678"].join("\n"));
doc.applyDeltas(d);
assert.equal(doc.getValue(), ["12345678"].join("\n"));
},
"test: delete multi line range line" : function() {
var doc = new Document(["1234", "5678", "abcd"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.remove(new Range(0, 2, 2, 2));
assert.equal(doc.getValue(), ["12cd"].join("\n"));
var d = deltas.concat();
doc.revertDeltas(d);
assert.equal(doc.getValue(), ["1234", "5678", "abcd"].join("\n"));
doc.applyDeltas(d);
assert.equal(doc.getValue(), ["12cd"].join("\n"));
},
"test: delete full lines" : function() {
var doc = new Document(["1234", "5678", "abcd"]);
var deltas = [];
doc.on("change", function(e) { deltas.push(e.data); });
doc.remove(new Range(1, 0, 3, 0));
assert.equal(doc.getValue(), ["1234", ""].join("\n"));
},
"test: remove lines should return the removed lines" : function() {
var doc = new Document(["1234", "5678", "abcd"]);
var removed = doc.removeLines(1, 2);
assert.equal(removed.join("\n"), ["5678", "abcd"].join("\n"));
},
"test: should handle unix style new lines" : function() {
var doc = new Document(["1", "2", "3"]);
assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
},
"test: should handle windows style new lines" : function() {
var doc = new Document(["1", "2", "3"].join("\r\n"));
doc.setNewLineMode("unix");
assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
},
"test: set new line mode to 'windows' should use '\\r\\n' as new lines": function() {
var doc = new Document(["1", "2", "3"].join("\n"));
doc.setNewLineMode("windows");
assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n"));
},
"test: set new line mode to 'unix' should use '\\n' as new lines": function() {
var doc = new Document(["1", "2", "3"].join("\r\n"));
doc.setNewLineMode("unix");
assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
},
"test: set new line mode to 'auto' should detect the incoming nl type": function() {
var doc = new Document(["1", "2", "3"].join("\n"));
doc.setNewLineMode("auto");
assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
var doc = new Document(["1", "2", "3"].join("\r\n"));
doc.setNewLineMode("auto");
assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n"));
doc.replace(new Range(0, 0, 2, 1), ["4", "5", "6"].join("\n"));
assert.equal(["4", "5", "6"].join("\n"), doc.getValue());
},
"test: set value": function() {
var doc = new Document("1");
assert.equal("1", doc.getValue());
doc.setValue(doc.getValue());
assert.equal("1", doc.getValue());
var doc = new Document("1\n2");
assert.equal("1\n2", doc.getValue());
doc.setValue(doc.getValue());
assert.equal("1\n2", doc.getValue());
},
"test: empty document has to contain one line": function() {
var doc = new Document("");
assert.equal(doc.$lines.length, 1);
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,219 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var TokenIterator = require("../token_iterator").TokenIterator;
var Range = require("../range").Range;
function BracketMatch() {
this.findMatchingBracket = function(position, char) {
if (position.column == 0) return null;
var charBeforeCursor = char || this.getLine(position.row).charAt(position.column-1);
if (charBeforeCursor == "") return null;
var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
if (!match)
return null;
if (match[1])
return this.$findClosingBracket(match[1], position);
else
return this.$findOpeningBracket(match[2], position);
};
this.getBracketRange = function(pos) {
var line = this.getLine(pos.row);
var before = true, range;
var chr = line.charAt(pos.column-1);
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
if (!match) {
chr = line.charAt(pos.column);
pos = {row: pos.row, column: pos.column + 1};
match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
before = false;
}
if (!match)
return null;
if (match[1]) {
var bracketPos = this.$findClosingBracket(match[1], pos);
if (!bracketPos)
return null;
range = Range.fromPoints(pos, bracketPos);
if (!before) {
range.end.column++;
range.start.column--;
}
range.cursor = range.end;
} else {
var bracketPos = this.$findOpeningBracket(match[2], pos);
if (!bracketPos)
return null;
range = Range.fromPoints(bracketPos, pos);
if (!before) {
range.start.column++;
range.end.column--;
}
range.cursor = range.start;
}
return range;
};
this.$brackets = {
")": "(",
"(": ")",
"]": "[",
"[": "]",
"{": "}",
"}": "{"
};
this.$findOpeningBracket = function(bracket, position, typeRe) {
var openBracket = this.$brackets[bracket];
var depth = 1;
var iterator = new TokenIterator(this, position.row, position.column);
var token = iterator.getCurrentToken();
if (!token)
token = iterator.stepForward();
if (!token)
return;
if (!typeRe){
typeRe = new RegExp(
"(\\.?" +
token.type.replace(".", "\\.").replace("rparen", ".paren")
+ ")+"
);
}
// Start searching in token, just before the character at position.column
var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;
var value = token.value;
while (true) {
while (valueIndex >= 0) {
var chr = value.charAt(valueIndex);
if (chr == openBracket) {
depth -= 1;
if (depth == 0) {
return {row: iterator.getCurrentTokenRow(),
column: valueIndex + iterator.getCurrentTokenColumn()};
}
}
else if (chr == bracket) {
depth += 1;
}
valueIndex -= 1;
}
// Scan backward through the document, looking for the next token
// whose type matches typeRe
do {
token = iterator.stepBackward();
} while (token && !typeRe.test(token.type));
if (token == null)
break;
value = token.value;
valueIndex = value.length - 1;
}
return null;
};
this.$findClosingBracket = function(bracket, position, typeRe) {
var closingBracket = this.$brackets[bracket];
var depth = 1;
var iterator = new TokenIterator(this, position.row, position.column);
var token = iterator.getCurrentToken();
if (!token)
token = iterator.stepForward();
if (!token)
return;
if (!typeRe){
typeRe = new RegExp(
"(\\.?" +
token.type.replace(".", "\\.").replace("lparen", ".paren")
+ ")+"
);
}
// Start searching in token, after the character at position.column
var valueIndex = position.column - iterator.getCurrentTokenColumn();
while (true) {
var value = token.value;
var valueLength = value.length;
while (valueIndex < valueLength) {
var chr = value.charAt(valueIndex);
if (chr == closingBracket) {
depth -= 1;
if (depth == 0) {
return {row: iterator.getCurrentTokenRow(),
column: valueIndex + iterator.getCurrentTokenColumn()};
}
}
else if (chr == bracket) {
depth += 1;
}
valueIndex += 1;
}
// Scan forward through the document, looking for the next token
// whose type matches typeRe
do {
token = iterator.stepForward();
} while (token && !typeRe.test(token.type));
if (token == null)
break;
valueIndex = 0;
}
return null;
};
}
exports.BracketMatch = BracketMatch;
});
@@ -0,0 +1,108 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
/*
* Simple fold-data struct.
**/
var Fold = exports.Fold = function(range, placeholder) {
this.foldLine = null;
this.placeholder = placeholder;
this.range = range;
this.start = range.start;
this.end = range.end;
this.sameRow = range.start.row == range.end.row;
this.subFolds = [];
};
(function() {
this.toString = function() {
return '"' + this.placeholder + '" ' + this.range.toString();
};
this.setFoldLine = function(foldLine) {
this.foldLine = foldLine;
this.subFolds.forEach(function(fold) {
fold.setFoldLine(foldLine);
});
};
this.clone = function() {
var range = this.range.clone();
var fold = new Fold(range, this.placeholder);
this.subFolds.forEach(function(subFold) {
fold.subFolds.push(subFold.clone());
});
return fold;
};
this.addSubFold = function(fold) {
if (this.range.isEqual(fold))
return this;
if (!this.range.containsRange(fold))
throw "A fold can't intersect already existing fold" + fold.range + this.range;
var row = fold.range.start.row, column = fold.range.start.column;
for (var i = 0, cmp = -1; i < this.subFolds.length; i++) {
cmp = this.subFolds[i].range.compare(row, column);
if (cmp != 1)
break;
}
var afterStart = this.subFolds[i];
if (cmp == 0)
return afterStart.addSubFold(fold);
// cmp == -1
var row = fold.range.end.row, column = fold.range.end.column;
for (var j = i, cmp = -1; j < this.subFolds.length; j++) {
cmp = this.subFolds[j].range.compare(row, column);
if (cmp != 1)
break;
}
var afterEnd = this.subFolds[j];
if (cmp == 0)
throw "A fold can't intersect already existing fold" + fold.range + this.range;
var consumedFolds = this.subFolds.splice(i, j - i, fold);
fold.setFoldLine(this.foldLine);
return fold;
};
}).call(Fold.prototype);
});
@@ -0,0 +1,268 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var Range = require("../range").Range;
/*
* If an array is passed in, the folds are expected to be sorted already.
*/
function FoldLine(foldData, folds) {
this.foldData = foldData;
if (Array.isArray(folds)) {
this.folds = folds;
} else {
folds = this.folds = [ folds ];
}
var last = folds[folds.length - 1]
this.range = new Range(folds[0].start.row, folds[0].start.column,
last.end.row, last.end.column);
this.start = this.range.start;
this.end = this.range.end;
this.folds.forEach(function(fold) {
fold.setFoldLine(this);
}, this);
}
(function() {
/*
* Note: This doesn't update wrapData!
*/
this.shiftRow = function(shift) {
this.start.row += shift;
this.end.row += shift;
this.folds.forEach(function(fold) {
fold.start.row += shift;
fold.end.row += shift;
});
}
this.addFold = function(fold) {
if (fold.sameRow) {
if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
throw "Can't add a fold to this FoldLine as it has no connection";
}
this.folds.push(fold);
this.folds.sort(function(a, b) {
return -a.range.compareEnd(b.start.row, b.start.column);
});
if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
this.end.row = fold.end.row;
this.end.column = fold.end.column;
} else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
this.start.row = fold.start.row;
this.start.column = fold.start.column;
}
} else if (fold.start.row == this.end.row) {
this.folds.push(fold);
this.end.row = fold.end.row;
this.end.column = fold.end.column;
} else if (fold.end.row == this.start.row) {
this.folds.unshift(fold);
this.start.row = fold.start.row;
this.start.column = fold.start.column;
} else {
throw "Trying to add fold to FoldRow that doesn't have a matching row";
}
fold.foldLine = this;
}
this.containsRow = function(row) {
return row >= this.start.row && row <= this.end.row;
}
this.walk = function(callback, endRow, endColumn) {
var lastEnd = 0,
folds = this.folds,
fold,
comp, stop, isNewRow = true;
if (endRow == null) {
endRow = this.end.row;
endColumn = this.end.column;
}
for (var i = 0; i < folds.length; i++) {
fold = folds[i];
comp = fold.range.compareStart(endRow, endColumn);
// This fold is after the endRow/Column.
if (comp == -1) {
callback(null, endRow, endColumn, lastEnd, isNewRow);
return;
}
stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
// If the user requested to stop the walk or endRow/endColumn is
// inside of this fold (comp == 0), then end here.
if (stop || comp == 0) {
return;
}
// Note the new lastEnd might not be on the same line. However,
// it's the callback's job to recognize this.
isNewRow = !fold.sameRow;
lastEnd = fold.end.column;
}
callback(null, endRow, endColumn, lastEnd, isNewRow);
}
this.getNextFoldTo = function(row, column) {
var fold, cmp;
for (var i = 0; i < this.folds.length; i++) {
fold = this.folds[i];
cmp = fold.range.compareEnd(row, column);
if (cmp == -1) {
return {
fold: fold,
kind: "after"
};
} else if (cmp == 0) {
return {
fold: fold,
kind: "inside"
}
}
}
return null;
}
this.addRemoveChars = function(row, column, len) {
var ret = this.getNextFoldTo(row, column),
fold, folds;
if (ret) {
fold = ret.fold;
if (ret.kind == "inside"
&& fold.start.column != column
&& fold.start.row != row)
{
//throwing here breaks whole editor
//TODO: properly handle this
window.console && window.console.log(row, column, fold);
} else if (fold.start.row == row) {
folds = this.folds;
var i = folds.indexOf(fold);
if (i == 0) {
this.start.column += len;
}
for (i; i < folds.length; i++) {
fold = folds[i];
fold.start.column += len;
if (!fold.sameRow) {
return;
}
fold.end.column += len;
}
this.end.column += len;
}
}
}
this.split = function(row, column) {
var fold = this.getNextFoldTo(row, column).fold,
folds = this.folds;
var foldData = this.foldData;
if (!fold) {
return null;
}
var i = folds.indexOf(fold);
var foldBefore = folds[i - 1];
this.end.row = foldBefore.end.row;
this.end.column = foldBefore.end.column;
// Remove the folds after row/column and create a new FoldLine
// containing these removed folds.
folds = folds.splice(i, folds.length - i);
var newFoldLine = new FoldLine(foldData, folds);
foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
return newFoldLine;
}
this.merge = function(foldLineNext) {
var folds = foldLineNext.folds;
for (var i = 0; i < folds.length; i++) {
this.addFold(folds[i]);
}
// Remove the foldLineNext - no longer needed, as
// it's merged now with foldLineNext.
var foldData = this.foldData;
foldData.splice(foldData.indexOf(foldLineNext), 1);
}
this.toString = function() {
var ret = [this.range.toString() + ": [" ];
this.folds.forEach(function(fold) {
ret.push(" " + fold.toString());
});
ret.push("]")
return ret.join("\n");
}
this.idxToPosition = function(idx) {
var lastFoldEndColumn = 0;
var fold;
for (var i = 0; i < this.folds.length; i++) {
var fold = this.folds[i];
idx -= fold.start.column - lastFoldEndColumn;
if (idx < 0) {
return {
row: fold.start.row,
column: fold.start.column + idx
};
}
idx -= fold.placeholder.length;
if (idx < 0) {
return fold.start;
}
lastFoldEndColumn = fold.end.column;
}
return {
row: this.end.row,
column: this.end.column + idx
};
}
}).call(FoldLine.prototype);
exports.FoldLine = FoldLine;
});
@@ -0,0 +1,751 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var Range = require("../range").Range;
var FoldLine = require("./fold_line").FoldLine;
var Fold = require("./fold").Fold;
var TokenIterator = require("../token_iterator").TokenIterator;
function Folding() {
/*
* Looks up a fold at a given row/column. Possible values for side:
* -1: ignore a fold if fold.start = row/column
* +1: ignore a fold if fold.end = row/column
*/
this.getFoldAt = function(row, column, side) {
var foldLine = this.getFoldLine(row);
if (!foldLine)
return null;
var folds = foldLine.folds;
for (var i = 0; i < folds.length; i++) {
var fold = folds[i];
if (fold.range.contains(row, column)) {
if (side == 1 && fold.range.isEnd(row, column)) {
continue;
} else if (side == -1 && fold.range.isStart(row, column)) {
continue;
}
return fold;
}
}
};
/*
* Returns all folds in the given range. Note, that this will return folds
*
*/
this.getFoldsInRange = function(range) {
range = range.clone();
var start = range.start;
var end = range.end;
var foldLines = this.$foldData;
var foundFolds = [];
start.column += 1;
end.column -= 1;
for (var i = 0; i < foldLines.length; i++) {
var cmp = foldLines[i].range.compareRange(range);
if (cmp == 2) {
// Range is before foldLine. No intersection. This means,
// there might be other foldLines that intersect.
continue;
}
else if (cmp == -2) {
// Range is after foldLine. There can't be any other foldLines then,
// so let's give up.
break;
}
var folds = foldLines[i].folds;
for (var j = 0; j < folds.length; j++) {
var fold = folds[j];
cmp = fold.range.compareRange(range);
if (cmp == -2) {
break;
} else if (cmp == 2) {
continue;
} else
// WTF-state: Can happen due to -1/+1 to start/end column.
if (cmp == 42) {
break;
}
foundFolds.push(fold);
}
}
return foundFolds;
};
/*
* Returns all folds in the document
*/
this.getAllFolds = function() {
var folds = [];
var foldLines = this.$foldData;
function addFold(fold) {
folds.push(fold);
if (!fold.subFolds)
return;
for (var i = 0; i < fold.subFolds.length; i++)
addFold(fold.subFolds[i]);
}
for (var i = 0; i < foldLines.length; i++)
for (var j = 0; j < foldLines[i].folds.length; j++)
addFold(foldLines[i].folds[j]);
return folds;
};
/*
* Returns the string between folds at the given position.
* E.g.
* foo<fold>b|ar<fold>wolrd -> "bar"
* foo<fold>bar<fold>wol|rd -> "world"
* foo<fold>bar<fo|ld>wolrd -> <null>
*
* where | means the position of row/column
*
* The trim option determs if the return string should be trimed according
* to the "side" passed with the trim value:
*
* E.g.
* foo<fold>b|ar<fold>wolrd -trim=-1> "b"
* foo<fold>bar<fold>wol|rd -trim=+1> "rld"
* fo|o<fold>bar<fold>wolrd -trim=00> "foo"
*/
this.getFoldStringAt = function(row, column, trim, foldLine) {
foldLine = foldLine || this.getFoldLine(row);
if (!foldLine)
return null;
var lastFold = {
end: { column: 0 }
};
// TODO: Refactor to use getNextFoldTo function.
var str, fold;
for (var i = 0; i < foldLine.folds.length; i++) {
fold = foldLine.folds[i];
var cmp = fold.range.compareEnd(row, column);
if (cmp == -1) {
str = this
.getLine(fold.start.row)
.substring(lastFold.end.column, fold.start.column);
break;
}
else if (cmp === 0) {
return null;
}
lastFold = fold;
}
if (!str)
str = this.getLine(fold.start.row).substring(lastFold.end.column);
if (trim == -1)
return str.substring(0, column - lastFold.end.column);
else if (trim == 1)
return str.substring(column - lastFold.end.column);
else
return str;
};
this.getFoldLine = function(docRow, startFoldLine) {
var foldData = this.$foldData;
var i = 0;
if (startFoldLine)
i = foldData.indexOf(startFoldLine);
if (i == -1)
i = 0;
for (i; i < foldData.length; i++) {
var foldLine = foldData[i];
if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
return foldLine;
} else if (foldLine.end.row > docRow) {
return null;
}
}
return null;
};
// returns the fold which starts after or contains docRow
this.getNextFoldLine = function(docRow, startFoldLine) {
var foldData = this.$foldData;
var i = 0;
if (startFoldLine)
i = foldData.indexOf(startFoldLine);
if (i == -1)
i = 0;
for (i; i < foldData.length; i++) {
var foldLine = foldData[i];
if (foldLine.end.row >= docRow) {
return foldLine;
}
}
return null;
};
this.getFoldedRowCount = function(first, last) {
var foldData = this.$foldData, rowCount = last-first+1;
for (var i = 0; i < foldData.length; i++) {
var foldLine = foldData[i],
end = foldLine.end.row,
start = foldLine.start.row;
if (end >= last) {
if(start < last) {
if(start >= first)
rowCount -= last-start;
else
rowCount = 0;//in one fold
}
break;
} else if(end >= first){
if (start >= first) //fold inside range
rowCount -= end-start;
else
rowCount -= end-first+1;
}
}
return rowCount;
};
this.$addFoldLine = function(foldLine) {
this.$foldData.push(foldLine);
this.$foldData.sort(function(a, b) {
return a.start.row - b.start.row;
});
return foldLine;
};
/*
* Adds a new fold.
*
* @returns
* The new created Fold object or an existing fold object in case the
* passed in range fits an existing fold exactly.
*/
this.addFold = function(placeholder, range) {
var foldData = this.$foldData;
var added = false;
var fold;
if (placeholder instanceof Fold)
fold = placeholder;
else
fold = new Fold(range, placeholder);
this.$clipRangeToDocument(fold.range);
var startRow = fold.start.row;
var startColumn = fold.start.column;
var endRow = fold.end.row;
var endColumn = fold.end.column;
// --- Some checking ---
if (startRow == endRow && endColumn - startColumn < 2)
throw "The range has to be at least 2 characters width";
var startFold = this.getFoldAt(startRow, startColumn, 1);
var endFold = this.getFoldAt(endRow, endColumn, -1);
if (startFold && endFold == startFold)
return startFold.addSubFold(fold);
if (
(startFold && !startFold.range.isStart(startRow, startColumn))
|| (endFold && !endFold.range.isEnd(endRow, endColumn))
) {
throw "A fold can't intersect already existing fold" + fold.range + startFold.range;
}
// Check if there are folds in the range we create the new fold for.
var folds = this.getFoldsInRange(fold.range);
if (folds.length > 0) {
// Remove the folds from fold data.
this.removeFolds(folds);
// Add the removed folds as subfolds on the new fold.
fold.subFolds = folds;
}
for (var i = 0; i < foldData.length; i++) {
var foldLine = foldData[i];
if (endRow == foldLine.start.row) {
foldLine.addFold(fold);
added = true;
break;
}
else if (startRow == foldLine.end.row) {
foldLine.addFold(fold);
added = true;
if (!fold.sameRow) {
// Check if we might have to merge two FoldLines.
var foldLineNext = foldData[i + 1];
if (foldLineNext && foldLineNext.start.row == endRow) {
// We need to merge!
foldLine.merge(foldLineNext);
break;
}
}
break;
}
else if (endRow <= foldLine.start.row) {
break;
}
}
if (!added)
foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
if (this.$useWrapMode)
this.$updateWrapData(foldLine.start.row, foldLine.start.row);
else
this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
// Notify that fold data has changed.
this.$modified = true;
this._emit("changeFold", { data: fold });
return fold;
};
this.addFolds = function(folds) {
folds.forEach(function(fold) {
this.addFold(fold);
}, this);
};
this.removeFold = function(fold) {
var foldLine = fold.foldLine;
var startRow = foldLine.start.row;
var endRow = foldLine.end.row;
var foldLines = this.$foldData;
var folds = foldLine.folds;
// Simple case where there is only one fold in the FoldLine such that
// the entire fold line can get removed directly.
if (folds.length == 1) {
foldLines.splice(foldLines.indexOf(foldLine), 1);
} else
// If the fold is the last fold of the foldLine, just remove it.
if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
folds.pop();
foldLine.end.row = folds[folds.length - 1].end.row;
foldLine.end.column = folds[folds.length - 1].end.column;
} else
// If the fold is the first fold of the foldLine, just remove it.
if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
folds.shift();
foldLine.start.row = folds[0].start.row;
foldLine.start.column = folds[0].start.column;
} else
// We know there are more then 2 folds and the fold is not at the edge.
// This means, the fold is somewhere in between.
//
// If the fold is in one row, we just can remove it.
if (fold.sameRow) {
folds.splice(folds.indexOf(fold), 1);
} else
// The fold goes over more then one row. This means remvoing this fold
// will cause the fold line to get splitted up. newFoldLine is the second part
{
var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
folds = newFoldLine.folds;
folds.shift();
newFoldLine.start.row = folds[0].start.row;
newFoldLine.start.column = folds[0].start.column;
}
if (this.$useWrapMode)
this.$updateWrapData(startRow, endRow);
else
this.$updateRowLengthCache(startRow, endRow);
// Notify that fold data has changed.
this.$modified = true;
this._emit("changeFold", { data: fold });
};
this.removeFolds = function(folds) {
// We need to clone the folds array passed in as it might be the folds
// array of a fold line and as we call this.removeFold(fold), folds
// are removed from folds and changes the current index.
var cloneFolds = [];
for (var i = 0; i < folds.length; i++) {
cloneFolds.push(folds[i]);
}
cloneFolds.forEach(function(fold) {
this.removeFold(fold);
}, this);
this.$modified = true;
};
this.expandFold = function(fold) {
this.removeFold(fold);
fold.subFolds.forEach(function(fold) {
this.addFold(fold);
}, this);
fold.subFolds = [];
};
this.expandFolds = function(folds) {
folds.forEach(function(fold) {
this.expandFold(fold);
}, this);
};
this.unfold = function(location, expandInner) {
var range, folds;
if (location == null)
range = new Range(0, 0, this.getLength(), 0);
else if (typeof location == "number")
range = new Range(location, 0, location, this.getLine(location).length);
else if ("row" in location)
range = Range.fromPoints(location, location);
else
range = location;
folds = this.getFoldsInRange(range);
if (expandInner) {
this.removeFolds(folds);
} else {
// TODO: might need to remove and add folds in one go instead of using
// expandFolds several times.
while (folds.length) {
this.expandFolds(folds);
folds = this.getFoldsInRange(range);
}
}
};
/*
* Checks if a given documentRow is folded. This is true if there are some
* folded parts such that some parts of the line is still visible.
**/
this.isRowFolded = function(docRow, startFoldRow) {
return !!this.getFoldLine(docRow, startFoldRow);
};
this.getRowFoldEnd = function(docRow, startFoldRow) {
var foldLine = this.getFoldLine(docRow, startFoldRow);
return foldLine ? foldLine.end.row : docRow;
};
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
if (startRow == null) {
startRow = foldLine.start.row;
startColumn = 0;
}
if (endRow == null) {
endRow = foldLine.end.row;
endColumn = this.getLine(endRow).length;
}
// Build the textline using the FoldLine walker.
var doc = this.doc;
var textLine = "";
foldLine.walk(function(placeholder, row, column, lastColumn) {
if (row < startRow) {
return;
} else if (row == startRow) {
if (column < startColumn) {
return;
}
lastColumn = Math.max(startColumn, lastColumn);
}
if (placeholder != null) {
textLine += placeholder;
} else {
textLine += doc.getLine(row).substring(lastColumn, column);
}
}.bind(this), endRow, endColumn);
return textLine;
};
this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
var foldLine = this.getFoldLine(row);
if (!foldLine) {
var line;
line = this.doc.getLine(row);
return line.substring(startColumn || 0, endColumn || line.length);
} else {
return this.getFoldDisplayLine(
foldLine, row, endColumn, startRow, startColumn);
}
};
this.$cloneFoldData = function() {
var fd = [];
fd = this.$foldData.map(function(foldLine) {
var folds = foldLine.folds.map(function(fold) {
return fold.clone();
});
return new FoldLine(fd, folds);
});
return fd;
};
this.toggleFold = function(tryToUnfold) {
var selection = this.selection;
var range = selection.getRange();
var fold;
var bracketPos;
if (range.isEmpty()) {
var cursor = range.start;
fold = this.getFoldAt(cursor.row, cursor.column);
if (fold) {
this.expandFold(fold);
return;
}
else if (bracketPos = this.findMatchingBracket(cursor)) {
if (range.comparePoint(bracketPos) == 1) {
range.end = bracketPos;
}
else {
range.start = bracketPos;
range.start.column++;
range.end.column--;
}
}
else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
if (range.comparePoint(bracketPos) == 1)
range.end = bracketPos;
else
range.start = bracketPos;
range.start.column++;
}
else {
range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
}
} else {
var folds = this.getFoldsInRange(range);
if (tryToUnfold && folds.length) {
this.expandFolds(folds);
return;
}
else if (folds.length == 1 ) {
fold = folds[0];
}
}
if (!fold)
fold = this.getFoldAt(range.start.row, range.start.column);
if (fold && fold.range.toString() == range.toString()) {
this.expandFold(fold);
return;
}
var placeholder = "...";
if (!range.isMultiLine()) {
placeholder = this.getTextRange(range);
if(placeholder.length < 4)
return;
placeholder = placeholder.trim().substring(0, 2) + "..";
}
this.addFold(placeholder, range);
};
this.getCommentFoldRange = function(row, column, dir) {
var iterator = new TokenIterator(this, row, column);
var token = iterator.getCurrentToken();
if (token && /^comment|string/.test(token.type)) {
var range = new Range();
var re = new RegExp(token.type.replace(/\..*/, "\\."));
if (dir != 1) {
do {
token = iterator.stepBackward();
} while(token && re.test(token.type));
iterator.stepForward();
}
range.start.row = iterator.getCurrentTokenRow();
range.start.column = iterator.getCurrentTokenColumn() + 2;
iterator = new TokenIterator(this, row, column);
if (dir != -1) {
do {
token = iterator.stepForward();
} while(token && re.test(token.type));
token = iterator.stepBackward();
} else
token = iterator.getCurrentToken();
range.end.row = iterator.getCurrentTokenRow();
range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2;
return range;
}
};
this.foldAll = function(startRow, endRow) {
var foldWidgets = this.foldWidgets;
endRow = endRow || this.getLength();
for (var row = startRow || 0; row < endRow; row++) {
if (foldWidgets[row] == null)
foldWidgets[row] = this.getFoldWidget(row);
if (foldWidgets[row] != "start")
continue;
var range = this.getFoldWidgetRange(row);
// sometimes range can be incompatible with existing fold
// wouldn't it be better for addFold to return null istead of throwing?
if (range && range.end.row <= endRow) try {
this.addFold("...", range);
} catch(e) {}
}
};
this.$foldStyles = {
"manual": 1,
"markbegin": 1,
"markbeginend": 1
};
this.$foldStyle = "markbegin";
this.setFoldStyle = function(style) {
if (!this.$foldStyles[style])
throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]");
if (this.$foldStyle == style)
return;
this.$foldStyle = style;
if (style == "manual")
this.unfold();
// reset folding
var mode = this.$foldMode;
this.$setFolding(null);
this.$setFolding(mode);
};
// structured folding
this.$setFolding = function(foldMode) {
if (this.$foldMode == foldMode)
return;
this.$foldMode = foldMode;
this.removeListener('change', this.$updateFoldWidgets);
this._emit("changeAnnotation");
if (!foldMode || this.$foldStyle == "manual") {
this.foldWidgets = null;
return;
}
this.foldWidgets = [];
this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);
this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
this.on('change', this.$updateFoldWidgets);
};
this.onFoldWidgetClick = function(row, e) {
e = e.domEvent;
var type = this.getFoldWidget(row);
var line = this.getLine(row);
var onlySubfolds = e.shiftKey;
var addSubfolds = onlySubfolds || e.ctrlKey || e.altKey || e.metaKey;
var fold;
if (type == "end")
fold = this.getFoldAt(row, 0, -1);
else
fold = this.getFoldAt(row, line.length, 1);
if (fold) {
if (addSubfolds)
this.removeFold(fold);
else
this.expandFold(fold);
return;
}
var range = this.getFoldWidgetRange(row);
if (range) {
// sometimes singleline folds can be missed by the code above
if (!range.isMultiLine()) {
fold = this.getFoldAt(range.start.row, range.start.column, 1);
if (fold && range.isEqual(fold.range)) {
this.removeFold(fold);
return;
}
}
if (!onlySubfolds)
this.addFold("...", range);
if (addSubfolds)
this.foldAll(range.start.row + 1, range.end.row);
} else {
if (addSubfolds)
this.foldAll(row + 1, this.getLength());
(e.target || e.srcElement).className += " ace_invalid"
}
};
this.updateFoldWidgets = function(e) {
var delta = e.data;
var range = delta.range;
var firstRow = range.start.row;
var len = range.end.row - firstRow;
if (len === 0) {
this.foldWidgets[firstRow] = null;
} else if (delta.action == "removeText" || delta.action == "removeLines") {
this.foldWidgets.splice(firstRow, len + 1, null);
} else {
var args = Array(len + 1);
args.unshift(firstRow, 1);
this.foldWidgets.splice.apply(this.foldWidgets, args);
}
};
}
exports.Folding = Folding;
});
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,188 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
require("./test/mockdom");
}
define(function(require, exports, module) {
"use strict";
var EditSession = require("./edit_session").EditSession;
var Editor = require("./editor").Editor;
var Text = require("./mode/text").Mode;
var JavaScriptMode = require("./mode/javascript").Mode;
var CssMode = require("./mode/css").Mode;
var HtmlMode = require("./mode/html").Mode;
var MockRenderer = require("./test/mockrenderer").MockRenderer;
var assert = require("./test/assertions");
module.exports = {
setUp : function(next) {
this.session1 = new EditSession(["abc", "def"]);
this.session2 = new EditSession(["ghi", "jkl"]);
this.editor = new Editor(new MockRenderer());
next();
},
"test: change document" : function() {
this.editor.setSession(this.session1);
assert.equal(this.editor.getSession(), this.session1);
this.editor.setSession(this.session2);
assert.equal(this.editor.getSession(), this.session2);
},
"test: only changes to the new document should have effect" : function() {
var called = false;
this.editor.onDocumentChange = function() {
called = true;
};
this.editor.setSession(this.session1);
this.editor.setSession(this.session2);
this.session1.duplicateLines(0, 0);
assert.notOk(called);
this.session2.duplicateLines(0, 0);
assert.ok(called);
},
"test: should use cursor of new document" : function() {
this.session1.getSelection().moveCursorTo(0, 1);
this.session2.getSelection().moveCursorTo(1, 0);
this.editor.setSession(this.session1);
assert.position(this.editor.getCursorPosition(), 0, 1);
this.editor.setSession(this.session2);
assert.position(this.editor.getCursorPosition(), 1, 0);
},
"test: only changing the cursor of the new doc should not have an effect" : function() {
this.editor.onCursorChange = function() {
called = true;
};
this.editor.setSession(this.session1);
this.editor.setSession(this.session2);
assert.position(this.editor.getCursorPosition(), 0, 0);
var called = false;
this.session1.getSelection().moveCursorTo(0, 1);
assert.position(this.editor.getCursorPosition(), 0, 0);
assert.notOk(called);
this.session2.getSelection().moveCursorTo(1, 1);
assert.position(this.editor.getCursorPosition(), 1, 1);
assert.ok(called);
},
"test: should use selection of new document" : function() {
this.session1.getSelection().selectTo(0, 1);
this.session2.getSelection().selectTo(1, 0);
this.editor.setSession(this.session1);
assert.position(this.editor.getSelection().getSelectionLead(), 0, 1);
this.editor.setSession(this.session2);
assert.position(this.editor.getSelection().getSelectionLead(), 1, 0);
},
"test: only changing the selection of the new doc should not have an effect" : function() {
this.editor.onSelectionChange = function() {
called = true;
};
this.editor.setSession(this.session1);
this.editor.setSession(this.session2);
assert.position(this.editor.getSelection().getSelectionLead(), 0, 0);
var called = false;
this.session1.getSelection().selectTo(0, 1);
assert.position(this.editor.getSelection().getSelectionLead(), 0, 0);
assert.notOk(called);
this.session2.getSelection().selectTo(1, 1);
assert.position(this.editor.getSelection().getSelectionLead(), 1, 1);
assert.ok(called);
},
"test: should use mode of new document" : function() {
this.editor.onChangeMode = function() {
called = true;
};
this.editor.setSession(this.session1);
this.editor.setSession(this.session2);
var called = false;
this.session1.setMode(new Text());
assert.notOk(called);
this.session2.setMode(new JavaScriptMode());
assert.ok(called);
},
"test: should use stop worker of old document" : function(next) {
var self = this;
// 1. Open an editor and set the session to CssMode
self.editor.setSession(self.session1);
self.session1.setMode(new CssMode());
// 2. Add a line or two of valid CSS.
self.session1.setValue("DIV { color: red; }");
// 3. Clear the session value.
self.session1.setValue("");
// 4. Set the session to HtmlMode
self.session1.setMode(new HtmlMode());
// 5. Try to type valid HTML
self.session1.insert({row: 0, column: 0}, "<html></html>");
setTimeout(function() {
assert.equal(Object.keys(self.session1.getAnnotations()).length, 0);
next();
}, 600);
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}
@@ -0,0 +1,223 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
require("./test/mockdom");
}
define(function(require, exports, module) {
"use strict";
var EditSession = require("./edit_session").EditSession;
var Editor = require("./editor").Editor;
var MockRenderer = require("./test/mockrenderer").MockRenderer;
var assert = require("./test/assertions");
var lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " +
"Mauris at arcu mi, eu lobortis mauris. Quisque ut libero eget " +
"diam congue vehicula. Quisque ut odio ut mi aliquam tincidunt. " +
"Duis lacinia aliquam lorem eget eleifend. Morbi eget felis mi. " +
"Duis quam ligula, consequat vitae convallis volutpat, blandit " +
"nec neque. Nulla facilisi. Etiam suscipit lorem ac justo " +
"sollicitudin tristique. Phasellus ut posuere nunc. Aliquam " +
"scelerisque mollis felis non gravida. Vestibulum lacus sem, " +
"posuere non bibendum id, luctus non dolor. Aenean id metus " +
"lorem, vel dapibus est. Donec gravida feugiat augue nec " +
"accumsan.Lorem ipsum dolor sit amet, consectetur adipiscing " +
"elit. Nulla vulputate, velit vitae tincidunt congue, nunc " +
"augue accumsan velit, eu consequat turpis lectus ac orci. " +
"Pellentesque ornare dolor feugiat dui auctor eu varius nulla " +
"fermentum. Sed aliquam odio at velit lacinia vel fermentum " +
"felis sodales. In dignissim magna eget nunc lobortis non " +
"fringilla nibh ullamcorper. Donec facilisis malesuada elit " +
"at egestas. Etiam bibendum, diam vitae tempor aliquet, dui " +
"libero vehicula odio, eget bibendum mauris velit eu lorem.\n" +
"consectetur";
function callHighlighterUpdate(session, firstRow, lastRow) {
var rangeCount = 0;
var mockMarkerLayer = { drawSingleLineMarker: function() {rangeCount++;} }
session.$searchHighlight.update([], mockMarkerLayer, session, {
firstRow: firstRow,
lastRow: lastRow
});
return rangeCount;
}
module.exports = {
setUp: function(next) {
this.session = new EditSession(lipsum);
this.editor = new Editor(new MockRenderer(), this.session);
this.selection = this.session.getSelection();
this.search = this.editor.$search;
next();
},
"test: highlight selected words by default": function() {
assert.equal(this.editor.getHighlightSelectedWord(), true);
},
"test: highlight a word": function() {
this.editor.moveCursorTo(0, 9);
this.selection.selectWord();
var highlighter = this.editor.session.$searchHighlight;
assert.ok(highlighter != null);
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "ipsum");
assert.equal(highlighter.cache.length, 0);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 2);
},
"test: highlight a word and clear highlight": function() {
this.editor.moveCursorTo(0, 8);
this.selection.selectWord();
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "ipsum");
assert.equal(callHighlighterUpdate(this.session, 0, 0), 2);
this.session.highlight("");
assert.equal(this.session.$searchHighlight.cache.length, 0);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: highlight another word": function() {
this.selection.moveCursorTo(0, 14);
this.selection.selectWord();
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "dolor");
assert.equal(callHighlighterUpdate(this.session, 0, 0), 4);
},
"test: no selection, no highlight": function() {
this.selection.clearSelection();
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: select a word, no highlight": function() {
this.selection.moveCursorTo(0, 14);
this.selection.selectWord();
this.editor.setHighlightSelectedWord(false);
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "dolor");
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: select a word with no matches": function() {
this.editor.setHighlightSelectedWord(true);
var currentOptions = this.search.getOptions();
var newOptions = {
wrap: true,
wholeWord: true,
caseSensitive: true,
needle: "Mauris"
};
this.search.set(newOptions);
var match = this.search.find(this.session);
assert.notEqual(match, null, "found a match for 'Mauris'");
this.search.set(currentOptions);
this.selection.setSelectionRange(match);
assert.equal(this.session.getTextRange(match), "Mauris");
assert.equal(callHighlighterUpdate(this.session, 0, 0), 1);
},
"test: partial word selection 1": function() {
this.selection.moveCursorTo(0, 14);
this.selection.selectWord();
this.selection.selectLeft();
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "dolo");
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: partial word selection 2": function() {
this.selection.moveCursorTo(0, 13);
this.selection.selectWord();
this.selection.selectRight();
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "dolor ");
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: partial word selection 3": function() {
this.selection.moveCursorTo(0, 14);
this.selection.selectWord();
this.selection.selectLeft();
this.selection.shiftSelection(1);
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "olor");
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: select last word": function() {
this.selection.moveCursorTo(0, 1);
var currentOptions = this.search.getOptions();
var newOptions = {
wrap: true,
wholeWord: true,
caseSensitive: true,
backwards: true,
needle: "consectetur"
};
this.search.set(newOptions);
var match = this.search.find(this.session);
assert.notEqual(match, null, "found a match for 'consectetur'");
assert.position(match.start, 1, 0);
this.search.set(currentOptions);
this.selection.setSelectionRange(match);
assert.equal(this.session.getTextRange(match), "consectetur");
assert.equal(callHighlighterUpdate(this.session, 0, 1), 3);
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
}
@@ -0,0 +1,164 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
require("./test/mockdom");
}
define(function(require, exports, module) {
"use strict";
var EditSession = require("./edit_session").EditSession;
var Editor = require("./editor").Editor;
var MockRenderer = require("./test/mockrenderer").MockRenderer;
var assert = require("./test/assertions");
module.exports = {
createEditSession : function(rows, cols) {
var line = new Array(cols + 1).join("a");
var text = new Array(rows).join(line + "\n") + line;
return new EditSession(text);
},
"test: navigate to end of file should scroll the last line into view" : function() {
var doc = this.createEditSession(200, 10);
var editor = new Editor(new MockRenderer(), doc);
editor.navigateFileEnd();
var cursor = editor.getCursorPosition();
assert.ok(editor.getFirstVisibleRow() <= cursor.row);
assert.ok(editor.getLastVisibleRow() >= cursor.row);
},
"test: navigate to start of file should scroll the first row into view" : function() {
var doc = this.createEditSession(200, 10);
var editor = new Editor(new MockRenderer(), doc);
editor.moveCursorTo(editor.getLastVisibleRow() + 20);
editor.navigateFileStart();
assert.equal(editor.getFirstVisibleRow(), 0);
},
"test: goto hidden line should scroll the line into the middle of the viewport" : function() {
var editor = new Editor(new MockRenderer(), this.createEditSession(200, 5));
editor.navigateTo(0, 0);
editor.gotoLine(101);
assert.position(editor.getCursorPosition(), 100, 0);
assert.equal(editor.getFirstVisibleRow(), 89);
editor.navigateTo(100, 0);
editor.gotoLine(11);
assert.position(editor.getCursorPosition(), 10, 0);
assert.equal(editor.getFirstVisibleRow(), 0);
editor.navigateTo(100, 0);
editor.gotoLine(6);
assert.position(editor.getCursorPosition(), 5, 0);
assert.equal(0, editor.getFirstVisibleRow(), 0);
editor.navigateTo(100, 0);
editor.gotoLine(1);
assert.position(editor.getCursorPosition(), 0, 0);
assert.equal(editor.getFirstVisibleRow(), 0);
editor.navigateTo(0, 0);
editor.gotoLine(191);
assert.position(editor.getCursorPosition(), 190, 0);
assert.equal(editor.getFirstVisibleRow(), 179);
editor.navigateTo(0, 0);
editor.gotoLine(196);
assert.position(editor.getCursorPosition(), 195, 0);
assert.equal(editor.getFirstVisibleRow(), 180);
},
"test: goto visible line should only move the cursor and not scroll": function() {
var editor = new Editor(new MockRenderer(), this.createEditSession(200, 5));
editor.navigateTo(0, 0);
editor.gotoLine(12);
assert.position(editor.getCursorPosition(), 11, 0);
assert.equal(editor.getFirstVisibleRow(), 0);
editor.navigateTo(30, 0);
editor.gotoLine(33);
assert.position(editor.getCursorPosition(), 32, 0);
assert.equal(editor.getFirstVisibleRow(), 30);
},
"test: navigate from the end of a long line down to a short line and back should maintain the curser column": function() {
var editor = new Editor(new MockRenderer(), new EditSession(["123456", "1"]));
editor.navigateTo(0, 6);
assert.position(editor.getCursorPosition(), 0, 6);
editor.navigateDown();
assert.position(editor.getCursorPosition(), 1, 1);
editor.navigateUp();
assert.position(editor.getCursorPosition(), 0, 6);
},
"test: reset desired column on navigate left or right": function() {
var editor = new Editor(new MockRenderer(), new EditSession(["123456", "12"]));
editor.navigateTo(0, 6);
assert.position(editor.getCursorPosition(), 0, 6);
editor.navigateDown();
assert.position(editor.getCursorPosition(), 1, 2);
editor.navigateLeft();
assert.position(editor.getCursorPosition(), 1, 1);
editor.navigateUp();
assert.position(editor.getCursorPosition(), 0, 1);
},
"test: typing text should update the desired column": function() {
var editor = new Editor(new MockRenderer(), new EditSession(["1234", "1234567890"]));
editor.navigateTo(0, 3);
editor.insert("juhu");
editor.navigateDown();
assert.position(editor.getCursorPosition(), 1, 7);
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}
@@ -0,0 +1,555 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
require("./test/mockdom");
}
define(function(require, exports, module) {
"use strict";
var EditSession = require("./edit_session").EditSession;
var Editor = require("./editor").Editor;
var JavaScriptMode = require("./mode/javascript").Mode;
var UndoManager = require("./undomanager").UndoManager;
var MockRenderer = require("./test/mockrenderer").MockRenderer;
var assert = require("./test/assertions");
module.exports = {
"test: delete line from the middle" : function() {
var session = new EditSession(["a", "b", "c", "d"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 1);
editor.removeLines();
assert.equal(session.toString(), "a\nc\nd");
assert.position(editor.getCursorPosition(), 1, 0);
editor.removeLines();
assert.equal(session.toString(), "a\nd");
assert.position(editor.getCursorPosition(), 1, 0);
editor.removeLines();
assert.equal(session.toString(), "a");
assert.position(editor.getCursorPosition(), 0, 1);
editor.removeLines();
assert.equal(session.toString(), "");
assert.position(editor.getCursorPosition(), 0, 0);
},
"test: delete multiple selected lines" : function() {
var session = new EditSession(["a", "b", "c", "d"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 1);
editor.getSelection().selectDown();
editor.removeLines();
assert.equal(session.toString(), "a\nd");
assert.position(editor.getCursorPosition(), 1, 0);
},
"test: delete first line" : function() {
var session = new EditSession(["a", "b", "c"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.removeLines();
assert.equal(session.toString(), "b\nc");
assert.position(editor.getCursorPosition(), 0, 0);
},
"test: delete last should also delete the new line of the previous line" : function() {
var session = new EditSession(["a", "b", "c", ""].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(3, 0);
editor.removeLines();
assert.equal(session.toString(), "a\nb\nc");
assert.position(editor.getCursorPosition(), 2, 1);
editor.removeLines();
assert.equal(session.toString(), "a\nb");
assert.position(editor.getCursorPosition(), 1, 1);
},
"test: indent block" : function() {
var session = new EditSession(["a12345", "b12345", "c12345"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 3);
editor.getSelection().selectDown();
editor.indent();
assert.equal(["a12345", " b12345", " c12345"].join("\n"), session.toString());
assert.position(editor.getCursorPosition(), 2, 7);
var range = editor.getSelectionRange();
assert.position(range.start, 1, 7);
assert.position(range.end, 2, 7);
},
"test: indent selected lines" : function() {
var session = new EditSession(["a12345", "b12345", "c12345"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 0);
editor.getSelection().selectDown();
editor.indent();
assert.equal(["a12345", " b12345", "c12345"].join("\n"), session.toString());
},
"test: no auto indent if cursor is before the {" : function() {
var session = new EditSession("{", new JavaScriptMode());
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(0, 0);
editor.onTextInput("\n");
assert.equal(["", "{"].join("\n"), session.toString());
},
"test: outdent block" : function() {
var session = new EditSession([" a12345", " b12345", " c12345"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(0, 5);
editor.getSelection().selectDown();
editor.getSelection().selectDown();
editor.blockOutdent();
assert.equal(session.toString(), [" a12345", "b12345", " c12345"].join("\n"));
assert.position(editor.getCursorPosition(), 2, 1);
var range = editor.getSelectionRange();
assert.position(range.start, 0, 1);
assert.position(range.end, 2, 1);
editor.blockOutdent();
assert.equal(session.toString(), ["a12345", "b12345", "c12345"].join("\n"));
var range = editor.getSelectionRange();
assert.position(range.start, 0, 0);
assert.position(range.end, 2, 0);
},
"test: outent without a selection should update cursor" : function() {
var session = new EditSession(" 12");
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(0, 3);
editor.blockOutdent(" ");
assert.equal(session.toString(), " 12");
assert.position(editor.getCursorPosition(), 0, 0);
},
"test: comment lines should perserve selection" : function() {
var session = new EditSession([" abc", "cde"].join("\n"), new JavaScriptMode());
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(0, 2);
editor.getSelection().selectDown();
editor.toggleCommentLines();
assert.equal(["// abc", "//cde"].join("\n"), session.toString());
var selection = editor.getSelectionRange();
assert.position(selection.start, 0, 4);
assert.position(selection.end, 1, 4);
},
"test: uncomment lines should perserve selection" : function() {
var session = new EditSession(["// abc", "//cde"].join("\n"), new JavaScriptMode());
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(0, 1);
editor.getSelection().selectDown();
editor.getSelection().selectRight();
editor.getSelection().selectRight();
editor.toggleCommentLines();
assert.equal([" abc", "cde"].join("\n"), session.toString());
assert.range(editor.getSelectionRange(), 0, 0, 1, 1);
},
"test: toggle comment lines twice should return the original text" : function() {
var session = new EditSession([" abc", "cde", "fg"], new JavaScriptMode());
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(0, 0);
editor.getSelection().selectDown();
editor.getSelection().selectDown();
editor.toggleCommentLines();
editor.toggleCommentLines();
assert.equal([" abc", "cde", "fg"].join("\n"), session.toString());
},
"test: comment lines - if the selection end is at the line start it should stay there": function() {
//select down
var session = new EditSession(["abc", "cde"].join("\n"), new JavaScriptMode());
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(0, 0);
editor.getSelection().selectDown();
editor.toggleCommentLines();
assert.range(editor.getSelectionRange(), 0, 2, 1, 0);
// select up
var session = new EditSession(["abc", "cde"].join("\n"), new JavaScriptMode());
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 0);
editor.getSelection().selectUp();
editor.toggleCommentLines();
assert.range(editor.getSelectionRange(), 0, 2, 1, 0);
},
"test: move lines down should select moved lines" : function() {
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(0, 1);
editor.getSelection().selectDown();
editor.moveLinesDown();
assert.equal(["33", "11", "22", "44"].join("\n"), session.toString());
assert.position(editor.getCursorPosition(), 1, 0);
assert.position(editor.getSelection().getSelectionAnchor(), 3, 0);
assert.position(editor.getSelection().getSelectionLead(), 1, 0);
editor.moveLinesDown();
assert.equal(["33", "44", "11", "22"].join("\n"), session.toString());
assert.position(editor.getCursorPosition(), 2, 0);
assert.position(editor.getSelection().getSelectionAnchor(), 3, 2);
assert.position(editor.getSelection().getSelectionLead(), 2, 0);
// moving again should have no effect
editor.moveLinesDown();
assert.equal(["33", "44", "11", "22"].join("\n"), session.toString());
assert.position(editor.getCursorPosition(), 2, 0);
assert.position(editor.getSelection().getSelectionAnchor(), 3, 2);
assert.position(editor.getSelection().getSelectionLead(), 2, 0);
},
"test: move lines up should select moved lines" : function() {
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(2, 1);
editor.getSelection().selectDown();
editor.moveLinesUp();
assert.equal(session.toString(), ["11", "33", "44", "22"].join("\n"));
assert.position(editor.getCursorPosition(), 1, 0);
assert.position(editor.getSelection().getSelectionAnchor(), 3, 0);
assert.position(editor.getSelection().getSelectionLead(), 1, 0);
editor.moveLinesUp();
assert.equal(session.toString(), ["33", "44", "11", "22"].join("\n"));
assert.position(editor.getCursorPosition(), 0, 0);
assert.position(editor.getSelection().getSelectionAnchor(), 2, 0);
assert.position(editor.getSelection().getSelectionLead(), 0, 0);
},
"test: move line without active selection should not move cursor relative to the moved line" : function()
{
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 1);
editor.clearSelection();
editor.moveLinesDown();
assert.equal(["11", "33", "22", "44"].join("\n"), session.toString());
assert.position(editor.getCursorPosition(), 2, 1);
editor.clearSelection();
editor.moveLinesUp();
assert.equal(["11", "22", "33", "44"].join("\n"), session.toString());
assert.position(editor.getCursorPosition(), 1, 1);
},
"test: copy lines down should select lines and place cursor at the selection start" : function() {
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 1);
editor.getSelection().selectDown();
editor.copyLinesDown();
assert.equal(["11", "22", "33", "22", "33", "44"].join("\n"), session.toString());
assert.position(editor.getCursorPosition(), 3, 0);
assert.position(editor.getSelection().getSelectionAnchor(), 5, 0);
assert.position(editor.getSelection().getSelectionLead(), 3, 0);
},
"test: copy lines up should select lines and place cursor at the selection start" : function() {
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 1);
editor.getSelection().selectDown();
editor.copyLinesUp();
assert.equal(["11", "22", "33", "22", "33", "44"].join("\n"), session.toString());
assert.position(editor.getCursorPosition(), 1, 0);
assert.position(editor.getSelection().getSelectionAnchor(), 3, 0);
assert.position(editor.getSelection().getSelectionLead(), 1, 0);
},
"test: input a tab with soft tab should convert it to spaces" : function() {
var session = new EditSession("");
var editor = new Editor(new MockRenderer(), session);
session.setTabSize(2);
session.setUseSoftTabs(true);
editor.onTextInput("\t");
assert.equal(session.toString(), " ");
session.setTabSize(5);
editor.onTextInput("\t");
assert.equal(session.toString(), " ");
},
"test: input tab without soft tabs should keep the tab character" : function() {
var session = new EditSession("");
var editor = new Editor(new MockRenderer(), session);
session.setUseSoftTabs(false);
editor.onTextInput("\t");
assert.equal(session.toString(), "\t");
},
"test: undo/redo for delete line" : function() {
var session = new EditSession(["111", "222", "333"]);
var undoManager = new UndoManager();
session.setUndoManager(undoManager);
var initialText = session.toString();
var editor = new Editor(new MockRenderer(), session);
editor.removeLines();
var step1 = session.toString();
assert.equal(step1, "222\n333");
session.$syncInformUndoManager();
editor.removeLines();
var step2 = session.toString();
assert.equal(step2, "333");
session.$syncInformUndoManager();
editor.removeLines();
var step3 = session.toString();
assert.equal(step3, "");
session.$syncInformUndoManager();
undoManager.undo();
session.$syncInformUndoManager();
assert.equal(session.toString(), step2);
undoManager.undo();
session.$syncInformUndoManager();
assert.equal(session.toString(), step1);
undoManager.undo();
session.$syncInformUndoManager();
assert.equal(session.toString(), initialText);
undoManager.undo();
session.$syncInformUndoManager();
assert.equal(session.toString(), initialText);
},
"test: remove left should remove character left of the cursor" : function() {
var session = new EditSession(["123", "456"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 1);
editor.remove("left");
assert.equal(session.toString(), "123\n56");
},
"test: remove left should remove line break if cursor is at line start" : function() {
var session = new EditSession(["123", "456"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 0);
editor.remove("left");
assert.equal(session.toString(), "123456");
},
"test: remove left should remove tabsize spaces if cursor is on a tab stop and preceeded by spaces" : function() {
var session = new EditSession(["123", " 456"]);
session.setUseSoftTabs(true);
session.setTabSize(4);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 8);
editor.remove("left");
assert.equal(session.toString(), "123\n 456");
},
"test: transpose at line start should be a noop": function() {
var session = new EditSession(["123", "4567", "89"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 0);
editor.transposeLetters();
assert.equal(session.getValue(), ["123", "4567", "89"].join("\n"));
},
"test: transpose in line should swap the charaters before and after the cursor": function() {
var session = new EditSession(["123", "4567", "89"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 2);
editor.transposeLetters();
assert.equal(session.getValue(), ["123", "4657", "89"].join("\n"));
},
"test: transpose at line end should swap the last two characters": function() {
var session = new EditSession(["123", "4567", "89"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 4);
editor.transposeLetters();
assert.equal(session.getValue(), ["123", "4576", "89"].join("\n"));
},
"test: transpose with non empty selection should be a noop": function() {
var session = new EditSession(["123", "4567", "89"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 1);
editor.getSelection().selectRight();
editor.transposeLetters();
assert.equal(session.getValue(), ["123", "4567", "89"].join("\n"));
},
"test: transpose should move the cursor behind the last swapped character": function() {
var session = new EditSession(["123", "4567", "89"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 2);
editor.transposeLetters();
assert.position(editor.getCursorPosition(), 1, 3);
},
"test: remove to line end": function() {
var session = new EditSession(["123", "4567", "89"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 2);
editor.removeToLineEnd();
assert.equal(session.getValue(), ["123", "45", "89"].join("\n"));
},
"test: remove to line end at line end should remove the new line": function() {
var session = new EditSession(["123", "4567", "89"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 4);
editor.removeToLineEnd();
assert.position(editor.getCursorPosition(), 1, 4);
assert.equal(session.getValue(), ["123", "456789"].join("\n"));
},
"test: transform selection to uppercase": function() {
var session = new EditSession(["ajax", "dot", "org"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 0);
editor.getSelection().selectLineEnd();
editor.toUpperCase()
assert.equal(session.getValue(), ["ajax", "DOT", "org"].join("\n"));
},
"test: transform word to uppercase": function() {
var session = new EditSession(["ajax", "dot", "org"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 0);
editor.toUpperCase()
assert.equal(session.getValue(), ["ajax", "DOT", "org"].join("\n"));
assert.position(editor.getCursorPosition(), 1, 0);
},
"test: transform selection to lowercase": function() {
var session = new EditSession(["AJAX", "DOT", "ORG"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 0);
editor.getSelection().selectLineEnd();
editor.toLowerCase()
assert.equal(session.getValue(), ["AJAX", "dot", "ORG"].join("\n"));
},
"test: transform word to lowercase": function() {
var session = new EditSession(["AJAX", "DOT", "ORG"]);
var editor = new Editor(new MockRenderer(), session);
editor.moveCursorTo(1, 0);
editor.toLowerCase()
assert.equal(session.getValue(), ["AJAX", "dot", "ORG"].join("\n"));
assert.position(editor.getCursorPosition(), 1, 0);
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}
@@ -0,0 +1,22 @@
.ace_editor {
font-family: 'Monaco', 'Menlo', 'Droid Sans Mono', 'Courier New', monospace;
font-size: 12px;
}
.ace_editor .ace_gutter {
width: 25px !important;
display: block;
float: left;
text-align: right;
padding: 0 3px 0 0;
margin-right: 3px;
}
.ace_line { clear: both; }
*.ace_gutter-cell {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
user-select: none;
}
@@ -0,0 +1,88 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var EditSession = require("../edit_session").EditSession;
var TextLayer = require("../layer/text").Text;
var baseStyles = require("../requirejs/text!./static.css");
/* Transforms a given input code snippet into HTML using the given mode
*
* @param {string} input Code snippet
* @param {mode} mode Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode')
* @param {string} r Code snippet
* @returns {object} An object containing: html, css
*/
exports.render = function(input, mode, theme, lineStart, disableGutter) {
lineStart = parseInt(lineStart || 1, 10);
var session = new EditSession("");
session.setMode(mode);
session.setUseWorker(false);
var textLayer = new TextLayer(document.createElement("div"));
textLayer.setSession(session);
textLayer.config = {
characterWidth: 10,
lineHeight: 20
};
session.setValue(input);
var stringBuilder = [];
var length = session.getLength();
for(var ix = 0; ix < length; ix++) {
stringBuilder.push("<div class='ace_line'>");
if (!disableGutter)
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
textLayer.$renderLine(stringBuilder, ix, true, false);
stringBuilder.push("</div>");
}
// let's prepare the whole html
var html = "<div class=':cssClass'>\
<div class='ace_editor ace_scroller ace_text-layer'>\
:code\
</div>\
</div>".replace(/:cssClass/, theme.cssClass).replace(/:code/, stringBuilder.join(""));
textLayer.destroy();
return {
css: baseStyles + theme.cssText,
html: html
};
};
});

Some files were not shown because too many files have changed in this diff Show More