Compare commits

...

1151 Commits

Author SHA1 Message Date
restitux a5e19e3841 Change path lookup to support abrev paths 2023-01-17 20:34:51 -07:00
restitux fdfcbb30e0 Omniauth / omnigollum integration
Based on: https://github.com/remyd1/gollum/commit/925ebcfe04f294c979b9e088dc0955ca1dfa8c44
2023-01-17 02:20:26 -07:00
Dawa Ometto 9c2f8dfeba Release 5.3.0 2022-05-25 11:24:19 +02:00
Dawa Ometto 8e35688b17 Release preparation: update readme, rakefile and changelog (#1788)
* Update README.md
* Add LATEST_CHANGES.md and release helpers
2022-05-24 16:27:39 +02:00
Paul Westcott 860e8b2ebd Restore the normalize check that appears to be inadvertantly removed (#1802)
* Add test for normalize on upload

Co-authored-by: Dawa Ometto <d.ometto@gmail.com>
2022-05-24 16:13:35 +02:00
benjamin wil 0d2ab11604 Include rdoc as a dependency (#1823)
We've had some reports (#1342, #1809) of `rdoc` not being installed
in some environments, causing Gollum to error in unpleasant ways.

This isn't an issue that's unique to Gollum, and I don't think `rdoc`
should actually be a hard dependency of this project.  But since we can
side-step the issue by requiring `rdoc`, something that most users who
install Gollum via RubyGems would already have installed, I don't think
this is a horrible solution.
2022-05-04 18:25:48 -07:00
Andreas Wachter ddc7dba0a2 Remove arm/v6 and v7 from the Docker builds (#1822)
* added platforms to actions, install libc6-compat for pi

* fix build problem for now. https://github.com/gollum/gollum/runs/6248371141
2022-05-03 08:15:09 -07:00
Andreas Wachter bc3503f374 added platforms to actions, install libc6-compat for pi (#1806) 2022-04-30 23:04:45 -07:00
benjamin wil 2dfe103687 Ensure example git repos are valid (#1821)
* Ensure example git repos are valid

It was reported in #1817 that the `lotr_migration.git` repository we use
in `test/test_migrate.rb` is not a valid git repository on when clone,
causing the test suite to fail when run locally.

The reason is because there is no `.git/refs` directory, meaning it's
not really a valid git repository at all. I noticed that the `empty.git`
example repository has the same problem.

This commit simply ensures that the directory structure of these example
repositories are persisted in git.

* Run `test_migrate` tests on CI

Now that we've resolved the issue with the invalid git repository in the
parent commit, we can run all of the tests in our CI environment.
2022-04-30 23:03:56 -07:00
benjamin wil 95d35d38da Switch from TestUnit to Minitest (#1805)
* Use `Minitest::Test`

`Test::Unit` is deprecated, and we can switch to `Minitest::Test` with
almost no side effects.

This commit does all of the work required to make Minitest tests run
with Gollum's existing test helpers.

* Change Minitest output format

- The `DefaultReporter` seems to have cleaner output than what we had
  before.
- `color: true` ensures things are colorized. It's pretty nice.

* Tweak test formatting; fix order-dependent failure

The order-dependent failure has been been commented in code.

After manually bisecting the test suite, I was able to determine that
the template cascade tests were leaving the `@@template_priority_path`
set to an overridden value in tests run afterward.

* Tweak setting initialization

I could not see a meaningful reason behind calling `forbid` so early in
the settings initialization block. But moving the `forbid` call until
later resolved this issue.

In the real world, I don't see how this would cause issues. But I found
that calling `forbid` when `wiki_options[:allow_editing]` was set to
false caused order-dependent test errors where Sprockets would end up
being badly configured and left without an initialized
`Sprockets::Environment` object, which is required by the
`sprockets-helpers` gem to resolve asset paths.

The test that would cause errors is also in this commit diff. I've
updated it to be a bit more readable.

I also took this opportunity to review and clean up the `@allow_editing`
assignment, which seemed a bit obfuscated.

* Update migration script to test run warnings

When running the entire test suite, many warnings would be output:

/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: already initialized constant HYPHENATE
/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: previous definition of HYPHENATE was here
/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: already initialized constant PAGE_FILE_DIR
/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: previous definition of PAGE_FILE_DIR was here
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:91: warning: already initialized constant REPO
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:91: warning: previous definition of REPO was here
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:236: warning: already initialized constant TREE
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:236: warning: previous definition of TREE was here
/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: already initialized constant PAGE_FILE_DIR
/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: previous definition of PAGE_FILE_DIR was here
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:91: warning: already initialized constant REPO
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:91: warning: previous definition of REPO was here
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:236: warning: already initialized constant TREE
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:236: warning: previous definition of TREE was here

While it's unlikely that end users would ever see these warnings, as
they'd only be running the migration script once, they will always be
shown in our local test runs and CI run output.

So instead of using constants in our migration script, I change the
script to use class variables instead. This should not effect the
functionality of the migration script whatsoever.

* Use `File.exist?` instead of `File.exists?`

In Ruby 3.x, `File.exists?` is deprecated and outputs a warning.

* Improve "allow editing" tests

While making changes to the test suite, I ran into some issues with
these tests failing on occasion.

I added some setup and teardown to help with this.

But one thing I did notice is that the word "Upload" appears in the
response body whether uploading is enabled or not, so I made these
assertions more specific to the HTML rather than other places the word
"Upload" might appear (which is related to Critic Markup).

* Do not attempt to modify frozen strings

Using `#gsub!` here now results in an error. I am not entirely sure why
this hasn't happened before, but the error is straightforward:

     FrozenError: can't modify frozen String: "Author %{author} is from %{location}"
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:45:in `gsub!'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:45:in `fill_argument_content'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:37:in `block in autofill'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `each'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `map'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `autofill'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:35:in `block in autofill'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `each'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `map'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `autofill'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:21:in `t'
        /home/runner/work/gollum/gollum/test/gollum/views/test_locale_helper.rb:95:in `block (4 levels) in <top (required)>'

`#gsub!` attempts to modify a string in-place, which does not work when
a string is frozen. It seems that in some Ruby environments, strings
from YAML files are frozen.

* Fix another order-dependent test failure

Very occasionally, this test fails due to `Precious::App` settings set
in previous tests. You can reproduce this failure using this seed:

    bundle exec rake TESTOPTS="--seed=42898"
2022-04-27 08:25:54 -07:00
Tevin 81c90e55a7 Add page context to template filter, resolves #1603 (#1818)
* Add a test for template filter
* Add a test for template filter with page parameter
* Passing page as a parameter to template filter
2022-04-25 09:44:19 +02:00
mishina 3f0b61081b Add Ruby 3.1 to the CI matrix (#1812)
* Enclose all the version numbers in quotes
2022-03-23 15:30:49 +01:00
mishina ecc317886a Remove fields from gemspec that should not be set (#1811) 2022-03-23 13:27:54 +01:00
Dawa Ometto 4b2dc8e5c0 Set encoding explicitly in bin/gollum (#1801)
Resolves #1699
2022-01-13 21:45:49 +01:00
Nikita Ivanov 6f870501a0 Add option to show browser's local time (#1653)
* Add tests for --local-time option
* Update Readme
2022-01-13 18:19:22 +01:00
Nikita Ivanov f30058f4ee Fix broken History button when viewing historical deleted file (#1759)
* Fix broken History button when viewing historical deleted file
* Add tests
2022-01-13 18:06:13 +01:00
Dawa Ometto 82ce013cab Fix Docker Deploy workflow (#1800) 2022-01-12 11:34:42 +01:00
Dawa Ometto 0c36cdf5ba Support versioned Docker builds (#1799) 2022-01-12 11:04:12 +01:00
Dawa Ometto 6159fcd4a2 Remove explicit nokogori version requirement. Resolves #1779 (#1798)
* Remove explicit nokogori version requirement
* Require ruby >= 2.6, use latest JRuby

No longer needed after nokogiri's recent release, see https://github.com/gollum/gollum/issues/1779
2022-01-11 17:51:14 +01:00
benjamin wil 8f7793f461 Improve presentation of page navigation and #head area on mobile devices (#1742)
* Add `.header-title` style

This style shows smaller text on mobile devices. It reverts back to the
`2em` size used in Primer for H1 tags.

* Use `.header-title` for all `#head` headings

This commit:

  1. Updates all main templates to use the new `.header-title` class,
     making these titles less disruptively large on mobile devices.
  2. Centers these titles for mobile breakpoints only, re-setting them
     back to left-aligned text for `md-` breakpoints and up.

Note that in `lib/gollum/templates/wiki_contentf.mustache`, the
`.header-title` is not a `#head .header-title`, so it doesn't inherit
all of the new styles added in this commit.

* Adjust padding and presentation of mobile menu

To give mobile page headers more structure, this commit adjusts the
padding to be more symmetrical. It also adds a `border-bottom` on mobile
only. In my opinion this improves readability by telling the reader,
"This is where the navigation menu ends and the page content begins."

* Recompile assets

* Fix failing spec

My changes to the header layout seem to changed where the spaces in
`last_response.body` are placed. So let's assert only that the content
is present, since that's all this test should actually care about.
2021-12-30 14:36:51 -08:00
James Reynolds 589b4bce39 Added docker environment variables for author and email (#1789)
Sets git user.name and user.email if env var is set
2021-12-30 14:27:20 -08:00
benjamin wil 9c574fd760 Improve test suite and CI run performance (#1796)
* Simplify test

I came across this test because it was failing JRuby CI runs. I should
emphasize, though, that this test was only failing due do an upstream
bug in Nokogiri v1.12.5.

When I was reviewing the test, to understand why it was failing at all,
I noticed that the assertion was rather obfuscated.  Specifically, we
were post-processing the entire `response.body` and using that as an
expectation.

* Use an older version of Nokogiri in our test env

This is a temporary fix. See the commit diff for more information.

* Split JRuby CI runs from MRI CI runs

We can improve the performance of our MRI test runs by not installing
Java as part of their run. (Java is only required for JRuby.)

* Use latest Ruby patch versions during CI runs

* Simplify GitHub Action workflow steps

Judging by the output in the GitHub Actions workflow UI, the `echo`
steps were not providing much value to us.

We can get rid of them to slightly increase run performance.

I've also named the other steps to make it easier to skim the Actions
workflow output.

* Remove `twitter_cldr` development dependency

This is no longer being used.

* Change GitHub Actions workflow Ruby matrix

We can drop Ruby 2.4 from our test run matrix. It is beyond EOL.
Let's add 2.7 instead.
2021-12-30 14:21:23 -08:00
Dawa Ometto 46c22a8b87 Take account of possible https referer in upload route (#1787) 2021-12-23 12:18:30 +01:00
Ryan Govostes 7e379cfab1 Reduce size of container image (#1777)
* Reduce size of container image
* Add deprecation message for automatic --mathjax
2021-12-22 20:54:29 +01:00
Dawa Ometto 93d3d10453 Update gollum (#1786)
Exit with code 1 (error) when invalid option is given
2021-12-22 18:08:20 +01:00
fhchl 98a0006c86 Fix mathjax on edit and create pages (#1773)
* Fix mathjax on edit and create pages
2021-12-22 17:00:31 +01:00
Dawa Ometto d97721f38b Update test.yaml
Update JDK
2021-11-06 13:32:13 +01:00
Aaron Wallentine 8d3ec8605e Small grammar fix in README.md (#1776) 2021-10-28 13:55:32 +02:00
Brian Porter 7517389072 Allow for overriding only specific Mustache templates/partials. (#1719)
* Allow for overriding only specific templates/partials. Resolves  #1450.
2021-09-07 17:32:46 +02:00
Dawa Ometto b7011139cf Create release.yml (#1760) 2021-09-06 11:30:56 +02:00
Dawa Ometto 6e8a68dd0d Delete .travis.yml 2021-09-02 21:04:30 +02:00
Dawa Ometto 4e8309d3e4 Load template page as utf-8 (#1758) 2021-08-30 11:09:29 +02:00
Dawa Ometto 371ab21d16 Add SauceLab attribution 2021-08-28 17:36:06 +02:00
yy0931 cbcbc4bc3f unescape page names in the preview tab (#1739)
* Unescape page names in the preview tab

* Execute rake precompile
2021-08-28 17:24:00 +02:00
Dawa Ometto dc9b2e1766 Update gollum.gemspec (#1749) 2021-08-28 17:21:44 +02:00
Darless 334df62651 Docker support within the repository (#1732)
- Adds a Dockerfile within this repository
- GitHub actions to build and test the image
2021-08-03 12:52:47 +02:00
yy0931 046353cf7e Fix an IME rendering issue (#1735)
* Fix an IME rendering issue

* Execute rake precompile
2021-07-09 07:52:38 -07:00
benjamin wil 51f2f032d7 Add I18n interface for use in Mustache templates (#1679)
* Add `i18n` dependency

We will use `i18n` to provide localization for Gollum's frontend. I
chose this because it's a well-supported, pretty normal Ruby library.

* Configure I18n

- Locale files will be kept in `lib/gollum/locales/[lang].yml`
- The available locales, to start, will be English (`en`).

* Add I18n interface for mustache templates

This commit adds an interface that allows mustache templates to get I18n
translation strings, transform any arguments that may be present in
them, and then render them on the frontend.

This is our first real step to getting internationalizing the Gollum
frontend.
2021-06-27 09:26:45 -07:00
Dawa Ometto 70360edb96 Update test.yaml (#1734) 2021-06-26 22:06:34 +02:00
benjamin wil 2b12ab9206 Explicitly set encoding for Precious::App (#1731)
An issue was reported (see #1721) where, in docker containers where the
`LANG` was not being set, `Precious::App` would serve Mustache templates
in an ASCII encoding. This caused templates to error out.

In the past, this would have happened in environments where `LANG` was
not set and the Gollum applciation configuration had enabled MathJax.
Now, it happens even if MathJax is disabled because of a UTF-8 character
I added to the mobile navigation menu.

Basically, we should enforce a UTF-8 encoding from now on to avoid
runtime errors related to ASCII encoding.
2021-06-14 21:28:12 +02:00
Darless 87a01e04ce fixes #1723: Github Actions Supported (#1729)
* fixes #1723: Github Actions Supported

- This is to switch from Travis CI which is shutting down the org version,
  and the .com version, a free account is limited.
- Switch test environment variable from TRAVIS to CI to be more generic.

* Adding jruby-9.2.18.0 to matrix for github actions
2021-06-14 21:21:40 +02:00
Sam 5f04200bd0 README.md: Clarify that Gollum should run against an already-initialized Git repository. (#1722) 2021-06-13 14:34:28 -07:00
benjamin wil aa823b5a2d Use recent JRuby release for Travis CI (#1730)
Our JRuby CI runs have been errorring due to what I think is an issue
with an older `jruby-openssl` version.
2021-06-13 14:17:18 -07:00
Dawa Ometto 9012dee888 Release 5.2.3 2021-04-18 13:43:00 +02:00
benjamin wil 81d5f1a8bb Ensure <title> is rendered for pages (#1710)
I made a mistake when I made `#title` a private method. I did not see
that it was being called from `layout.mustache` to generate the
`<title></title>` tag in the `<head></head>` of each page.

This fixes my error, and adds tests so the behaviour is more explicit.
2021-04-05 09:26:50 -07:00
Dawa Ometto d2b0a22a8f Release 5.2.2 2021-03-27 19:43:38 +01:00
Dawa Ometto 355e6b1f18 Fix query ? in mathjax script path (#1706) 2021-03-27 19:40:35 +01:00
Nikita Ivanov 7a2c9107c3 Delete dublicate error (#1700) 2021-03-27 14:05:03 +01:00
benjamin wil 127473fff8 Fix tab navigation styles (#1696)
* Fix tabnav styles on #create and #edit views

The Primer CSS-provided `tabnav` styles were not being used on the Edit
and Preview tabs on the create and edit pages.

After following Primer's documentation [1], it looks like we were using
the `aria-current` attribute incorrectly. Dynamically adding/removing
this attribute on the selected tab fixes the issue.

[1]: https://primer-css-git-next-inputs.primer.now.sh/css/components/navigation#tabnav

* Recompile static assets
2021-03-23 09:13:23 -07:00
benjamin wil 9a79b0a800 Merge pull request #1701 from ViChyavIn/fix-focused-button
Fix focused button border shown wrong in dialogs
2021-03-23 07:49:52 -07:00
ViChyavIn ca13298d00 Update static assets 2021-03-23 13:43:26 +05:00
ViChyavIn eaf82e6367 Overflow is set to visible by default so declaration is removed 2021-03-23 13:39:44 +05:00
benjamin wil cae290ded7 Merge pull request #1697 from gollum/benjaminwil/fix-nav-outline
Fix nav outline styles
2021-03-22 10:21:29 -07:00
Benjamin Willems a22208a0be Use <button> instead of <a> without href
It is more semantic to use a `<button>` tag in the place of an `<a>`
when there is no other page being linked to. In this circumstance, we're
using JavaScript to present a modal to the user on click.

This change makes the "Upload" and "Rename" buttons appear in the
browser's tab index.
2021-03-21 14:21:07 -07:00
Benjamin Willems bc877dc9dc Fix indentation due to DOM simplification
We removed one of the parent elements of the `<nav>`, so we must
re-indent the entire file.
2021-03-21 14:19:32 -07:00
Benjamin Willems 40b1775d42 Make the main <nav> element a TableObject
There was a display issue, where navbar items's outline styles were
being cut off due to the parent `<nav>` element's margin and padding.

Fortunately, we can do away with the navbar wrapper div entirely. It was
not doing anything important except defining its children as
`TableObject` items. But we can just do this on the `<nav>` itself.
2021-03-21 14:18:45 -07:00
ViChyavIn c2dc605adb Fix focused button border shown wrong 2021-03-20 21:43:53 +05:00
benjamin wil a1e1af07a4 Merge pull request #1676 from gollum/benjaminwil/button-labels
Move "Page History" into button group
2021-03-15 08:24:04 -07:00
benjamin wil 76948130f6 Display button groups using Primer flex utilities
This small improvement just uses Primer `d-flex` utilities to `display:
flex;` instead of using style tags. It's preferable.
2021-03-06 16:19:01 -08:00
Benjamin Willems f71ba31bfe Move "Page History" into button group
If the user has edit permissions, the "History" button is shown in a
button group with "Edit" and "Rename". If the user does not have edit
permissions, it's shown by itself.

This commit also renames the label from "Page History" to "History".
2021-03-06 16:19:01 -08:00
Dawa Ometto b7caa228e6 Add webrick dependency (#1695)
* Remove webrick as dev dependency
2021-03-06 15:39:21 +01:00
Dawa Ometto 0101dd2f65 Update .travis.yml (#1690) 2021-03-06 10:06:11 +01:00
Dawa Ometto c8baa61fe3 Update image icon in editor (#1687) 2021-02-26 15:30:02 +01:00
Dawa Ometto 104335706a Faster tests (#1686) 2021-02-26 11:34:41 +01:00
Dawa Ometto 7c60841bad Release 5.2.1 2021-02-25 13:35:02 +01:00
benjamin wil f6a7c57175 Don't include primer.css separate from app.css (#1685)
* Recompile static assets
2021-02-25 09:39:41 +01:00
Dawa Ometto 730acee609 Release 5.2 2021-02-24 12:06:54 +01:00
Dawa Ometto b7295df662 Fix Compare view for renames on JRuby (#1682) 2021-02-24 11:53:48 +01:00
Dawa Ometto aba3ec37d9 Fix styling for Latest Changes flexbox (#1683) 2021-02-24 09:28:34 +01:00
Dawa Ometto 020c98bfad Update README.md (#1670) 2021-02-23 12:47:30 +01:00
Dawa Ometto d33d11e086 Make Keybinding and Markup selects smaller (#1681) 2021-02-23 12:47:03 +01:00
benjamin wil 2e41751cf6 Fix sidebar and footer padding (#1677)
* Change footer and footer container spacing

This commit:

  1. Removes the Primer `my-md-0` spacing from the `#wiki-footer`
     container.

     This gives it margins along the Y axis, spacing it out from
     the sidebar and main wiki content containers on `md` and larger
     screens.

  2. Adds `px-4` padding to the `#footer-content`. which makes the

     This makes the footer content inset the same way that sidebar
     content is. This makes the content look more uniform on mobile
     devices, when the sidebar and footer are presented one before
     the other.

* Change spacing behaviour of `#wiki-sidebar`

To make `#wiki-sidebar` and `#wiki-footer` more similar, we can make
sure `px-4` padding is applied to the `-content` container, rather than
the outer container.
2021-02-22 09:32:02 +01:00
benjamin wil f493150825 Fix heading counters and anchor icon presentation. Resolves #1642 (#1673)
* Reset h2 counters
* Reformat .header-enum scoped SCSS
* Show overflow .wiki-body content
* Re-scope and re-style heading `.anchor` elements
* Remove unused SCSS
* Recompile static assets

Co-authored-by: Dawa Ometto <dawa.ometto@uni-leipzig.de>
2021-02-20 11:10:52 +01:00
benjamin wil 68d0dd0cd5 Add mobile navigation menu (#1671)
* If navbar is too wide, use overflow-x: scroll
* Add initial mobile nav menu
* Use CSS classes instead of IDs for jQuery events
* Change content x-axis padding for mobile devices
* Recompile assets for mobile menu feature
2021-02-18 09:33:33 +01:00
benjamin wil 38fc7e69c1 Update Primer CSS to v15.2.0 (#1659) 2021-02-14 01:05:10 +01:00
benjamin wil 5b7b9f40ae Only escape HTML from breadcrumbs. Resolves #1658 (#1663) 2021-02-14 01:04:42 +01:00
benjamin wil 17162aa091 Make sidebar layout mobile-friendly (#1660) 2021-02-13 18:29:33 +01:00
benjamin wil 0c89aa2b3e Update reference to test git bare repositories (#1662)
The CONTRIBUTING document referenced a file that has since been moved.
2021-02-13 17:50:27 +01:00
benjamin wil 1980e39876 Remove unused _layout.scss file (#1661) 2021-02-13 17:25:54 +01:00
Garet Robertson 2b949014b8 Add JS polyfill for IE compatibility (#1664). (#1667) 2021-02-13 17:11:40 +01:00
Dawa Ometto b399496ec2 Update gems (#1637) 2021-02-13 16:48:28 +01:00
Sam 8433327926 contrib/automation/gollum-post: A script to post files to Gollum in an automated way. (#1608) 2021-02-13 16:48:11 +01:00
Nikita Ivanov bb207f43d0 Fix binary diffs unable to be viewed in history. Resolves #1650 (#1649)
* Fix binary diffs cause error when viewed
* Change color of git lines to #000000a0
* Update assets
2021-01-10 13:54:30 +01:00
Nikita Ivanov 333af9b76c Add redirect to rename commit (#1648)
This PR ensures that changes to `REDIRECTS_FILE` are committed with the commit responsible for the corresponding git rename.
2021-01-08 14:36:54 +01:00
Dawa Ometto 18a16665cc Don't add base path to file url for deletion. Resolves https://github.com/gollum/gollum/pull/1620 (#1639)
* Add regression test
2021-01-04 11:29:45 +01:00
Bart Kamphorst 6c0796733d Filter _Template content. Resolves #1603 and #1640. (#1612)
* Filter _Template content. Resolves #1603 and #1640.

* Introduces a Gollum::TemplateFilter class with methods to easily add _Template Filters.

* Adds support for relative _Template pages with fallback to _Template in root.
2020-12-26 14:10:02 +01:00
Nikita Ivanov 97ed5a7c57 Add tests to the ? in page name fix (#1641) 2020-12-14 11:24:50 +01:00
Nikita Ivanov c87c8c446e Fix bug when link to a page doesn't work if it has ? in its title (#1634) 2020-12-13 13:42:19 +01:00
Dawa Ometto bfbfb21c17 Release 5.1.2 2020-12-01 22:22:22 +01:00
Dawa Ometto 137728cdab Guard against malicious file names 2020-12-01 22:21:54 +01:00
Dawa Ometto 3f7fd21d4a Update kramdown-parse-gfm (#1623) 2020-11-19 17:10:37 +01:00
Dawa Ometto 2204cef0ef Fix dependency status badge 2020-11-02 22:14:51 +01:00
Dawa Ometto 29ad7127d1 Add dependency status badge 2020-11-02 22:14:11 +01:00
Dawa Ometto 123518b940 Don't escape page path. Resolves #1615 (#1618) 2020-09-21 15:50:58 +02:00
Dawa Ometto dbe849707a Update GPG key 2020-09-13 16:21:43 +02:00
Dawa Ometto 986a76cf8e Release 5.1.1 2020-08-11 12:57:42 +02:00
Dawa Ometto 42439033c8 Release 5.1 2020-08-03 19:07:32 +02:00
Dawa Ometto 421ff18788 Updating assets for bugfix release. 2020-08-03 19:01:29 +02:00
Dawa Ometto 519a275ff0 Fix mathjax config path (#1605)
Related to #1602
2020-08-03 19:00:49 +02:00
Watal M. Iwasaki 5a95f79b32 Ensure page_route starts with a leading slash (#1604)
* Ensure page_route starts with a leading slash

* Handle base_url = nil in page_route()

* Refactor page_route()
2020-08-03 18:09:57 +02:00
Dawa Ometto 627ee5bbbe Merge pull request #1595 from heavywatal/upload-whitespaced-file
Address the uploads issue. Resolves #1584
2020-08-03 18:05:27 +02:00
Dawa Ometto a9d300341c Merge pull request #1594 from heavywatal/empty-search
Show search page even when no parameters are given
2020-07-15 12:46:18 +02:00
Dawa Ometto 6b7e912010 Merge pull request #1593 from heavywatal/fix-home-button
Address home button issue #1590
2020-07-15 12:44:13 +02:00
Watal M. Iwasaki 4feae80814 Update assets 2020-07-12 17:39:18 +09:00
Watal M. Iwasaki 5f5730fe2e Address the uploads issue #1584
'%20' in filenames are translated back to ' ' in both editor and file creation.
2020-07-12 17:37:20 +09:00
Watal M. Iwasaki 5f784f5e10 Show search page even when no parameters are given
This PR addresses the issue #1586
2020-07-12 15:22:18 +09:00
Watal M. Iwasaki 35a44efafd Address home button issue #1590
A trailing slash is added.
This fixes the behavior when base_url is nil.
2020-07-12 13:41:41 +09:00
Dawa Ometto b32dcfa8dd Merge pull request #1580 from heavywatal/reduce-direct-base_url
Reduce direct use of base_url
2020-06-17 10:37:15 +02:00
Watal M. Iwasaki 38fc32bbdd Return nil if url.empty? right after url.comact! 2020-06-16 17:55:01 +09:00
Watal M. Iwasaki 6c7b12ae5e Restore base_url for baseUrl in JavaScript 2020-06-16 17:29:32 +09:00
Dawa Ometto 649e19bdb1 Merge pull request #1578 from tpoliaw/no-edit-compare
Let compare versions be used in no-edit mode
2020-06-15 12:13:34 +02:00
Watal M. Iwasaki a4266170ea Address the issue #1572 (#1581)
* Add double-quote to data-file-path={{url}}
2020-06-15 12:02:32 +02:00
Watal M. Iwasaki 6e6d9d8c1f Use page_route() for custom.css, custom.js, and MathJax 2020-06-14 23:11:07 +09:00
Watal M. Iwasaki e49758334f Replace base_url with page_route() 2020-06-14 23:11:07 +09:00
Watal M. Iwasaki 580068212d Remove base_url from search.mustache 2020-06-14 23:11:07 +09:00
Watal M. Iwasaki 504278d9ba Move full_url_path from HasPage to Page
so that page_route() is accessible via Layout
2020-06-14 23:11:07 +09:00
Watal M. Iwasaki 214056a88a Refactor regex in clean_url() 2020-06-14 23:11:07 +09:00
Watal M. Iwasaki e310f76030 Enhance RouteHelpers
- page_route() accepts nil and return base_url
- clean_url() accepts multiple args and join them
2020-06-14 23:11:07 +09:00
Peter Holloway 83abe62125 Use GET for compare methods
POST requests are blocked when running in --no-edit mode so using POST
prevents compare being available (see #1546).

Change the history view form to use "get" as the form method and change
the routing in app to accept get requests for both forms of compare. The
order of the compare routes is switched to make the more specific form
checked first to prevent all requests being handled by the less specific
form.
2020-06-10 23:27:48 +01:00
Bart Kamphorst 8e7a714991 Merge pull request #1577 from gollum/fix_1571
Remove superfluous closing div tag. Add ids to all navigation buttons.
2020-06-09 09:30:27 +02:00
Bart Kamphorst 4f67710ed2 Remove superfluous closing div tag. Add ids to all navigation buttons. 2020-06-08 22:09:04 +02:00
Bart Kamphorst 8ec8be5db3 Merge pull request #1576 from mivok/feature/auto_save
Add auto save functionality
2020-06-08 21:26:54 +02:00
Watal M. Iwasaki 92da563211 Add quick access to diff of each commit in the history (#1555) 2020-06-08 20:49:34 +02:00
Mark Harrison 2eb5a7e4b8 Remove flash-full from the notification class list
It doesn't look right with the banner in the new position.
2020-06-05 22:59:20 -04:00
Mark Harrison 23110d5f05 Add autosave/restore for subpages too 2020-06-05 22:51:14 -04:00
Mark Harrison 18de3272e3 Move autosave message elements into the template 2020-06-05 21:34:07 -04:00
Mark Harrison 1e81c42818 Add auto save functionality
Fixes #527

This adds auto saving to gollum using local storage.
2020-06-04 22:30:40 -04:00
Dawa Ometto ef6e0e8a07 Fix gollum link tag highlighting (#1566) 2020-05-15 10:29:38 +02:00
Watal M. Iwasaki ba575b886d Simulate 'git show' when a single version is posted from /history/ (#1543) 2020-04-16 12:50:45 +02:00
Dawa Ometto c8f856109d Set environment to production when precompiling (#1554) 2020-04-14 11:50:29 +02:00
Sven Schwyn 4035c579c7 Don't uglify JS in development env (#1551) 2020-04-14 11:22:48 +02:00
Bart Kamphorst 8bab3de510 Merge pull request #1549 from yuttie/yuttie-patch-fix-data-file-path
Fix `data-file-path` in overview pages
2020-04-10 13:02:13 +02:00
Yuta Taniguchi 9ab4bbb17c Fix data-file-path
This correct the `data-file-path` attribute's value so that the value includes the ancestor directories to a file.
2020-04-09 23:51:02 +09:00
Bart Kamphorst ae024eb3b3 Merge pull request #1547 from heavywatal/flash-notice-h1
Fix a selector in flashNotice()
2020-04-08 20:16:04 +02:00
Watal M. Iwasaki db84653bf2 Fix a selector in flashNotice()
The original selector "#wiki-content h1" matches multiple times
when the page content has h1 headers, resulting in multiple notice
in a page, and what is worse, "$('#gollum-flash').fadeOut()" works
only for the first one.
2020-04-08 22:45:49 +09:00
Dawa Ometto d8ebba114f Release 5.0.1 2020-04-04 13:44:00 +02:00
Dawa Ometto b9d7375dba Fix migration script when using page-file-dir (#1542) 2020-04-04 13:43:29 +02:00
Dawa Ometto 676811206d Add tests for base_path (#1540) 2020-04-03 17:12:09 +02:00
Watal M. Iwasaki ff1baf0036 Replace redirect_to() with 'redirect to()` (#1536) 2020-04-03 15:32:51 +02:00
Sam 3d12aeb8b2 Update layout.mustache (#1539)
Fix loading of MathJax when run with a base path.
2020-04-03 15:28:00 +02:00
Dawa Ometto 5a8750a975 Fix migrate script path argument. Fix gollum --version (#1538) 2020-04-02 14:08:17 +02:00
Watal M. Iwasaki 0cb303f09f Check page.nil? before page.wiki (#1535) 2020-04-02 11:07:33 +02:00
Dawa Ometto edc7d0b50b Merge pull request #1531 from repotag/check_empty_repo
Add regression test against #1530
2020-03-31 16:51:19 +02:00
Dawa Ometto 2c268a9f8c Add regression test against #1530 2020-03-31 11:56:42 +02:00
Dawa Ometto d61a09d421 Update README.md 2020-03-30 12:33:57 +02:00
Dawa Ometto 0eee014a8b Release 5.0.0 2020-03-30 12:26:08 +02:00
Dawa Ometto 76f6b6e81c Merge pull request #1525 from repotag/update_assets
Update static assets
2020-03-30 11:56:40 +02:00
Dawa Ometto 40215c3da2 Update CONTRIBUTING.md 2020-03-30 11:27:19 +02:00
Dawa Ometto 1056d5cf16 Update static assets 2020-03-30 11:23:26 +02:00
Dawa Ometto f74c6c1706 Update bug_report.md 2020-03-30 11:15:51 +02:00
Dawa Ometto 821614e45a Delete ISSUE_TEMPLATE.md 2020-03-30 11:10:34 +02:00
Dawa Ometto 32e8618ed4 Merge pull request #1524 from gollum/dometto-patch-1
Update issue templates
2020-03-30 11:10:14 +02:00
Dawa Ometto e123611fed Update issue templates 2020-03-30 11:07:09 +02:00
Bart Kamphorst 5c3394c227 Merge pull request #1522 from gollum/fix_1516
Improve CSS styling on 5.x using Primer.CSS. Fixes #1515 #1516  #1518 .
2020-03-30 10:52:22 +02:00
Dawa Ometto da6708e61d Merge pull request #1517 from repotag/fix_assets
Actually package the sprockets manifest
2020-03-30 10:31:15 +02:00
Bart Kamphorst c99da8ff34 Hide the correct html elements for printing. Fixes #1516. 2020-03-30 10:16:18 +02:00
Bart Kamphorst 9ab308412c Let Primer.CSS style <hr> element. 2020-03-30 10:06:53 +02:00
Bart Kamphorst 4efcba6ceb Let Primer.CSS determine H1-H6 styling (fixes #1515). 2020-03-30 09:52:34 +02:00
Dawa Ometto ca7c708bf9 Update README.md 2020-03-30 01:40:58 +02:00
Dawa Ometto 1f70dca752 Minor 2020-03-30 01:35:56 +02:00
Dawa Ometto d32c5a88f7 Actually package the sprockets manifest. 2020-03-30 01:30:05 +02:00
Dawa Ometto b209127000 Use a precompiled jruby on Travis 2020-03-29 22:45:04 +02:00
Dawa Ometto 6e37601b25 Add therubyrhino to dependencies 2020-03-29 22:35:44 +02:00
Dawa Ometto 23b97daa84 Fix Travis 2020-03-29 22:35:28 +02:00
Dawa Ometto 7329b7595d Merge branch '5.x' 2020-03-29 22:28:50 +02:00
Dawa Ometto f0bb300e03 Update docs 2020-03-29 22:28:23 +02:00
Dawa Ometto 6a1ea82ff1 Merge branch 'master' into 5.x 2020-03-29 21:57:31 +02:00
Dawa Ometto 6011deb930 Restore --bare option (#1512) 2020-03-29 20:19:48 +02:00
Dawa Ometto 28bfe02411 Update travis 2020-03-29 20:13:09 +02:00
Dawa Ometto 862c6d5d2e Restore --bare option 2020-03-29 20:04:45 +02:00
Dawa Ometto 4c491a01db Fix highlights. Resolves #1506 (#1510) 2020-03-27 17:10:03 +01:00
Dawa Ometto 16676e0788 Update README.md (#1508)
* Update --css and --js documentation in bin/gollum

See https://github.com/gollum/gollum/issues/1507
2020-03-27 16:06:40 +01:00
Bart Kamphorst ebf46629b1 Merge pull request #1504 from heavywatal/align-right-edge
Remove a tiny padding in the head div
2020-03-27 13:05:14 +01:00
Dawa Ometto 36811490d0 Add --lenient-tag-lookup option (#1505) 2020-03-27 12:20:52 +01:00
Dawa Ometto f0122cebb5 Created Home (markdown) 2020-03-27 11:18:00 +01:00
Dawa Ometto e2804d6313 Add RSS Feed (#1500) 2020-03-27 10:37:50 +01:00
Watal M. Iwasaki ae7ed4eafa Remove a tiny padding in the head div 2020-03-27 16:51:41 +09:00
Dawa Ometto aae320ddff Fix assets (#1501)
* Rename app.css
2020-03-26 15:39:56 +01:00
Bart Kamphorst a71cb40bdf Merge pull request #1499 from gollum/primer_breadcrumbs
Primer CSS breadcrumbs (related to #1394).
2020-03-26 09:20:03 +01:00
Bart Kamphorst 2ba5d389a8 Fix breadcrumb tests. 2020-03-25 21:15:13 +01:00
Bart Kamphorst f1e8d30a43 Primer CSS breadcrumbs (related to #1394). 2020-03-25 20:50:03 +01:00
Bart Kamphorst e6ee27a083 Merge pull request #1498 from gollum/fix_1488
Clear both sides of the Sidebar float to push the footer down.
2020-03-25 16:47:34 +01:00
Bart Kamphorst 4008bf12e7 Clear both sides of the Sidebar float to push the footer down. 2020-03-25 16:36:14 +01:00
Dawa Ometto 0b1d7ab01c Update migration script (#1497)
* Add whitespace -> hyphens

* Update README
2020-03-25 12:29:39 +01:00
Dawa Ometto a45101cfe9 Package assets (#1493)
* Package static assets
* Fixed cancel button in editor
* Fix rake compilation task
* Add asset path helper
* Serve MathJax statically
* Fix mathjax in preview
2020-03-24 15:55:28 +01:00
Dawa Ometto d5970d6274 Tag compatibility. Resolves #1487 (#1492)
* Add --global-tag-lookup

* Add bin/gollum-migrate-tags

* Add migration tests (not on Travis)
2020-03-22 17:40:13 +01:00
Dawa Ometto 83f4ccfa70 Update README.md 2020-03-18 21:07:00 +01:00
Dawa Ometto 707648bde8 Remove old reference to livepreview (#1490) 2020-03-18 20:32:41 +01:00
Dawa Ometto 0707205374 Update HISTORY.md 2020-03-18 19:47:57 +01:00
Dawa Ometto f6f81b39f8 Remove more references to grit and start updating readme (#1486)
* Remove more references to grit

* Update History and Readme
2020-03-18 18:17:22 +01:00
Dawa Ometto f8829c68d6 Fix metadata title. Resolves #1484 (#1485)
* Fix metadata title
2020-03-16 16:53:18 +01:00
Dawa Ometto 54bbd1d789 Remove references to grit and stringex (#1482)
* Remove references to grit and stringex

* Fix revert tests, fix revert commit message
2020-03-16 01:59:47 +01:00
Dawa Ometto ee267f72a2 Track path changes in History. Resolves #1441 (#1443)
* Track path changes in History.
* Reactivate rename following on JRuby
2020-03-16 01:09:42 +01:00
Bart Kamphorst f516b1cb79 Merge pull request #1477 from gollum/sidebar_position
Restore functionality for determining the position of the sidebar (left or right).
2020-03-14 19:44:14 +01:00
Bart Kamphorst 0e4c8342ab Restore functionality for determining the position of the sidebar (left or right). 2020-03-14 19:28:54 +01:00
Dawa Ometto 6f61ddae77 Merge pull request #1476 from gollum/update_rake
Update rake to mitigate CVE-2020-8130.
2020-03-14 00:01:06 +01:00
Bart Kamphorst e312641cbd Update rake to mitigate CVE-2020-8130. 2020-03-13 20:09:18 +01:00
Bart Kamphorst 07de956b1d Merge pull request #1475 from gollum/fix_cloned_test_path
Use tmpdir instead of tempfile for creating temporary repos in the test suite.
2020-03-13 17:19:56 +01:00
Bart Kamphorst 4d549b1660 Use tmpdir instead of tempfile for creating temporary repos in the test suite. 2020-03-13 17:07:15 +01:00
Dawa Ometto e1a13aef1f Remove sanitize 2020-03-13 15:11:31 +01:00
TheCedarPrince cc3eb233c7 Disregard letter case for emojis (#1474) 2020-03-13 12:16:28 +01:00
Dawa Ometto f0b04f1334 gollum --versions: output used markdown gem (#1471) 2020-03-09 14:22:02 +01:00
flowerysong 9b89e31679 5.x: Fix a couple of upload issues (#1469)
* Remove debugging junk

* Remove duplicate `#{dir}` from upload commit message
2020-03-04 11:41:19 +01:00
Dawa Ometto 2b380ee6bc URI decode path in rename dialog (#1447) 2019-12-30 21:55:58 +01:00
Dawa Ometto caf4da73e2 Fix Windows assets and tests (#1425)
* Fix Windows assets and tests
* Update gemojione
2019-12-15 21:52:37 +01:00
Dawa Ometto 56e36df6bd Fix editable section link (#1438) 2019-10-10 19:56:00 +02:00
Dawa Ometto c8fed4d50d Provide JS with correct exts via template (#1437) 2019-10-10 16:36:06 +02:00
Bart Kamphorst c619920452 Merge pull request #1436 from gollum/upload_notices
Show flashNotice instead of JS alert for (un)successful uploads.
2019-10-09 18:56:01 +02:00
Bart Kamphorst 70ede99545 Show flashNotice instead of JS alert for (un)successful uploads. FadeOut success notices after 5s. 2019-10-09 13:46:28 +02:00
Bart Kamphorst 9862c51e3f Merge pull request #1433 from gollum/redirects
Add redirect support (e.g., after renames). Fixes #1023.
2019-10-08 21:50:45 +02:00
Bart Kamphorst f0dbc2801b Use clean_url helper. 2019-10-08 20:26:59 +02:00
jamieforth 7c65d65cb1 Rake precompile: Add missing requires (#1434) 2019-10-08 12:52:20 +02:00
Bart Kamphorst 5dd6c40933 Make redirect functionality conditional on @redirect_enabled (defaults to true). 2019-10-07 11:37:52 +02:00
Bart Kamphorst 5487563a71 Make regex more lenient. Nest redirect logic. 2019-10-07 11:22:00 +02:00
Bart Kamphorst 7458e396ee Add tests to ensure protection of redirects file. 2019-10-05 18:07:54 +02:00
Bart Kamphorst 8f104ec09c Add redirect support (e.g., after renames). Fixes #1023. 2019-10-05 13:32:28 +02:00
Dawa Ometto 8fe4c614db Fix redirect location for editor submit (#1430) 2019-10-01 15:47:25 +02:00
Dawa Ometto c137c2af4b Advanced search. Implements #615 (#1427) 2019-09-30 15:30:34 +02:00
Dawa Ometto 2402c9ef3b Enable CriticMarkup on Preview (#1429) 2019-09-30 12:58:15 +02:00
Dawa Ometto bbe609974a Fix change of format (#1419)
* Add empty language def for bibtex
2019-09-25 11:44:42 +02:00
Dawa Ometto 88c624877e Extract page dir from latest changes. Fix #1388 (#1395)
* Strip off page_dir prefix from latest changes urls
* Rename spurious next and previous_link
* New format for LatestChanges#versions: detect renames
2019-09-18 18:10:09 +02:00
Dawa Ometto 41d7cf75c5 Preview hotkeys also for create view (#1426) 2019-09-14 19:02:40 +02:00
Dawa Ometto 9da11dba10 Split editor and app JS. Fix asset precompilation (#1422) 2019-09-13 00:59:55 +02:00
Dawa Ometto d1857e5824 No symlink for ACE (#1423)
* No Symlink

* Fix JS syntax error
2019-09-12 23:54:50 +02:00
Dawa Ometto fc64d88ce9 Ace modes for all compatible markups (#1420)
* Add support for gollum tags
2019-09-12 22:25:55 +02:00
Dawa Ometto 3713890b5e Improve preview. Resolves #1414 (#1421)
* Fix Preview text direction
* Add hotkey for toggling preview
2019-09-12 20:28:58 +02:00
Dawa Ometto efaa6a0ba2 Editable sections. Resolves #1000 (#1415)
* Extend Ace highlighters to support gollum syntax
* Update ACE to 1.4.6
* Simplify (de)activation of function buttons
2019-09-12 12:37:24 +02:00
Dawa Ometto d55a3432a2 Solve minor issue involving Preview title (#1417) 2019-09-11 15:47:41 +02:00
Dawa Ometto 0fda253457 Add CSS for table.toc Fix #925 (#1418) 2019-09-11 14:42:47 +02:00
Bart Kamphorst 2216d67d5a Have upload modal ignore base-path when generating upload path. Resolves #1410. 2019-09-06 10:10:03 +02:00
Bart Kamphorst a04af6c638 Remove failing base-path test because base-path functionality is implemented in Rack middleware. 2019-09-04 13:56:26 +02:00
Bart Kamphorst 91c04cd44c Merge pull request #1412 from gollum/more_upload_tests
Add uploading tests for mode page, with and without base-path enabled.
2019-09-03 22:35:08 +02:00
Bart Kamphorst 1c98a787ab Reopen the tempfile before passing it to Rack::Test::UploadedFile. 2019-09-03 22:03:43 +02:00
Bart Kamphorst 87902f258a Remove base_path in upload path determination. 2019-09-03 13:05:24 +02:00
Dawa Ometto 3740a7f6ff DRY language definitions (#1411)
* Dryer language defs
* Fix markup modes after move to Primer
* Fix rest function buttons
2019-09-03 11:58:17 +02:00
Bart Kamphorst b6b176fdc1 Add uploading tests for mode page, with and without base-path enabled. 2019-09-03 11:33:53 +02:00
Bart Kamphorst 77aaeef5ff Add clipboard button to upload modal. Fixes #1401. 2019-09-02 12:33:11 +02:00
Dawa Ometto d1b1375629 Fix usericons (#1408)
* Fix and refactor user icons, add Basic tests
* Remove identicon_canvas, use identicon.js
* Use octicon by default
2019-09-01 21:45:55 +02:00
Dawa Ometto 569eac3a06 Improve page-info-toggle JS (#1409) 2019-08-31 21:45:21 +02:00
Bart Kamphorst a5ecb772ae Merge pull request #1407 from gollum/file_upload_tests
Added tests for file_upload route.
2019-08-29 19:52:03 +02:00
Dawa Ometto 736897a168 Merge branch 'repotag-remove_fontawesome' into 5.x 2019-08-29 19:20:12 +02:00
Dawa Ometto c1f6f0b429 Merge branch 'remove_fontawesome' of https://github.com/repotag/gollum into repotag-remove_fontawesome 2019-08-29 19:19:47 +02:00
Dawa Ometto 9fd9acb573 Use pure CSS spinner 2019-08-29 19:18:34 +02:00
Bart Kamphorst beff52a68e Added tests for file_upload route. 2019-08-29 16:01:20 +02:00
Dawa Ometto cc33d81473 Refactor 2019-08-29 14:10:54 +02:00
Bart Kamphorst 1a27f04577 Minor fix in handling conflict message in drag-and-drop uploading. 2019-08-29 11:56:34 +02:00
Dawa Ometto 2f2487150a Remove AnchorJS, native anchor styling 2019-08-28 23:51:05 +02:00
Dawa Ometto 6d44bd7bc8 Anchors with AnchorJS 2019-08-28 17:02:12 +02:00
Dawa Ometto e2d9d1f4d5 Add AnchorJS 2019-08-28 17:01:18 +02:00
Dawa Ometto 958410146b Add and rename .erb extension where needed 2019-08-28 17:01:01 +02:00
David Yates 0a9b9ff709 Align symbol for reStructuredText with github-markup (#1406) 2019-08-28 11:16:09 +02:00
Bart Kamphorst bce9800142 Restore upload_file route implementation from b40a344c49. 2019-08-27 20:49:33 +02:00
Bart Kamphorst 7f07f652d4 Also prepare drag-and-drop uploading for conflict detection. 2019-08-27 13:19:19 +02:00
Dawa Ometto 1b5f0b910b Remove FontAwesome 2019-08-27 12:42:21 +02:00
Bart Kamphorst e1aa4c02a0 Fix uploading (#1312). Requires updating git adapters. 2019-08-23 20:24:18 +02:00
Dawa Ometto 976f55e1b2 Pagination for history and latest changes. (#1396)
* Pagination for history and latest changes

* New footer for historical pages

* Fix pagination on history view.

* Do not directly use git adapter

* History view: allow selecting from different pages

* Use log_pagination_options to determine latest changes parameters

* Fix JS pageFullPath
2019-08-21 23:28:49 +02:00
Bart Kamphorst 29a8b893f1 Merge pull request #1399 from repotag/editor_fixes
Fix RTL button. Rename Edit Mode label to Markup.
2019-08-20 12:42:38 +02:00
Bart Kamphorst c991149422 Fix RTL button. Rename Edit Mode label to Markup. 2019-08-19 22:38:54 +02:00
Dawa Ometto 175c0ceab5 Show sidebars in preview (#1398) 2019-08-19 12:08:12 +02:00
Dawa Ometto 9d48ea0079 Fix typo (#1397) 2019-08-18 19:16:06 +02:00
Bart Kamphorst 042ad2d8c4 Merge pull request #1393 from gollum/primer_css
Major CSS/styling overhaul with Primer.css.
2019-08-14 20:24:13 +02:00
Bart Kamphorst 19868a10ef Minor fix for the footer div in preview pages. 2019-08-14 17:07:51 +02:00
Bart Kamphorst 92b17f9053 Removed some inline CSS. Removed footer from preview pages. 2019-08-14 16:39:55 +02:00
Bart Kamphorst 2dc527b60f Merge branch 'primer_css' of https://github.com/gollum/gollum into primer_css 2019-08-14 15:01:03 +02:00
Bart Kamphorst fa08ce35cc Add travis fix for running the tests properly. 2019-08-14 15:00:25 +02:00
Bart Kamphorst 8413e5b5ee Merge branch '5.x' into primer_css 2019-08-13 22:46:19 +02:00
Bart Kamphorst aa16f6ba2a Major CSS/styling overhaul with Primer.css. 2019-08-13 22:10:10 +02:00
Olle Jonsson 22e0fdc822 Gemspec: drop EOL'd property rubyforge_project (#1391) 2019-08-12 16:03:05 +02:00
Dawa Ometto 0de56202e9 Attempt travis fix (#1392) 2019-08-12 15:33:34 +02:00
Dawa Ometto bcec052e35 Add revert route helper. Resolves #1385 (#1386) 2019-05-18 14:43:10 +02:00
Dawa Ometto e28a41bb8f Fix breadcrumbs (#1387) 2019-05-18 14:42:42 +02:00
Dawa Ometto 17c574467f Merge pull request #1384 from gollum/dometto-patch-1
Don't lookup page's last version on edit
2019-05-17 11:06:58 +02:00
Dawa Ometto 8f350976a1 Don't lookup page's last version on edit
Slow and unused (?).
2019-05-17 01:34:57 +02:00
Dawa Ometto dfb4281a14 Add MediaWiki language def (#1382) 2019-05-16 21:03:07 +02:00
Dawa Ometto 7881237de2 Improve RTL support. Resolves #1314 (#1350)
* Improve RTL support with updated ACE 1.4.4
* Implement direction switch button
* RTL support on rendered pages
* Fix ace editor modes
* Fix language definitions
2019-05-16 20:38:33 +02:00
Bart Kamphorst 05daab661e Merge pull request #1218 from ProgramFan/bundle-mathjax-slim
Bundle a slim mathjax
2019-05-12 15:14:16 +02:00
Yang Zhang c0e6de899b Upgrade to mathjax-2.7.5 and use original mathjax config (fix comments in #1218) 2019-05-12 14:30:45 +08:00
Yang Zhang c103f3ebdc Fix mathjax loading and remove unused config 2019-05-11 09:04:14 +08:00
Yang Zhang 7cabd684a9 Bundle a slim mathjax (4.5MB uncompressed, 1.5MB compressed) 2019-05-11 09:04:14 +08:00
Dawa Ometto af344c1d25 Update dependencies (#1379) 2019-05-04 20:01:52 +02:00
Dawa Ometto b40a344c49 Remove page file dir from frontend. Resolves #1052 #1241 (#1369)
* Remove all references to page_file_dir. Use new method signature for Wiki#page. Refactor helpers.
* Use write_file for uploads
* Refactor /pages route
2019-05-04 01:19:59 +02:00
Bart Kamphorst e0a2b183ad Merge pull request #1373 from hirocaster/fix-h1-title-org-mode-for-ver5
Fix h1-title at org-mode
2019-03-21 09:46:16 +01:00
hirocaster 97857d0e3f Fix h1-title at org-mode 2019-03-20 22:09:07 +09:00
Bart Kamphorst 6fcfe7895e Merge pull request #1363 from gollum/page_breadcrumb
Implements a breadcrumb for normal wiki pages. Resolves #629.
2019-01-07 08:52:47 +01:00
Michael Gissing f5f655e3a1 Feature/fix gem 3 (#1364)
* change deprecated option which was removed in gem 3
2019-01-05 10:16:07 +01:00
Bart Kamphorst 94fe2f59d3 Implements a breadcrumb for normal wiki pages. Resolves #629. 2019-01-03 09:45:08 +01:00
Bart Kamphorst 66fd8eef1f Merge pull request #1362 from gollum/fix_header_layout
Move page title (h1) down. Move Home button to upper left corner on all views.
2019-01-01 09:20:24 +01:00
Bart Kamphorst fb5c65827d Move page title (h1) down. Move Home button to upper left corner on all views. 2018-12-30 19:09:52 +01:00
Dawa Ometto bb79cf5ce6 Merge branch 'repotag-use_path_helpers' into 5.x 2018-12-28 23:42:21 +01:00
Dawa Ometto f72e8610da Merge branch 'use_path_helpers' of https://github.com/repotag/gollum into repotag-use_path_helpers 2018-12-28 23:41:56 +01:00
Dawa Ometto b76a250596 Use AJAX button click for cmd-s hotkey. Fixes 1356 (#1361) 2018-12-28 23:40:32 +01:00
Dawa Ometto 2aea55a92c [WIP] Improve editor buttons: insert markup at the correct position. Resolves #504 (#1348)
* Improve editor buttons: insert markup at the correct position

* Center cursor after replacing text.

* Reimplement keyboard shortcuts for ace.

* Add break_line and whole_line to all language definitions

* Implement a better unordered list function.
2018-12-28 23:23:06 +01:00
Bart Kamphorst 073137af7d Merge pull request #1358 from gollum/fix_1340
Make mathjax.config.js the standard filename. Fixes #1340.
2018-12-28 23:10:48 +01:00
Bart Kamphorst e966de6922 Added tests for mathjax.config.js permissions. Fixed typo in permission regex. 2018-12-28 22:57:13 +01:00
Dawa Ometto 616c004058 Refactor 2018-12-28 22:47:39 +01:00
Bart Kamphorst 59bb48340e Fix test by adding new h2 editable class to expected output. 2018-12-28 22:45:17 +01:00
Dawa Ometto 7ec80bf2f1 Optional assets path argument for rake task via ENV 2018-12-28 22:43:59 +01:00
Bart Kamphorst 006dd36078 Make mathjax.config.js the standard filename. Fixes #1340. 2018-12-28 22:07:07 +01:00
Bart Kamphorst 58225c7c20 Add basic rest language definition. Fixes #1092. 2018-12-28 21:33:17 +01:00
Dawa Ometto 04501c205a Introduce JS variant of path helpers 2018-12-10 19:54:21 +01:00
Dawa Ometto 253ba89f90 Use relative asset urls in scss so base path will work 2018-12-10 19:53:40 +01:00
Dawa Ometto 7f598cb49e Fix e shortcut with baseurl 2018-12-10 19:52:52 +01:00
Dawa Ometto d3402dded2 Fix delete button in pages view with basepath 2018-12-10 19:52:23 +01:00
Dawa Ometto f222efd281 Remove unnecessary uglifier requirement 2018-12-10 19:51:06 +01:00
Dawa Ometto 8f6c19b3fd Move precompilation task to Rakefile 2018-12-10 19:50:49 +01:00
Dawa Ometto f44367c31b Remove Hacktoberfest Announcement 2018-12-02 17:35:10 +01:00
Bart Kamphorst c31c68200b Merge pull request #1353 from gollum/fix_1306
Do not attempt to normalize uploaded files unless they have valid page extensions.
2018-11-29 12:04:07 +01:00
Bart Kamphorst ddfaf8c091 Simpler solution for normalization of uploaded files. 2018-11-29 09:25:19 +01:00
Bart Kamphorst ca9702088f Do not attempt to normalize images or binary files. 2018-11-27 12:20:56 +01:00
Bart Kamphorst 413e962871 Update MathJax CDN. Related to PR #1267.
Co-authored-by: dplanella <dplanella@gitlab.com>
2018-11-23 14:29:21 +01:00
Bart Kamphorst 848cef26ee Fix wrapping issue for inline code blocks. Fixes #1033. 2018-11-23 13:49:51 +01:00
Bart Kamphorst b40b3aa9fc Merge pull request #1349 from gollum/detect_simultaneous_edits
Implement infrastructure for detecting and handling simultaneous edits
2018-11-20 16:41:46 +01:00
Bart Kamphorst ae853e074a Commit @dometto's fix for asset precompilation. 2018-11-20 16:16:25 +01:00
Bart Kamphorst f4838d12c6 Return the page's most recent version instead of random string. 2018-11-20 15:04:32 +01:00
Bart Kamphorst 4eb7fd211c Fix tests (do not expect redirect after edit) and add test for edit collisions. 2018-11-20 14:53:27 +01:00
Bart Kamphorst efd1d3992d Use page.sha instead of a content-based hash for collision detection. 2018-11-19 12:58:30 +01:00
Bart Kamphorst d4a9da0db5 Implement infrastructure for detecting and handling of simultaneous edits. 2018-11-16 14:24:21 +01:00
Dawa Ometto bde72cb52e Update README.md 2018-11-12 23:33:23 +01:00
Bart Kamphorst f251e0f556 Merge pull request #1345 from gollum/critic_markup_styling
Implements frontend support for CriticMarkup. Related to #1016.
2018-11-12 16:49:20 +01:00
Bart Kamphorst 5de2442540 Merge branch '5.x' into critic_markup_styling 2018-11-12 16:39:45 +01:00
Bart Kamphorst b5c4fdcc83 Merge pull request #1344 from gollum/ajax_file_upload
Improvements and fixes for file uploading. Prepares for handling of duplicate error.
2018-11-12 16:32:05 +01:00
Bart Kamphorst b50872497e Loosen route replacement regex to allow for dashes in routes. 2018-11-12 11:57:28 +01:00
Bart Kamphorst 6d0b42b18f Fix superfluous code in edit.rb. Add more descriptive help sentence for CriticMarkup. 2018-11-11 15:35:51 +01:00
Dawa Ometto 70bf766cd0 Update README.md 2018-11-11 02:25:29 +01:00
Dawa Ometto 104c959bf7 Update README.md 2018-11-11 02:11:21 +01:00
Dawa Ometto 3c4c2a072c Update app.rb (#1346) 2018-11-10 17:47:02 +01:00
Bart Kamphorst 769f8ec8d6 Implements frontend support for CriticMarkup. Related to #1016. 2018-11-08 16:11:38 +01:00
Bart Kamphorst 64c4ee9c05 Improve upload handling (server-side and UI). 2018-11-07 11:06:25 +01:00
Bart Kamphorst 6857995442 Only use ajax for file upload. Prepare for handling of duplicate error. 2018-11-02 14:38:12 +01:00
Bart Kamphorst eade94dcfd Merge pull request #1341 from ProgramFan/5.x
Fix absense of visual feedback when uploading with drag-and-drop. Fixes #1327.
2018-10-30 12:46:43 +01:00
Yang Zhang daef5fe9d2 Show spinning when uploading 2018-10-29 22:03:40 +08:00
Yang Zhang b8629729b9 Fix absense of visual feedback when uploading with drag-and-drop 2018-10-28 19:24:22 +08:00
Dawa Ometto 4e2b1442bd Fixup: typo and correct asset path 2018-10-20 00:47:35 +02:00
Dawa Ometto 83fbb16c3b Fix precompilation 2018-10-20 00:47:15 +02:00
Dawa Ometto d2ea03fbb9 Use path helpers consistently 2018-10-20 00:28:25 +02:00
Bart Kamphorst b1ac06cd5f Merge pull request #1337 from gollum/cleanup_route_naming
Use snake_case uniformly for all routes.
2018-10-19 22:10:35 +02:00
Bart Kamphorst 19751ec37f Use snake_case uniformly for all routes. 2018-10-19 21:54:14 +02:00
Bart Kamphorst 814caff755 Merge pull request #1336 from gollum/unify_deletion_routes
Unify deletion routes. Implement ajax deletion for /pages. Closes #1332.
2018-10-19 21:41:33 +02:00
Bart Kamphorst 8d611ea25a Add explanatory notes to deletion logics. 2018-10-19 21:32:22 +02:00
Bart Kamphorst 1a8b6d6823 Implement AJAX deletion in /pages in order to remove redirect in /delete route. 2018-10-19 21:04:31 +02:00
Dawa Ometto 78289a53bb Implement header counting using YAML frontmatter. Resolves #908 (#1330) 2018-10-19 16:09:23 +02:00
Dawa Ometto 303796c773 Merge pull request #1335 from lpbearden/5.x
Updated print.scss to remove footer when printing. Resolves #1333
2018-10-18 12:22:24 +02:00
Bart Kamphorst 825f43c429 Remove debug statements. 2018-10-17 22:24:05 +02:00
Bart Kamphorst 454b5e94dc Unify deletion routes. Closes #1332. 2018-10-17 22:18:23 +02:00
Lucas Bearden 7ddbab76c1 updated print.scss to remove footer when printing 2018-10-17 12:50:07 -04:00
Bart Kamphorst 6475394133 Use new view helper method in /pages. Add /deleteFile route to helpers. Fix bug in breadcrumb of /Home. 2018-10-17 14:47:35 +02:00
Dawa Ometto 874c20e69f Update README.md
💄
2018-10-15 10:44:32 +02:00
Dawa Ometto b93083667d Update README.md 2018-10-15 10:43:23 +02:00
Dawa Ometto 8f7108c56f Update README.md
Remove bit about building gem from source.
2018-10-15 10:40:53 +02:00
Dawa Ometto a6167d88cd Fix base_path bugs in bin/gollum (#1329) 2018-10-14 17:54:39 +02:00
Dawa Ometto 197a2bd57b Namespace (#1328)
* CSS to SCSS

* Use sprockets

* Use Sprockets helpers

* Fix gollum.editor.js error when changing language

* Add keybinding files required by ace and some ace ext files that are required or might be useful.

* Move app paths to /gollum namespace, add route helpers for view templates

* Use path helper for links in page view

* Use path helper methods in javascript assets

* Refactored sprockets helpers for mustache

* Remove debugging
2018-10-14 15:46:10 +02:00
Bart Kamphorst fd73eb6d05 Minor speed improvements. 2018-10-11 09:57:18 +02:00
Bart Kamphorst 963eb24fce Merge pull request #1318 from onewhaleid/non-image-uploads
Handle non-image uploads correctly
2018-10-07 14:40:43 +02:00
Bart Kamphorst 5c5bfc71bd Merge pull request #1326 from gollum/fix_pages_view_urls
Fix url generation in pages view.
2018-10-07 14:39:33 +02:00
Bart Kamphorst 3b9af34e0d Fix url generation in pages view. Show full filename with extension for pages. Distinguish in HTML between file and pages. 2018-10-05 14:48:42 +02:00
Dawa Ometto daaa82fab5 Merge pull request #1324 from repotag/secure_customs
Secure custom JS and CSS. Resolves #665
2018-10-03 22:27:05 +02:00
Dawa Ometto ff52933320 Improve error message 2018-10-03 22:19:39 +02:00
Dawa Ometto 84c01bb69b Improve regexps 2018-10-03 22:13:38 +02:00
Dawa Ometto eb9b71e94a Merge pull request #1325 from repotag/update_kramdown
Update kramdown
2018-10-03 13:30:40 +02:00
Dawa Ometto 1080e776a3 Update kramdown 2018-10-03 12:39:50 +02:00
Dawa Ometto f8673f565a Lockdown write access to custom.css and js 2018-10-02 23:56:46 +02:00
Dawa Ometto 6d4f97fdc4 Add custom.css and custom.js files to example repo 2018-10-02 23:56:16 +02:00
Dawa Ometto c85e14336e Lockdown access to custom css and js files in repo 2018-10-02 23:31:07 +02:00
Bart Kamphorst b1cdf91789 Merge pull request #1322 from gollum/enhance_pages_view
Implement basic file deletion for /pages view.
2018-10-02 15:25:11 +02:00
Bart Kamphorst fd9156821c Resolve minor issue to fix tests. 2018-10-02 14:21:00 +02:00
Bart Kamphorst feb098bf45 Implement basic file deletion for /pages view. 2018-10-02 14:03:26 +02:00
Dawa Ometto b0ad3265e7 Announce Hacktober 2018-10-01 18:51:41 +02:00
Dawa Ometto 02fd12339f Release 4.1.4 2018-10-01 13:30:14 +02:00
Dawa Ometto 9048d6a03d Depend on newest gollum-lib for patched sanitize version 2018-10-01 13:30:07 +02:00
Dawa Ometto b5eed33932 Add warbler to Gemfile and update gemspec. Depend on gollum-lib@master and adapters@master for dev purposes. 2018-10-01 13:09:13 +02:00
Dawa Ometto c660222300 Update README.md 2018-09-27 19:58:14 +02:00
Dawa Ometto 93f6b0373a Update README.md
Update supported rubies.
2018-09-24 19:41:36 +02:00
Dawa Ometto 43d3271b4e Update .gitattributes
Make github-linguist ignore files that aren't our own
2018-09-24 18:40:08 +02:00
Dawa Ometto 66d09b76c7 Update README.md
Remove badges that aren't working.
2018-09-24 18:34:14 +02:00
Dawa Ometto 90043a66cb Update README.md
Update badges
2018-09-24 18:11:50 +02:00
README Bot 317ccef7c8 Add CodeTriage badge to gollum/gollum (#1291)
Adds a badge showing the number of people helping this repo on CodeTriage.
2018-09-24 17:34:40 +02:00
Bart Kamphorst ef6bd9b538 Merge pull request #1320 from gollum/remove_file_view
Remove fileview from gollum and rely on /pages.
2018-09-24 14:30:29 +02:00
Bart Kamphorst 012f1fcd47 Remove fileview from gollum and rely on /pages. 2018-09-23 14:38:09 +02:00
Bart Kamphorst e46861f827 Merge branch '5.x' of https://github.com/gollum/gollum into 5.x 2018-09-22 21:16:44 +02:00
Bart Kamphorst 4549fdb9c5 Redirect broken links to 404 when --no-edit mode is enabled. Resolves #1197. 2018-09-22 21:16:01 +02:00
Bart Kamphorst f5ad5e397e Merge pull request #1319 from onewhaleid/editor-hover-text
Add hover text to editor buttons
2018-09-19 16:06:18 +02:00
Dan Howe f64ecd340b Add hover text to editor buttons 2018-09-19 23:09:21 +10:00
Dan Howe 3060a3576f Handle non-image uploads correctly 2018-09-19 22:48:09 +10:00
Dawa Ometto 771ca331e9 Create ISSUE_TEMPLATE.md 2018-09-17 22:44:09 +02:00
Bart Kamphorst 92e42236f5 Add --versions flag to the gollum binary that outputs the version numbers of auxiliary gems. Resolves #1022. 2018-09-17 22:41:31 +02:00
Dawa Ometto 7ada448bce Release 4.1.3 2018-09-17 22:29:34 +02:00
Dawa Ometto c2258c449e Added necessary escaping 2018-09-17 22:20:38 +02:00
Bart Kamphorst 051b88fe70 Drop support for ruby =< 2.2 on Travis (due to Sinatra upgrade to 2.0). 2018-09-17 21:25:24 +02:00
Bart Kamphorst 25578961c0 Merge branch '5.x' of https://github.com/gollum/gollum into 5.x 2018-09-17 21:12:39 +02:00
Bart Kamphorst b47db5611b Upgrade Sinatra to v.2.0 or higher. Closes #1193 (Rails 5 compatibility). 2018-09-17 21:12:30 +02:00
Dawa Ometto efe1df769b Remove legacy git_adapter helper method 2018-09-17 17:09:19 +02:00
Bart Kamphorst 812cd311c3 Fix conditional check on git adapter for String extension library. 2018-09-17 16:53:07 +02:00
Bart Kamphorst 676fb474b9 Merge pull request #1293 from ProgramFan/5.x
Upgrade bundled ACE editor to 1.3.1
2018-09-17 11:47:18 +02:00
Dawa Ometto 612267d322 Update CONTRIBUTING.md
Add GPG key
2018-08-14 09:36:26 +02:00
Yang Zhang 167b5c4b1f Upgrade bundle ACE editor to 1.3.1 2018-02-18 11:15:02 +08:00
Bart Kamphorst d87a481ffb Add cancel button to editor. Resolves issue #1282. 2018-02-05 16:44:55 +01:00
Bart Kamphorst 6f54af5556 Merge branch '5.x' of https://github.com/gollum/gollum into 5.x 2018-02-05 15:18:29 +01:00
Bart Kamphorst ddea445a28 Refactor create view. Fixes create with file extension. Fixes automatic selection of format in editor. 2018-02-05 15:15:54 +01:00
Bart Kamphorst e82bf4ce46 Merge pull request #1290 from gollum/fix_1274
Pagename() function no longer returns file extension. Fixes #1274.
2018-02-05 13:29:11 +01:00
Bart Kamphorst f75037db42 Pagename() function no longer returns fill extension. Fixes #1274. 2018-02-05 12:24:29 +01:00
Bart Kamphorst 01c7b5f380 Merge pull request #1287 from gollum/update_version
Change gollum version to 5.0.1b to prevent confusion during development. Closes #1278.
2018-01-17 17:12:03 +01:00
Bart Kamphorst 0b906dd952 Change gollum version to 5.0.1b to prevent confusion during development. Closes #1278. 2018-01-17 16:58:58 +01:00
Dawa Ometto dac91e9998 CSS to SCSS (#1247)
* CSS to SCSS

* Fix travis

* Use sprockets

* Use Sprockets helpers

* Fix gollum.editor.js error when changing language

* Fix fileview styles, use same style as Pages View.

* Add keybinding files required by ace and some ace ext files that are required or might be useful.
2018-01-14 16:47:47 +01:00
Dawa Ometto 6de0914788 Release 4.1.2 2017-08-07 17:54:00 +02:00
Dawa Ometto e4f702d1e2 Lock to newer gollum-lib to avoid falling back to unsafe nokogiri 2017-08-07 17:40:49 +02:00
Thomas KUNTZ a75b003c78 Update Mousetrap and use new 'mod' helper (#1245)
* Fix page list for files that have regexp special chars.

The page list collection logic was using the filename without any
scaping to create a regexp. This not only breaks for some names it might
even be a security problem by introducing bad regular expression as
filenames.

* Add another video to README.

* Test on Ruby 2.4

* Pass non-empty commit author details in transliteration test

Empty name or email are not allowed by libgit2 and cause a test failure
when the test suite is run against rugged_adapter.

* Solve bug when folder contain non-ascii character

When you create a file in a folder with non-ascii character, for exemple "Réseau", after creating the page, it throwed an "URI::InvalidURIError", given the fact that the url returned was "/Réseau/H%C3%A9y", only the part with the name of the file was correctly encoded.

So I propose to encode every part of the url to solve this issue
So I just

* readme: Use --document in place of deprecated options

* Release 4.1.0

* Skip tests for transliteration for adapters different than grit

* Fix date. Closes #1211

* Set bar_side for versioned pages. Closes #1226

* Update gemijione dependency. Closes #1227

* Release 4.1.1

* Update Mousetrap and use new 'mod' helper

Since version 1.4, a generic 'mod' helper can be used for cross
platform shortcuts. I updated Mousetrap to latest v1.6.1 and
used 'mod+s' instead of ['ctrl+s', 'command+s'] for the editor's
keyboard shortcut.

See https://craig.is/killing/mice#api.bind.combo
2017-08-07 00:29:08 +02:00
Dawa Ometto 08d822a3ff Merge pull request #1248 from repotag/fix_yaml
Fix potential bug in YAML rendering: convert object to string before escaping
2017-07-31 18:35:00 +02:00
Dawa Ometto 2f864c5e15 Stop support for ruby 2.0.0 because it is not compatible with a safe nokogiri. See https://github.com/gollum/gollum-lib/issues/278 2017-07-31 18:09:32 +02:00
Dawa Ometto c9e3e9aa84 Try fix Travis 2017-07-31 18:05:43 +02:00
Dawa Ometto 7139590798 Try fix travis 2017-07-31 18:01:37 +02:00
Dawa Ometto 37c1183515 Fix potential bug in YAML rendering: convert object to string before escaping 2017-05-31 17:18:45 +02:00
Dawa Ometto 935a080152 Merge pull request #1235 from svoop/escape_emojis
Document how to escape emoji
2017-04-30 20:49:04 +02:00
Sven Schwyn 6f11ce71c4 Minor rewording 2017-04-30 17:30:10 +02:00
Sven Schwyn f41a85ced9 Document how to escape emoji 2017-04-30 15:54:55 +02:00
Dawa Ometto 97fab1df14 Mark more Precious::App internal methods as private 2017-04-27 23:54:28 +02:00
Dawa Ometto f6273ded80 app.rb: mark non-route methods as private. 2017-04-27 23:32:16 +02:00
Dawa Ometto 9b7028a74e Remove superfluous useragent tests 2017-04-27 23:28:33 +02:00
Dawa Ometto 16894330a9 Merge pull request #1234 from repotag/wssub_fix
Found more spurious whitespace substitution.
2017-04-23 11:53:48 +02:00
Dawa Ometto 35f6952519 Found more spurious whitespace substitution. 2017-04-23 11:45:48 +02:00
Dawa Ometto ca50e87538 Merge pull request #1229 from ProgramFan/feature-5.x/add-keyboard-shortcuts-dialog
Add keyboard shortcuts dialog. Closes #505.
2017-04-17 22:24:48 +02:00
Dawa Ometto 0870655455 Release 4.1.1 2017-04-17 11:20:06 +02:00
Dawa Ometto ba24a7bb8c Update gemijione dependency. Closes #1227 2017-04-17 11:01:50 +02:00
Yang Zhang 56ad3251fd Add keyboard shorts dialog and enable Ctrl+S in the editor 2017-04-14 22:25:39 +08:00
Dawa Ometto f32d7465a2 Set bar_side for versioned pages. Closes #1226 2017-04-14 00:31:09 +02:00
Dawa Ometto 750e2ee677 Fix syntax error in bin/gollum 2017-04-14 00:28:44 +02:00
Dawa Ometto cc273f30e9 Merge pull request #1224 from repotag/remove_livepreview
Remove livepreview
2017-04-13 20:14:27 +02:00
Dawa Ometto 64fd56e8ef Merge branch '5.x' into remove_livepreview 2017-04-13 20:00:59 +02:00
Dawa Ometto 0fa47047f3 Merge pull request #1225 from repotag/follow_renames
Follow page renames in history view. Close #565
2017-04-13 19:59:59 +02:00
Dawa Ometto 6e2559f77a Merge pull request #1223 from repotag/expose_page_sha
Expose page's SHA id in Page view. Closes 1222.
2017-04-13 01:01:30 +02:00
Dawa Ometto cabe9f353b Fix tests 2017-04-13 00:24:06 +02:00
Dawa Ometto 5aa5bccda3 Remove livepreview 2017-04-12 23:03:11 +02:00
Dawa Ometto 16ea6245e3 Follow page renames in history view 2017-04-12 23:00:07 +02:00
Dawa Ometto df9382bbc3 Add test for Page view #sha. Fix h1 title test. 2017-04-12 19:50:40 +02:00
Dawa Ometto 39aa290ea6 Expose page's SHA id in Page view. Closes 1222. 2017-04-12 19:42:26 +02:00
Dawa Ometto f9b8b4e8d3 Remove ws subs (#1220)
* remove unwanted whitespace substitution
* end repression of file extensions
* see also https://github.com/gollum/gollum-lib/pull/249
2017-04-10 14:50:18 +02:00
Dawa Ometto 8aa10fe400 Yaml frontmatter (#1217)
Render YAML frontmatter

* Fix tests on 5.x

* Update README

* Refactor Page view #table

* Minor refactor

* Refactor
2017-04-09 19:26:04 +02:00
Dawa Ometto e202698bf1 Merge pull request #1189 from nimag42/patch-1
Solve bug when folder contains non-ascii character
2017-04-09 11:49:54 +02:00
Zhang YANG c1f94d2deb Replace the editor body with Ace editor (#1173)
* Replace editor's content editor with Ace Editor

* Bundle ace 1.2.5

* Give the ace editor body a name

* Changeing edit mode now changes Ace's editor mode

* Move Ace interface into gollum.editor.js and implement drag and drop uploading

* Make editor bottons work (mostly)

* Fix edit mode mapping

* Fix mode selection for empty editor

* Make the ace editor vertically resizable

* Add org-mode and reStructuredText mode mapping

* Add missing jquery.resize.js

* Change keybinding from vim to emacs

* Makes ace resizable on Chrom

* Fix accidental change of resize

* Add keyboard selector and fix commit message updating

* Add visual aid in editor to signal unavailable formats

* Hide line number by default
2017-04-09 10:48:22 +02:00
Dawa Ometto 11c2bf7dae Fix date. Closes #1211 2017-04-05 23:05:24 +02:00
Dawa Ometto 159a2e13ad Merge pull request #1213 from repotag/remove_ruby18
Remove unicode support on deprecated ruby 1.8
2017-04-04 14:31:08 +02:00
Dawa Ometto 1e53d7ba53 Remove unicode support on deprecated ruby 1.8 2017-03-28 22:12:01 +02:00
Dawa Ometto 53cf0e1148 Merge pull request #1201 from adamniedzielski/skip-transliteration-tests-rugged
Skip tests for transliteration for adapters different than grit
2017-03-11 20:35:53 +01:00
Adam Niedzielski 2d1e49e3f2 Skip tests for transliteration for adapters different than grit 2017-03-11 19:28:31 +01:00
Dawa Ometto 199161f611 Merge pull request #1188 from adamniedzielski/pass-non-empty-author-details
Pass non-empty commit author details in transliteration test
2017-03-10 12:00:57 +01:00
Dawa Ometto ece5c775f1 Release 4.1.0 2017-03-09 17:34:37 +01:00
Dawa Ometto 895d2eb97e Merge pull request #1198 from QuaeNocentDocent/template_page
Template page
2017-03-09 16:29:44 +01:00
Dawa Ometto 3121c43b71 Merge pull request #1180 from bogado/issue#1179
Fix page list for files that have regexp special chars.
2017-03-09 16:22:40 +01:00
Daniele Grandini c5f3270ff6 final before pull request 2017-02-24 13:54:29 +01:00
Daniele Grandini 318a4717d1 rebasing 2017-02-24 13:50:38 +01:00
Daniele Grandini 37a11546fa rebasing 2017-02-24 13:49:28 +01:00
Daniele Grandini 643a42aea6 Merge branch 'template_page' of https://github.com/QuaeNocentDocent/gollum into template_page
rebasing
2017-02-24 13:43:42 +01:00
Daniele Grandini 2b8497531d rebasing 2017-02-24 13:41:52 +01:00
Daniele Grandini fdbde7840d mv template load in page create and added tests 2017-02-24 13:32:20 +01:00
Daniele Grandini d702026134 final 2017-02-24 13:32:20 +01:00
Jérémie Astori e2d55b45ba Fix compare page not accessible in no-edit mode
Permission checking was spread across `post` action handlers instead of inside the `before` to normalize between `get` and `post` action handlers and be more explicit.
2017-02-24 13:32:20 +01:00
Horacio Sanson 72c8e1aff3 Add option to configure PlantUML endpoint 2017-02-24 13:32:20 +01:00
Bart Kamphorst 51e8caf369 Merge pull request #1191 from polyzen/patch-1
readme: Use --document in place of deprecated options
2017-02-16 16:05:35 +01:00
Daniel M. Capella e7e7937678 readme: Use --document in place of deprecated options 2017-02-02 14:26:32 -05:00
Jacquin Théo a0f5a60ea0 Solve bug when folder contain non-ascii character
When you create a file in a folder with non-ascii character, for exemple "Réseau", after creating the page, it throwed an "URI::InvalidURIError", given the fact that the url returned was "/Réseau/H%C3%A9y", only the part with the name of the file was correctly encoded.

So I propose to encode every part of the url to solve this issue
So I just
2017-01-29 00:39:39 +01:00
Adam Niedzielski af29c6e441 Pass non-empty commit author details in transliteration test
Empty name or email are not allowed by libgit2 and cause a test failure
when the test suite is run against rugged_adapter.
2017-01-27 15:15:50 +01:00
Dawa Ometto 00dfecb1c7 Merge pull request #1185 from connorshea/ruby-24
Test on Ruby 2.4
2017-01-20 23:30:24 +01:00
Dawa Ometto cc249bef15 Merge pull request #1182 from bjoernalbers/master
Add another video to README.
2017-01-19 15:14:11 +01:00
Connor Shea 9a2231804d Test on Ruby 2.4 2017-01-14 19:10:17 -05:00
Björn Albers 1edcf15bcd Add another video to README. 2017-01-10 18:26:56 +01:00
Victor Bogado 0190e08763 Fix page list for files that have regexp special chars.
The page list collection logic was using the filename without any
scaping to create a regexp. This not only breaks for some names it might
even be a security problem by introducing bad regular expression as
filenames.
2017-01-01 19:55:18 -08:00
Bart Kamphorst 6b20c5df71 Merge pull request #1176 from svoop/5.x
Update gemojione to 3.2
2016-12-31 10:52:01 +01:00
Sven Schwyn 8da809f22c Update gemojione to 3.2
https://github.com/gollum/gollum-lib/issues/226
2016-12-28 23:49:39 +01:00
Daniele Grandini 54ece4e432 mv template load in page create and added tests 2016-08-27 15:51:18 +02:00
Daniele Grandini a50fcd31e2 final 2016-08-25 10:11:22 +02:00
Dawa Ometto d3cc5a69c4 Merge branch 'rc' 2016-08-07 21:36:51 +02:00
Dawa Ometto 07ca53a778 Merge branch 'rc' into master
Conflicts:
	bin/gollum
2016-08-07 21:36:13 +02:00
Dawa Ometto abb516e1b1 Merge pull request #1155 from gollum/dont_wait_on_versions
Remove calls to Page#last_version. Closes #1078.
2016-08-07 20:28:52 +02:00
Dawa Ometto 6910b6d024 Merge pull request #1143 from astorije/patch-1
Fix compare page not accessible in no-edit mode. Resolves #1140.
2016-08-07 20:17:34 +02:00
Dawa Ometto 435a3e62ba Remove calls to Page#last_version, replace with AJAX-lookup of version info. 2016-08-07 20:09:01 +02:00
Bart Kamphorst f02c934ad7 Merge pull request #1154 from maarten/#855-delete-files
Fixes #855 Adds file deletion fuctionality.
2016-08-07 19:46:55 +02:00
Maarten Engelen 236680aab9 Add file deletion functionality
Adds route for file deletion
Add styles and images for this
2016-08-07 17:18:36 +02:00
Dawa Ometto 6316f97c06 Update CONTRIBUTING.md 2016-08-07 12:50:48 +02:00
Dawa Ometto 14830af306 Update CONTRIBUTING.md 2016-08-07 12:50:18 +02:00
Dawa Ometto b620decde7 Add contributing guidelines 2016-08-07 12:48:07 +02:00
Bart Kamphorst b08ca620a0 Merge pull request #1148 from astorije/patch-2
Remove deprecated github-markdown markup
2016-07-11 21:44:02 +02:00
Jérémie Astori 66a2bb0393 Remove deprecated github-markdown markup
From [RubyGems](https://rubygems.org/gems/github-markdown/versions/0.6.9):

> THIS GEM IS NOT MAINTAINED AND NOT SUPPORTED.

Also, the GitHub repository, maintained by GitHub, was removed.

The link is now a redirect, it doesn't point to the GFM page anymore.
2016-07-11 12:19:43 -04:00
Jérémie Astori 0675844d97 Fix compare page not accessible in no-edit mode
Permission checking was spread across `post` action handlers instead of inside the `before` to normalize between `get` and `post` action handlers and be more explicit.
2016-06-27 13:50:47 -04:00
Dawa Ometto 148eda2990 Merge pull request #1136 from gollum/503-safari-live
Add Safari to livepreview-enabled browsers. Fixes #503
2016-06-16 13:28:46 +02:00
Dawa Ometto 330f7b4002 Add Safari to livepreview-enabled browsers. Fixes #503 2016-06-16 12:58:22 +02:00
Dawa Ometto def0fc8866 Merge pull request #1126 from svoop/emoji
Support for emoji
2016-06-09 16:43:52 +02:00
Sven Schwyn fa1bcf9608 Add support for emojione 2016-05-19 20:33:25 +02:00
Bart Kamphorst 5a5e56a47b Merge pull request #1111 from jhominal/master
Unconditionally add 'test-unit' dependency.
2016-02-24 02:28:24 +01:00
Jean Hominal e64f40eaa3 Unconditionally add 'test-unit' dependency.
Fixes #1110
2016-02-23 22:52:07 +01:00
Dawa Ometto 3f3d86ad4c Merge pull request #1091 from jhominal/master
Use `last_version` instead of `versions` when possible. Fixes #1087.
2016-02-21 22:51:40 +01:00
Jean Hominal 91833dd72e Use last_version instead of versions when possible. Fixes #1087.
Use Gollum::Page#last_version instead of Gollum::Page#versions in the
cases identified in #1087:
 * In Precious::App#show_page_or_file
 * In Precious::Views::Page#author
 * In Precious::Views::Page#date
2016-02-14 23:15:38 +01:00
Bart Kamphorst c049f7c11f Merge pull request #1106 from gollum/youtube_demo_vids
Adds links to youtube videos in README.
2016-01-14 17:01:28 +01:00
Bart Kamphorst 6bd2f3bff5 Drop 1.9.3 testing on Travis, add 2.3.0. 2016-01-10 15:28:23 +01:00
Bart Kamphorst 8c3c519679 Adds links to youtube videos in README. 2016-01-10 11:49:34 +01:00
Dawa Ometto 4e5002a31e Merge pull request #1098 from andrehjr/gh-1066-sanitize-basepath
Sanitize basepath options when adding with more than one / at the start Fixes #1066.
2015-12-30 18:39:30 +01:00
André Luis Leal Cardoso Junior 5a53c58b04 Sanitize basepath options when adding with more than one / at the start. Fixes #1066 2015-12-05 23:23:22 -02:00
Bart Kamphorst a61d1e3d10 Merge pull request #1094 from repotag/master
Update kramdown and useragent dependencies.
2015-11-30 11:26:51 +01:00
Bart Kamphorst 1a50f99189 Merge branch 'master' of https://github.com/gollum/gollum 2015-11-30 00:28:30 +01:00
Bart Kamphorst 6caacbf388 Update kramdown and useragent dependencies. 2015-11-30 00:28:01 +01:00
Dawa Ometto f876aa7d0f Merge pull request #1077 from mpnowacki/renaming
fixed file renaming issues with page_file_dir
2015-11-02 11:42:50 +01:00
Dawa Ometto 31e1281600 Merge pull request #1086 from ngyuki/fix-preview-sidebar
Fix position of sidebar in preview
2015-11-02 11:42:25 +01:00
ngyuki 90072a9332 Fix position of sidebar in preview 2015-11-02 12:45:30 +09:00
Dawa Ometto bacd2893b9 Merge pull request #1084 from SkyCrawl/master
Fixing the vague "running from source" description in README
2015-10-25 13:20:17 +01:00
SkyCrawl 7362fd859b Fixing the "running" section 2015-10-25 13:12:36 +01:00
mpnowacki 3811fb46b3 fixed file renaming issues with page_file_dir. This will only work with appropriate changes in gollum-lib 2015-10-04 11:34:25 +02:00
Dawa Ometto ab42c0c0df Release 4.0.1 2015-09-20 14:48:32 +02:00
Bart Kamphorst de5aed2f6a Merge pull request #1069 from repotag/master
Added security check.
2015-09-20 14:31:14 +02:00
Bart Kamphorst ce68a88293 Added security check. 2015-09-20 13:53:02 +02:00
Dawa Ometto 288f75929d Merge pull request #1065 from n-st/sysv-init-script
Added init script for Debian's SysV-style init system
2015-09-16 12:52:38 +02:00
Dawa Ometto 8528dd0c7f Merge pull request #1067 from SkyCrawl/master
Fixing the link to Windows support meta issue
2015-09-14 17:55:18 +02:00
SkyCrawl e0f35eceab Fixing the link to Windows support meta issue 2015-09-14 17:31:25 +02:00
Dawa Ometto 7e36517a79 Merge pull request #1054 from SkyCrawl/master
Config files restored + BIN enhancements + BIN/README sync
2015-09-14 12:40:22 +02:00
Dawa Ometto 69327766bb Merge pull request #1061 from rgroux/gollum-with-cas-sso
README add link to wiki about CAS SSO
2015-09-14 12:38:35 +02:00
Nils Steinger 9ecf8a61ba Added init script for Debian's SysV-style init system
Adapted from the OpenRC init script in contrib/openrc/init.d/gollum.
2015-09-14 05:03:06 +02:00
Richard Groux 2323506c82 Update README.md 2015-09-10 18:14:59 +02:00
Bart Kamphorst caa1a55e7a Merge pull request #1062 from mortonfox/patch-1
Fix github-markup link in readme.
2015-08-26 09:49:56 +02:00
Morton Fox 2ce44c157a Fix github-markup link 2015-08-25 23:48:53 -04:00
rgroux e17778190d README add link to wiki about CAS SSO 2015-08-25 17:06:36 +02:00
SkyCrawl d1d81a0043 Syncing BIN with README + fixes & enhancements 2015-08-23 14:44:18 +02:00
SkyCrawl ddb5ced3d5 Updating gemspec to reflect recent changes 2015-08-23 14:43:46 +02:00
Bart Kamphorst 9cebe655fd Merge pull request #1060 from mchill/custom-template
Fix custom.x path when page-file-dir is not set
2015-08-21 14:11:02 +02:00
Matt Hill 51b5a11a54 Fix custom.x path when page-file-dir is not set 2015-08-20 23:19:25 -04:00
Bart Kamphorst f3405851a7 Merge pull request #1055 from repotag/webrick_fix
Add webrick as development dependency. Fixes #1053.
2015-08-14 11:42:17 +02:00
Bart Kamphorst 5b6870d610 Add webrick as development dependency. Fixes #1053. 2015-08-14 11:06:17 +02:00
SkyCrawl c3dceaff5c Adding reference to the "Troubleshoot" wiki page 2015-08-12 22:26:59 +02:00
SkyCrawl 0a9b35c039 Restoring config files to repo root 2015-08-12 22:26:20 +02:00
Dawa Ometto dc32997f45 Merge pull request #1051 from SkyCrawl/master
Docs update
2015-08-09 20:30:21 +02:00
SkyCrawl 67c64c17d5 README makeover 2015-08-09 19:22:16 +02:00
Dawa Ometto 9cc02982be Merge pull request #973 from hsanson/add-plantuml-opt
Add option to configure PlantUML endpoint
2015-08-09 19:15:02 +02:00
SkyCrawl b4c70a62a9 Removing Home.md due to being a mere lorem ipsum 2015-08-08 15:21:30 +02:00
SkyCrawl c9d5921f4e Moving docs/sanitization.md to the wiki 2015-08-08 15:21:00 +02:00
SkyCrawl 0f47a4de5d Removing config.rb due to being pointless 2015-08-08 15:20:35 +02:00
Dawa Ometto 0ba5e4d3c7 Merge pull request #1047 from benubird/custom-template
Changed layout template, to handle custom.x with page-file-dir
2015-08-05 14:51:51 +02:00
Joshua Swanson 73e61dbcff Changed layout template, to correctly handle custom.js when --page-file-dir is set 2015-08-05 13:26:19 +01:00
Bart Kamphorst ba142e3b19 Merge pull request #1038 from rgroux/development
upgrade/update a number of dependencies.
2015-07-27 22:14:55 +02:00
GROUX Richard f651a401e8 deps(update): test with ruby 2.2.2
need to add `test-unit` gem when using ruby >= 2.2.0
2015-07-27 13:49:03 +02:00
GROUX Richard 3301252fb2 deps(update): twitter_cldr update to > 3.2
Changelog is
[there](https://github.com/twitter/twitter-cldr-rb/blob/master/History.txt)
2015-07-27 13:20:50 +02:00
GROUX Richard fe77e2b0d3 deps(update): upgrade the mocha version to 1.1
Changelog is
[there](https://github.com/freerange/mocha/blob/master/RELEASE.md)
2015-07-27 13:16:29 +02:00
GROUX Richard d586567c3b deps(update): upgrade the useragent version to 0.14 2015-07-27 13:15:50 +02:00
GROUX Richard 211178d39e deps(update): upgrade the kramdown version to 1.8
Changelog of kramdown is [there](http://kramdown.gettalong.org/news.html)
2015-07-27 13:12:48 +02:00
Dawa Ometto d8354faa49 Merge pull request #1035 from rgroux/search
Search default query to ''
2015-07-26 20:23:09 +02:00
GROUX Richard f9e5c05046 Fix search without querry
App crash when we try to get /search

Add an empty querry '' as default
2015-07-21 19:35:45 +02:00
Dawa Ometto 596afe9451 Merge pull request #1034 from mehulkar/patch-1
Fix a typo in the readme
2015-07-16 23:35:51 +02:00
Mehul Kar f7b5de986a Fix a typo in the readme 2015-07-16 13:57:11 -07:00
Bart Kamphorst ee9262472b Merge pull request #1032 from techwiz24/iss1030-ie-cache
Fix #1030: Disable AJAX Cach in Live Editor
2015-07-12 19:09:04 +02:00
Nathan Lowe 8a6a8db730 Fix #1030: Disable AJAX Cach in Live Editor
Internet Explorer caches all AJAX get requests and decides when to expire
them in the cache. This commit disables caching on the GET request to
/data/<PAGE NAME>, which fixes IE displaying old page data when using the
live editor.

See http://www.dashbay.com/2011/05/internet-explorer-caches-ajax/ and
https://stackoverflow.com/questions/4303829/how-to-prevent-a-jquery-ajax-request-from-caching-in-internet-explorer
2015-07-03 17:28:43 -04:00
Bart Kamphorst 3642370f11 Merge pull request #1014 from techwiz24/iss/1012-pages-view
Fix #1012: /Pages View should list folders first, then files, all alphabetically.
2015-05-21 02:15:57 +02:00
Nathan Lowe 2db2cfb81c Update test coverage to account for #1012
The existing 'files_folders' test only covered the /Mordor subdirectory,
which does not include a diverse enough set of pages and folders to account
for the new rendering logic.

This test uses the results from the root of the lotr.git example repository
as it exists at this point in time. The mock '@results' are not passed as a
sorted array in order to test the sorting logic.

The existing 'files_folders' test has been renamed to 'files_folders from subdir'
because the 'files_folders' function should be tested in a situation when
viewing /pages from a subdirectory to ensure proper functionality.
2015-05-20 18:58:24 -04:00
Nathan Lowe 279b028c5e Fix #1012: /Pages should render Folders First, then files, alphabetically 2015-05-20 18:58:10 -04:00
Dawa Ometto f268827a2e Merge pull request #995 from tfogo/html-cleanup
Remove extraneous li tags
2015-04-26 19:05:00 +02:00
Dawa Ometto d8bc065057 Merge pull request #1003 from akston/readme_typo
Fix typo in README
2015-04-26 19:04:26 +02:00
Conor Schaub 6301bbbb66 Fix typo in README 2015-04-25 15:32:30 -07:00
Dawa Ometto 3ad65eaef8 Update README.md 2015-04-11 11:53:59 +02:00
Dawa Ometto 3d1bc7949d Update README.md 2015-04-11 11:43:40 +02:00
Dawa Ometto 26e092fd20 Update HISTORY.md 2015-04-11 11:42:21 +02:00
Dawa Ometto be7ddec1b0 Update README.md 2015-04-11 11:40:43 +02:00
Dawa Ometto 5781ac6bbd Release 4.0.0 2015-04-11 11:32:03 +02:00
Dawa Ometto a51bc4427a Merge pull request #994 from repotag/kramdown
Move to Kramdown and support JRuby
2015-04-11 11:07:34 +02:00
Dawa Ometto 80854584bb Make test regex more lenient 2015-04-11 01:29:08 +02:00
Tim Fogarty 93af289d3b Remove extraneous li tags 2015-04-06 02:40:02 -04:00
Dawa Ometto a27b882493 Test on jruby 2015-04-06 00:57:18 +02:00
Dawa Ometto ba6f957692 Move to Kramdown 2015-04-06 00:28:31 +02:00
Dawa Ometto ec0e1bf26f Merge pull request #992 from kirat-singh/fix-upload-file-url
prepend baseUrl to /uploadFile
2015-04-05 23:34:07 +02:00
Kirat Singh e4df298bb4 prepend baseUrl to /uploadFile 2015-04-05 14:22:41 -04:00
Dawa Ometto 804d21e31d Release 3.1.3 2015-04-04 11:45:17 +02:00
Dawa Ometto 6d33687866 Merge pull request #990 from repotag/issue940
Block on no-edit without using middleware
2015-04-03 17:32:20 +02:00
Dawa Ometto 21bb1efb46 Block on no-edit without using middleware 2015-04-03 17:22:51 +02:00
Dawa Ometto 9d0986f1ca Merge pull request #964 from simonzack/mathjax_livepreview
Enable mathjax in live preview
2015-04-02 13:13:25 +02:00
Bart Kamphorst fd483f397f Merge pull request #988 from andrewarrow/fix_template_dir
adding template dir logic to app.rb vs. just the bin
2015-03-30 13:27:54 +02:00
Andrew Arrow 09364850ee adding template dir logic to app.rb vs. just the bin 2015-03-27 15:13:55 -07:00
Dawa Ometto 4d3a8bad4c Merge pull request #985 from uraimo/patch-1
Fixed two broken links in README.md
2015-03-13 14:40:19 +01:00
Umberto Raimondi cc39b0aa41 Fixed two broken links in README.md
The textile site was shut down a few years ago, better refer to wiki for format details.
2015-03-13 14:28:04 +01:00
Horacio Sanson 1cceb7d4b4 Add option to configure PlantUML endpoint 2015-02-05 01:10:12 +09:00
Dawa Ometto 6fc3b4be75 Merge pull request #970 from repotag/issue969
Add root slash to drag-and-drop upload path. Resolves #969.
2015-01-30 22:13:01 +01:00
Dawa Ometto af6d690fc8 Add root slash to drag-and-drop upload path. Resolves #969. 2015-01-30 22:06:31 +01:00
Dawa Ometto eea5152444 Update README.md 2015-01-30 18:34:18 +01:00
Dawa Ometto 1ca38b625b Update README.md 2015-01-30 18:33:52 +01:00
Sunny Ripert f964407c47 Merge pull request #965 from simonzack/ace_hook
added an initAce hook to allow configuration of the live editor
2015-01-28 17:00:43 +01:00
simonzack 3be2e76ec0 enable $ inline expressions so the example markdown doc works, $ can be escaped using \$ so shouldn't be much of an issue 2015-01-28 19:06:24 +11:00
simonzack f9a9b90ed7 enable mathjax in live preview 2015-01-28 18:00:35 +11:00
Dawa Ometto 1f2917ac22 Merge pull request #959 from simonzack/ace_update
Updated ace so markdown highlights better.
2015-01-27 17:51:47 +01:00
simonzack fe1a8569f6 updated ace 2015-01-27 22:46:30 +11:00
simonzack 33e8d4f328 added an initAce hook to allow configuration of the live editor 2015-01-27 21:16:05 +11:00
Dawa Ometto e183260d0a Merge pull request #956 from repotag/issue_955
Resolves #955.
2015-01-26 23:16:50 +01:00
Dawa Ometto b4023942b4 Remove page file dir from upload path 2015-01-26 23:10:28 +01:00
Dawa Ometto c10c24d90d Merge pull request #953 from simonzack/master
Resolves #952.
2015-01-25 18:45:17 +01:00
simonzack 915f63cac4 pixel tweaks so the left scrollbar is selectable and the viewport takes the whole page 2015-01-26 04:15:14 +11:00
Dawa Ometto 5c30ff4d3e Release 3.1.2 2015-01-23 00:27:04 +01:00
Dawa Ometto 3269f02ba7 Merge pull request #950 from repotag/fix_allow_editing
Set the allow_editing wiki option to true by default.
2015-01-23 00:26:22 +01:00
Dawa Ometto e5c2e3b3eb Set the allow_editing wiki option to true by default. 2015-01-23 00:14:13 +01:00
Dawa Ometto 77f4aee0af Fix test related to gollum-lib TOC update 2015-01-23 00:00:01 +01:00
Dawa Ometto 868cbdfc7b Merge pull request #936 from techwiz24/iss922-sort-pages
Sort `/pages` alphabetically. Resolves #922.
2015-01-13 10:18:51 +01:00
Nathan Lowe a650c0eab8 Sort /pages alphabetically
Previously, the 'All Pages' view was not sorted alphabetically. We need
to sort on the lowercase version of the page names so that lowercase
names do not end up at the bottom of the list and are instead mixed in
alphabetically, as they should be.

Patches test/test_latest_changes_view.rb to include changes needed to
test alphabetical sorting.
2015-01-12 19:04:07 -05:00
Dawa Ometto a7dc8d8c6f Merge pull request #929 from repotag/830_pagename_encodings
Allow utf-8 page names when not using grit. Resolves #830 (when using rugged adapter).
2015-01-04 13:07:27 +01:00
Dawa Ometto 355db16d2c Allow utf-8 page names when not using grit. 2015-01-04 12:20:25 +01:00
Dawa Ometto c54ce41eb7 Merge pull request #928 from LEW21/compare-escape-redirect
Encode the page title in the URL of a diff page
2015-01-03 19:58:56 +01:00
Janusz Lewandowski afb7d4c9d1 Encode the page title in the URL of a diff page. 2015-01-03 17:56:51 +01:00
Dawa Ometto b55cdde9da Merge pull request #924 from rtrvrtg/patch-1
Fix wiki_options errors for hosted Gollum instances.
2014-12-29 12:31:39 +01:00
Geoffrey Roberts 93cbc6c770 Fix intermittent wiki_options errors
Changed to resolve intermittent errors where I'd see the following in my logs:

```text
ERROR -- : app error: undefined method `wiki_options' for Precious::App:Class (NoMethodError)
ERROR -- : /home/gollum/production/releases/20141229-172128/vendor/bundle/ruby/2.0.0/gems/gollum-3.1.1.1anchor4/lib/gollum/editing_auth.rb:10:in `call'
ERROR -- : /home/gollum/production/releases/20141229-172128/vendor/bundle/ruby/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
...
```

I suspect this is the case for Sinatra applications that host instances of Gollum using its `map` feature, as this reflects the production setup we're using it in. Calling @app.settings.wiki_options uses the app instance that gets passed into Precious::EditingAuth, thereby ensuring that we're getting a Gollum instance all the time.
2014-12-29 17:28:47 +11:00
Dawa Ometto 3b1b4a0a96 Update README.md 2014-12-22 20:28:50 +01:00
Dawa Ometto 10b45cb54d Add --bare command line option (see #811). 2014-12-22 20:20:57 +01:00
Dawa Ometto 9d289e571b Describe important security update. 2014-12-18 16:44:23 +01:00
Dawa Ometto cce871c30e Allow running tests with alternative adapter 2014-12-08 01:44:01 +01:00
Dawa Ometto c2b605a90f Release 3.1.1 2014-12-04 14:06:57 +01:00
Dawa Ometto 09149592b5 Set allow_editing in Precious::App to true by default. Closes #911 2014-12-04 13:53:58 +01:00
Dawa Ometto e7410e551b Bring rake dependency up to date. 2014-11-28 14:13:40 +01:00
Dawa Ometto 9d77bc4192 Release 3.1.0 2014-11-28 14:06:36 +01:00
Dawa Ometto 537fa0c423 Merge branch 'rc' 2014-11-28 13:38:33 +01:00
Dawa Ometto c78dbc8bc1 Merge branch 'master' into rc
Conflicts:
	README.md
	lib/gollum/app.rb
2014-11-28 13:36:21 +01:00
Dawa Ometto 249eed5c2c Update HISTORY.md 2014-11-28 13:26:47 +01:00
Dawa Ometto 55eb3b24f7 Merge pull request #904 from ut7/latest_changes_test_fix_dependency
Update test to avoide being dependent on git configuration
2014-11-28 12:39:12 +01:00
Étienne Charignon 508c255d0f Update test to avoide being dependent on git configuration
The previous test implementation was dependent on the git configuration:
	renames = copies

It could then pass on a computer with that config but not passe on
a different developpeur computer who could have a different git configuration.

That new implementation is testing the same behaviour but at a lower
level and is not dependent on the git configuration anymore.
2014-11-28 12:12:23 +01:00
Dawa Ometto 9f8a90c0ac Merge pull request #875 from ut7/latest-changes
Add a "latest changes" button and page
2014-11-27 19:22:42 +01:00
Dawa Ometto 861dc935cb Configure git on Travis 2014-11-27 19:12:54 +01:00
Dawa Ometto 96ef8cacea Merge pull request #899 from repotag/gollum-lib-112
Fix tests, see https://github.com/gollum/gollum-lib/issues/112
2014-11-27 14:11:01 +01:00
Dawa Ometto 5f3ecc8713 Merge pull request #901 from repotag/prepare-release
Prepare new release.
2014-11-27 13:58:24 +01:00
Dawa Ometto 8b8ef0eb46 Prepare new release. 2014-11-27 13:51:02 +01:00
Dawa Ometto 2dbea54c84 Merge pull request #900 from repotag/adapter-flag
Implement git adapter CLI flag.
2014-11-26 00:47:39 +01:00
Dawa Ometto a776d9fb6f Implement git adapter CLI flag. 2014-11-26 00:33:03 +01:00
Dawa Ometto 57b7bbff5a Update README.md
Updated command line options.
2014-11-25 23:43:42 +01:00
Dawa Ometto a832b0ed54 Fix tests, see https://github.com/gollum/gollum-lib/issues/112 2014-11-25 19:54:31 +01:00
Dawa Ometto 3ec75b84ae Merge pull request #898 from bambycha/editable
Disable editing from UI
2014-11-22 12:15:24 +01:00
Roman Bambycha b932763080 add function to disable editing, resolves #879 2014-11-17 19:46:46 +02:00
Étienne Charignon 374f8f2f69 First attempt at a global latest changes overview.
- uses a wiki_options entry named :latest_changes_count instead of a
  constant
- lists modified pages with links
2014-11-11 22:43:34 +01:00
Dawa Ometto 226c253d5a Merge pull request #895 from repotag/rc_fix_sidebar
Fix sidebar, header, and footer, and add regression test.
2014-11-10 22:54:05 +01:00
Dawa Ometto c78a9f7950 Fix sidebar, header, and footer, and add regression test. 2014-11-10 22:39:42 +01:00
Bart Kamphorst 7264510ab2 Merge pull request #893 from tuftedocelot/add-systemd
Add systemd service file to contrib and move openrc files to contrib directory as well.
2014-11-06 22:03:18 +01:00
Dawa Ometto 3458ec6511 Merge pull request #894 from repotag/892-view-file-revisions
Route /filename/[commit-sha] will display specific revision of a file. Resolves #892.
2014-11-06 21:57:25 +01:00
Dawa Ometto 2c80db6678 Route /filename/[commit-sha] will display specific revision of a file. Resolves #892. 2014-11-06 21:31:23 +01:00
tuftedocelot 439aa6e4f5 Prepare contrib directory
Move openrc files to contrib/ in conjunction with systemd service.
Update gemspec to bundle contrib/ into the gem.
2014-11-06 14:20:33 -06:00
tuftedocelot adf544dca9 Add systemd service file to contrib
Supersedes #887 to add a systemd unit file which will run as a user and
whose gollum path and options can be changed as needed.
2014-11-06 10:33:18 -06:00
Bart Kamphorst 0965269ee9 Merge pull request #890 from repotag/ignore_footer_header_sidebar_if_empty
Do not render footers, headers and sidebars if (after formatting) they are empty. Resolves #398 .
2014-11-05 09:10:28 +01:00
Dawa Ometto 19d370c4e9 Merge pull request #891 from repotag/704-showall-files
Resolves #704. Implements the fix proposed by @bdillahu in https://github.com/gollum/gollum/pull/767 and modifies tests accordingly.
2014-11-05 02:48:03 +01:00
Dawa Ometto cee0f8b652 Change pages display to handle non-wiki file types with --show_all enabled 2014-11-05 02:30:07 +01:00
Bart Kamphorst 37664d3487 Do not render footers, headers and sidebars if (after formatting) they are empty. Resolves #398 . 2014-11-05 02:15:35 +01:00
Dawa Ometto 5a78015d81 Merge pull request #889 from repotag/888-h1-logic
Page header now uses h1-title logic. Resolves #888.
2014-11-04 23:34:42 +01:00
Dawa Ometto 7250962ba3 Page header now uses h1-title logic. 2014-11-04 23:23:46 +01:00
Bart Kamphorst 442120bfdb Merge pull request #884 from tuftedocelot/issue600-docs
add detail to inline help
2014-10-28 20:25:52 +01:00
tuftedocelot de624d1e54 add detail to inline help 2014-10-27 07:12:43 -05:00
Dawa Ometto 523029cc45 Merge pull request #876 from LEW21/delete-commit-rc
Fix the commit information for page deletion. Solves #807.
2014-10-11 14:21:50 +02:00
Janusz Lewandowski 934affe419 Fix the commit information for page deletion.
Now they will be authored by the gollum.author.
2014-10-11 13:15:23 +02:00
Bart Kamphorst 55b9af1589 Merge pull request #869 from lucas-clemente/rc
allow uploading files by drag and drop (if uploading files is enabled).
2014-10-05 08:22:40 -04:00
Lucas Clemente 16dd7e46ef allow uploading files by drag and drop 2014-10-05 14:15:48 +02:00
Dawa Ometto 851c77d8f2 Merge pull request #847 from hardywu/master
add --mathjax-config to inject root-repo/mathjax.config.js. Closes #842.
2014-10-05 12:41:03 +02:00
Hardy ee55b74898 add --mathjax [CONFIG] to inject root-repo/[CONFIG] file,
which is similar to the behavior of --css and --js.
CONFIG is "mathjax.config.js" by default.
2014-10-04 23:09:10 -04:00
Dawa Ometto 13fc1e5c66 Merge pull request #872 from Mogztter/issue-870
Resolves #870.
2014-10-04 13:53:03 +02:00
Dawa Ometto 87112c2942 Merge pull request #873 from Mogztter/issue-871
Fix css selector for Asciidoctor h1 html ouptput
2014-10-04 13:47:26 +02:00
Guillaume Grossetie 2664fdca30 Fix css selector for Asciidoctor h1 html ouptput 2014-10-04 12:45:35 +02:00
Guillaume Grossetie e05f523145 Horizontal scroll when table is too wide 2014-10-04 12:37:21 +02:00
Geoffrey Roberts 1148d29439 Made the Gollum theme responsive.
Not a particularly comprehensive change in style, just one that removes all the fixed sizing for browsers below 940px in width.

Closes #831.
2014-10-02 00:50:29 +02:00
Sunny Ripert 7ba52978d1 Merge pull request #864 from Mogztter/asciidoc-headers
Adds headers to the AsciiDoc editor
2014-09-26 15:48:47 +02:00
Sunny Ripert 138a9fee43 Merge branch 'master' into rc 2014-09-24 10:58:10 +02:00
Sunny Ripert 1d522eaf0d Merge pull request #862 from Mogztter/asciidoctor-1.5.0-syntax
Use Asciidoctor 1.5.0 new syntax backtick
2014-09-22 13:51:40 +02:00
Sunny Ripert b5c5da64c9 Merge pull request #859 from Mogztter/patch-1
Update installation procedure for AsciiDoc
2014-09-22 13:49:05 +02:00
Guillaume Grossetie 8466425836 Adds headers to the AsciiDoc editor 2014-09-18 20:03:35 +02:00
Guillaume Grossetie b774ee5cd0 Use Asciidoctor 1.5.0 new syntax backtick
Asciidoctor 1.5.0 is now using backtick for inline code.
Replaces ASCIIDoc by AsciiDoc to respect the case.
2014-09-18 19:50:54 +02:00
Guillaume Grossetie 7e2e0e926b Update README.md
GitHub Markup is now using asciidoctor
2014-09-17 19:09:28 +02:00
Dawa Ometto 30f673c63c Update README.md with installation instructions 2014-09-13 12:29:39 +02:00
Bart Kamphorst bb5be728e3 Merge pull request #853 from joscarsson/patch-1
Update --allow-uploads help text in README
2014-09-09 17:19:12 +02:00
Jonas Oscarsson 0be5d1c657 Update --allow-uploads help text in README 2014-09-09 16:57:33 +02:00
Sunny Ripert d143e6be06 Merge pull request #841 from marcusps/mathjax-cdn-fix
Fix MathJax CDN URL
2014-07-24 13:52:33 +02:00
Marcus P S e65a78a5f5 Fix MathJax CDN URL
According to the [MathJax Blog](http://www.mathjax.org/changes-to-the-mathjax-cdn/), MathJax will retire the `rackcdn` CDN address at the end of this month. Updated the script to used the new CDN URL, and also made it so that the URL is HTTP/HTTPS agnostic, following the [MathJax docs](http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn).
2014-07-23 11:46:22 -04:00
Dawa Ometto 4f443a3c62 Merge pull request #805 from MrJaeger/respect-dollar-signs
Allow for $ characters on front-end editor
2014-06-01 17:54:52 +02:00
bootstraponline ff82ddea97 Add font awesome link 2014-04-05 14:38:34 -04:00
bootstraponline 2e2d3f5e87 Release 3.0.0 2014-04-05 14:25:55 -04:00
bootstraponline 491b1041f8 Add publish alias. Fix rake release 2014-04-05 14:25:39 -04:00
bootstraponline ce192d33f7 Add mocha development dependency 2014-04-05 14:12:55 -04:00
bootstraponline ca1cb64026 Use SVG badges 2014-04-05 13:55:52 -04:00
bootstraponline 71b5f5e469 Update gemspec dependencies 2014-04-05 13:35:11 -04:00
bootstraponline 946567f903 Merge pull request #817 from bootstraponline/test_fixes
Use FontAwesome for anchor links. Fix tests
2014-04-05 13:30:58 -04:00
bootstraponline 036e739511 Fix CSS to match github 2014-04-05 13:30:23 -04:00
bootstraponline 87a95b85c5 Use FontAwesome 4.0.3 for anchor links 2014-04-05 13:30:03 -04:00
bootstraponline 4f49859bf7 Format css 2014-04-05 13:30:03 -04:00
bootstraponline 2c53e55533 Update css 2014-04-05 13:30:03 -04:00
bootstraponline 2ae75978dd Format code 2014-04-05 13:30:02 -04:00
bootstraponline 452d825e66 Clean up tests. Remove templates 2014-04-05 13:30:02 -04:00
bootstraponline a7a1c4f81e Fix utf8 test 2014-04-05 13:30:02 -04:00
bootstraponline 00740eb9e8 Fix locale warning 2014-04-05 13:30:02 -04:00
bootstraponline d76264c255 Update version to 3.0.0 2014-04-05 13:28:04 -04:00
bootstraponline 2297ce418d Test on Ruby 2.1.1
The current stable version of Ruby is 2.1.1 so gollum should be tested there.
2014-04-02 23:30:20 -04:00
Sunny Ripert fec85e6c59 Merge pull request #815 from nyjt/patch-1
Travis-CI SVG badge [ci skip]
2014-03-28 14:49:01 +01:00
Jozsef Nyitrai 54efa35fb3 Fix broken travis-ci badge 2014-03-28 14:08:21 +01:00
bootstraponline 988aebf630 Merge pull request #813 from bootstraponline/update_template_css
Update template.css to match github
2014-03-14 22:20:08 -04:00
bootstraponline d2f7766aea Update template.css to match github 2014-03-14 22:19:33 -04:00
Daniel Kimsey 25d30aee64 Release 2.7.0 2014-02-20 11:10:00 -05:00
Daniel Kimsey 8af92da23c Update version of gollum-lib to 2.0.0 2014-02-20 11:07:59 -05:00
Andrew Jaeger 08dd36e1b0 In the javascript editor, '$' characters were getting stomped on when
trying to remove backreferences after doing transformations on text
(Bolding, Italicizing, etc.).  This can be fixed by first escaping the
string to be transformed and then unescaping it afterwards.
2014-02-08 14:18:36 -08:00
Sunny Ripert 324ff0a17c Merge pull request #802 from ExocTBlid/master
Printing CSS
2014-02-04 14:05:15 -08:00
Blomquist, Ethan cfb372e5e2 Another minor update... 2014-02-03 10:53:37 -07:00
Blomquist, Ethan 6513c732ba Minor update to the delete link for printing. 2014-02-03 10:50:13 -07:00
Blomquist, Ethan c4ea869223 Added print.css to remove action buttons and delete link for better print format. 2014-02-03 10:45:06 -07:00
Dawa Ometto 5387267675 Merge pull request #800 from budziq/delete_crash
Fixes crash if "delete page" was selected in preview of page that being created
2014-02-01 10:01:57 -08:00
Dawa Ometto 8e4c3cc562 Merge pull request #801 from budziq/history_crash_clean
fixes crash when selected "history" in preview of page being created
2014-02-01 09:58:42 -08:00
Michał Budzyński 8b6b0699e5 fixes crash when selected "history" in preview of page being created
- history button is hidden in newly created page preview as it makes no sense
- redirect to '/' if page does not exist yet
2014-01-31 02:43:03 +01:00
Michał Budzyński 229bff1658 Fixes crash if "delete page" was selected in preview of page that being created 2014-01-31 02:10:15 +01:00
Jamie Oliver 7a59d37350 Merge pull request #794 from github/ungithub-upstream
Status of GitHub Wikis
2014-01-28 11:12:20 -08:00
Dawa Ometto d06b1e7883 Merge pull request #787 from akretion/fix-upload-path
fixes bug #786 per_page_uploads: incorrect file path if page is inside some directory
2014-01-25 02:12:55 -08:00
Akretion BOT c8a284db9d fixes bug #786 per_page_uploads: incorrect file path if page is inside some directory 2014-01-25 04:53:19 +01:00
Dawa Ometto c7d6aceff4 Update sanitization.md 2014-01-23 19:33:25 +01:00
Dawa Ometto 7ea45d5e89 Update sanitization.md
Document customization of sanitation settings; see https://github.com/gollum/gollum/issues/759
2014-01-23 19:29:20 +01:00
Brandon Keepers 48c4aafb15 Remove reference to GitHub in readme
:(
2014-01-21 09:40:41 -08:00
Bart Kamphorst ff302ed842 Fixes alignment of tables (issue #700).
Fixes https://github.com/gollum/gollum/issues/700 .
2014-01-21 16:55:05 +01:00
Dawa Ometto 20a2424b83 Merge pull request #793 from repotag/flag_for_per_page_uploads
Add optional 'mode' argument to --allow-uploads flag, allowing user to toggle per_page_uploads.
2014-01-21 03:34:43 -08:00
Dawa Ometto de0f34a27a Add optional 'mode' argument to --allow-uploads flag, allowing user to toggle per_page_uploads. 2014-01-21 12:14:47 +01:00
Sunny Ripert d0992cce3f Merge pull request #790 from akretion/better-redirect-after-upload
fixes #788 better redirect after file upload
2014-01-20 03:13:13 -08:00
Akretion BOT 15feeb3614 fixes #788 better redirect after file upload 2014-01-19 23:24:01 +01:00
Jamie Oliver fc0a879e52 Support Ruby 2.1.0. Closes #784 2014-01-11 14:42:35 +00:00
Daniel Kimsey 9b675146a2 Merge pull request #782 from Joe8Bit/master
Update README.md to show options
2014-01-10 07:26:25 -08:00
Joe Pettersson 4d0bdcc8c0 Update README.md to show options 2014-01-10 13:47:15 +00:00
bootstraponline 0abdb67687 Merge pull request #781 from anchor/per-page-uploads
Implement the ability to store uploads on a per-page basis
2014-01-04 19:11:07 -08:00
Matt Palmer d1fb98cf1b Merge remote-tracking branch 'upstream/master' into per-page-uploads
Conflicts:
	lib/gollum/public/gollum/javascript/gollum.js
2014-01-03 17:49:53 +11:00
Matt Palmer 5eac24eacb Implement the ability to store uploads on a per-page basis
Storing all uploaded files in a single directory kinda sucks when you've got
a largish wiki, or the possibility of filename collisions.  With this patch,
though, you can set `:per_page_uploads => true` in your wiki settings and
have the file uploaded to a directory named for the page you were on when
you clicked 'Upload'.
2014-01-03 15:34:24 +11:00
bootstraponline 3fd16daeca Release 2.6.0 2014-01-02 23:32:41 -05:00
bootstraponline d9b38c3b73 Use baseUrl for /uploadFile
Thanks @mpalmer
https://github.com/gollum/gollum/pull/780
2014-01-02 23:03:33 -05:00
bootstraponline 0a5176c1ee Merge pull request #780 from peterkeen/upload-base-path
Base upload button action on home page url
2014-01-02 19:50:35 -08:00
Pete Keen b836b0e273 Base upload button action on home page url 2014-01-01 17:05:32 -05:00
bootstraponline 9a41e2a65d Merge pull request #772 from zorun/master
Prevent indexing of old versions of a page (fixes #768)
2014-01-01 09:05:07 -08:00
bootstraponline cb1b74ed7b Merge pull request #776 from eucher/first_slash_in_create
First slash in create
2014-01-01 09:02:58 -08:00
bootstraponline e25e5d9768 Merge pull request #779 from anchor/semantic-versioning
Fix version specifiers
2014-01-01 09:02:14 -08:00
Matt Palmer 9f3766952f Fix version specifiers
Adjusted the version specs on the two gems that explicitly state they are
SemVer compliant, and fixed up the one dependency that correctly *could* have
used ~> but didn't.
2013-12-31 15:18:15 +11:00
bootstraponline cb4471b07f Merge pull request #778 from jhogendorn/baddialog
Fixes dialog hiding so it doesnt block the UI
2013-12-08 08:55:28 -08:00
Joshua Hogendorn 9fa7eac41f Fixes dialog hiding so it doesnt block the UI 2013-12-08 20:15:59 +10:00
zorun 94fa985550 Add a test for issue #772 2013-12-06 02:46:15 +01:00
Evgeni Cherdancev 1c498ead35 gsub before begin 2013-11-28 12:32:08 +07:00
Evgeni Cherdancev 5abc983172 write_page first slash fix 2013-11-28 12:26:06 +07:00
zorun 7a0d4919b0 Prevent indexing of old versions of a page (fixes #768) 2013-11-22 12:49:42 +01:00
bootstraponline d5e9183877 Merge pull request #762 from pdenes/add_template_dir_option
add option to specify custom template directory
2013-11-11 14:25:27 -08:00
bootstraponline 9b39a51e9f Merge pull request #758 from samer/master
Fix revert for pages in directories
2013-11-11 14:25:10 -08:00
pdenes bec7eabd1c add option to specify custom template directory 2013-11-06 21:46:54 +00:00
Samer N cd3791087f Fix revert for pages in directories, as seen in issue #736 2013-11-04 13:03:31 +02:00
Jamie Oliver 714985e377 Release 2.5.2 2013-11-02 11:31:21 +00:00
Jamie Oliver 76c37dce96 Upgrade gollum-lib 2013-11-02 11:21:39 +00:00
bootstraponline 5a9af40058 Release 2.5.1 2013-10-15 07:20:13 -04:00
bootstraponline e871ff35b7 Merge pull request #753 from bootstraponline/master
Update gemspec
2013-10-15 04:19:41 -07:00
bootstraponline ecc6c32933 Update gemspec 2013-10-15 07:11:36 -04:00
bootstraponline 831cf61a08 Merge pull request #747 from invenia/master
Created OpenRC init script.
2013-10-12 12:18:22 -07:00
Curtis Vogt cc1231dece Added MIT license to init script header. 2013-09-30 13:52:34 +00:00
bootstraponline bb3d1a165b Merge pull request #751 from 1gor/patch-1
Added dependency 'github-markdown'
2013-09-29 09:29:23 -07:00
1gor 3da0426c54 Added dependency 'github-markdown' 2013-09-29 10:49:11 +06:00
Curtis Vogt e01aa25be3 Added basic logging to OpenRC script. 2013-09-27 17:02:16 +00:00
Abhijit Menon-Sen ee2f9d8dcb Merge pull request #748 from singlebrook/upload_instructions
Add some instructions to upload dialog
2013-09-27 07:30:40 -07:00
Leon Miller-Out 4d8677965c Add instructions for how to access file post-upload 2013-09-27 10:16:35 -04:00
Leon Miller-Out 72729d5510 Whitespace 2013-09-27 10:16:35 -04:00
Curtis Vogt 0b57e70c87 Removed explictly set license in OpenRC init script. 2013-09-27 14:09:00 +00:00
Curtis Vogt 033d6489f8 Created OpenRC init script. 2013-09-26 16:28:19 +00:00
Abhijit Menon-Sen 8608007337 Merge pull request #743 from singlebrook/upload_action_path
Use correct path for uploadFile action even when current page is in a folder.
2013-09-17 21:32:33 -07:00
Leon Miller-Out 665e493570 Use correct path for uploadFile action even when looking at a page in a folder 2013-09-17 12:36:53 -04:00
bootstraponline eb1e2f60f3 Fix #740 2013-09-12 08:49:27 -04:00
bootstraponline dc637f0a9b Merge pull request #734 from repotag/no_grit
No grit
2013-08-11 08:07:33 -07:00
Dawa Ometto f81634728d Replaced grit calls to new calls in gollum-lib 1.06 (set_git_timeout and set_git_max_filsize). Removed grit dependency from tests, using cp of empty.git instead. Replaced Grit exceptions with equivalents in the Gollum module. 2013-08-11 13:19:43 +02:00
bootstraponline 440cd5ebc0 Merge pull request #735 from ngyuki/fix-edit-for-multibyte
Fix `Encoding::CompatibilityError` of edit view.
2013-08-10 11:27:14 -07:00
Jamie Oliver 1cd7d0f205 Use display path in rename dialog. Fixes #703 2013-08-10 11:41:15 +01:00
ngyuki a69d62911c Fix editing of the sidebar with multi-byte characters. 2013-08-09 14:45:19 +09:00
ngyuki 395e9bd006 Add test for editing the sidebar, including multi-byte characters. 2013-08-09 14:41:52 +09:00
Jamie Oliver 90e20810d5 Do not force downcase on URLs. Fixes #621 2013-08-04 18:27:32 +01:00
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
1693 changed files with 27824 additions and 158542 deletions
+40
View File
@@ -0,0 +1,40 @@
# 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
# Make github-linguist ignore files that aren't our own
lib/gollum/public/gollum/* linguist-vendored
lib/gollum/public/gollum/javascript/gollum* linguist-vendored=false
lib/gollum/public/gollum/javascript/*/gollum* linguist-vendored=false
lib/gollum/public/gollum/css linguist-vendored=false
+32
View File
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Please read the [CONTRIBUTION GUIDELINES](https://github.com/gollum/gollum/blob/master/CONTRIBUTING.md) before submitting!**
If your have problems using or installing the software which stem from bugs in the software or a lack of documentation, we are always happy to help out! However, **for ordinary usage questions, please consider asking elsewhere**, for instance on [StackOverflow](http://stackoverflow.com/questions/tagged/gollum-wiki).
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Environment Info**
Always include the output of the `gollum --versions` command (NB: `versions` in plural).
+50
View File
@@ -0,0 +1,50 @@
name: Deploy docker
on:
push:
branches:
- master
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set deploy name to master
if: github.ref == 'refs/heads/master'
run: |
echo "DEPLOY_NAME=gollumwiki/gollum:master" >> $GITHUB_ENV
- name: Set deploy name to release version
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "DEPLOY_NAME=gollumwiki/gollum:${{ github.ref_name }}" >> $GITHUB_ENV
- name: Check Out Repo
uses: actions/checkout@v2
- name: Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ env.DEPLOY_NAME }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
platforms: linux/amd64, linux/arm64
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
+38
View File
@@ -0,0 +1,38 @@
name: Build and Test Docker
on: [push, pull_request]
env:
CI_IMAGE: gollum-ci-img
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: false
tags: ${{ env.CI_IMAGE }}
outputs: type=docker
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: docker state
run: docker image ls
- name: Run gollum as test
run: docker run -e CI=true ${{ env.CI_IMAGE }} --irb
+26
View File
@@ -0,0 +1,26 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Create Release
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: true
prerelease: false
body_path: "LATEST_CHANGES.md"
+46
View File
@@ -0,0 +1,46 @@
name: Ruby Build
on: [push, pull_request]
jobs:
jruby_build:
name: JRuby (${{ matrix.ruby }})
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [jruby-9.3.2.0]
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- name: Set up Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake
mri_build:
name: Ruby (${{ matrix.ruby }})
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['2.6', '2.7', '3.0', '3.1']
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake
+5
View File
@@ -4,3 +4,8 @@ pkg
.bundle
Gemfile.lock
*.gem
*.swp
.*
!.sprockets*
!lib/gollum/public/gollum/stylesheets/_styles.css
!.github*
-8
View File
@@ -1,8 +0,0 @@
rvm:
- 1.8.7
- 1.9.3
notifications:
disabled: true
before_install:
- gem uninstall ffi -a
- sudo apt-get install -y asciidoc
+111
View File
@@ -0,0 +1,111 @@
# Contributing to Gollum
Thanks for your interest in the gollum project!
## Submitting an Issue
Please note that the issue tracker is meant for:
1. Bug reports.
2. Feature requests.
If your have problems using or installing the software which stem from bugs in the software or a lack of documentation, we are always happy to help out! However, **for ordinary usage questions, please consider asking elsewhere**, for instance on [StackOverflow](http://stackoverflow.com/questions/tagged/gollum-wiki).
Gollum supports [custom macros](https://github.com/gollum/gollum/wiki#macros) for the creation of additional wiki markup tags. Please **do not** use this tracker to request macros specific to your situation. However, if you have or are working on a macro that you think may be useful to more users, you can share it as a GitHub [gist](https://gist.github.com) and link to it in the [wiki](https://github.com/gollum/gollum/wiki/Custom-macros).
Before submitting an issue, **please carefully look through the following places** to make sure your problem is not already addressed:
1. The issue tracker.
1. The [README](https://github.com/gollum/gollum/blob/master/README.md).
1. The project's [wiki](https://github.com/gollum/gollum/wiki).
Security vulnerabilities can be reported directly to the maintainers using these GPG keys:
* [@dometto](https://keys.openpgp.org/vks/v1/by-fingerprint/02354CC9F820B52CC2791979BB8CCC95FD83B795)
Lastly, please **consider helping out** by opening a Pull Request!
## Triaging Issues [![Open Source Helpers](https://www.codetriage.com/gollum/gollum/badges/users.svg)](https://www.codetriage.com/gollum/gollum)
You can triage issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to gollum on CodeTriage](https://www.codetriage.com/gollum/gollum).
## Opening a Pull Request
Pull Requests fixing bugs, implementing new features, or updating documentation and dependencies are all very welcome! If you would like to help out with the project, you can pick an open issue from the issue tracker. We're more than happy to help you get started! Here's how you can proceed:
1. Fork and clone Gollum.
2. Create a thoughtfully named topic branch to contain your changes.
3. If you haven't installed dependencies yet, navigate to your clone and execute:
```
[sudo] bundle install
```
4. Hack away.
5. Add your own tests and make sure they're all still passing.
6. If some of your changes deserve a mention on Gollum's home page, edit the README accordingly.
7. If necessary, rebase your commits into logical chunks, without errors.
8. Push the branch to your fork on GitHub.
9. Create a pull request for Gollum.
**Notes:**
* Do not change Gollum's version numbers, we will do that on our own.
### Running tests
1. Install [Bundler](http://bundler.io/).
2. Navigate to the cloned source of Gollum.
3. Install dependencies:
```
[sudo] bundle install
```
4. Run the tests:
```
bundle exec rake test
```
To profile slow tests, you can use `bundle exec rake test TESTOPTS="--verbose"`.
### Working with test repositories
An example of how to add a test file to the bare repository lotr.git.
```
mkdir tmp
cd tmp
git clone ../test/examples/lotr.git/
git log
echo "test" > test.md
git add .
git commit -am "Add test"
git push ../lotr.git/ master
```
## Updating static assets
This is necessary whenever changes have been made to the assets in `lib/gollum/public/gollum/javascript` (mostly SASS, CSS, and JS files), to ensure the changes are also present in the [released](#releasing-the-gem) version of the gem. Steps:
1. `git rm -r lib/gollum/public/assets`
1. `bundle exec rake precompile`
1. `git add lib/gollum/public/assets`
1. `git commit`
## Releasing the gem
Gollum uses [Semantic Versioning](http://semver.org/).
x.y.z
For z releases:
```
rake bump
rake release
```
For x.y releases:
```
# First update VERSION in lib/gollum.rb and then:
rake gemspec
rake release
```
+41
View File
@@ -0,0 +1,41 @@
FROM ruby:2.7-alpine AS builder
RUN apk add \
build-base \
cmake \
git \
icu-dev \
openssl-dev
COPY Gemfile* /tmp/
COPY gollum.gemspec* /tmp/
WORKDIR /tmp
RUN bundle install
RUN gem install \
asciidoctor \
creole \
wikicloth \
org-ruby \
RedCloth \
bibtex-ruby \
&& echo "gem-extra complete"
WORKDIR /app
COPY . /app
RUN bundle exec rake install
FROM ruby:2.7-alpine
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
RUN apk add \
bash \
git \
libc6-compat
VOLUME /wiki
WORKDIR /wiki
COPY docker-run.sh /docker-run.sh
ENTRYPOINT ["/docker-run.sh"]
+21 -2
View File
@@ -1,4 +1,23 @@
source "http://rubygems.org"
source 'https://rubygems.org'
gem 'warbler', platforms: :jruby
# FIXME:
#
# There's an issue in 1.12.5 that causes XHTML elements to be generated badly,
# causing Gollum's test suite to fail.[1] The issue has been fixed upstream,
# but we're still waiting for a new Nokogiri point release.
#
# However, 1.12.5 is a security patch, so we don't want end users to use an
# older version of Nokogiri. But this is safe to do in our CI environment.
#
# Once there's a new Nokogiri release, we can remove this dependency and JRuby
# CI should pass normally again.
#
# Note that Nokogiri 1.11+ does not support Ruby v2.4.x anymore. So to make our
# current CI workflows pass, we should only try to install this version of
# Nokogiri for newer Ruby versions.
gemspec
gem "rake", "~> 0.9.2"
gem 'rake', '~> 13.0'
+92
View File
@@ -1,3 +1,95 @@
# 5.3.0 / 2022-05-25
* Feature: allow for overriding only specific Mustache templates/partials (@beporter)
* Feature: Add option to show browser's local time (@NikitaIvanovV)
* Improvement: presentation on mobile devises (@benjaminwil)
* Improvement: Add page context to template filter. #1603 (@tevino)
* Fix: restore normalize check on file upload (@manofstick)
* Fix mathjax on edit and create pages. #1772 (@fhchl)
* Fix utf-8 issues: #1721 #1758 #1801 (@basking2, @dometto)
* Fix an IME rendering issue. #1735 (@yy0931)
* Fix broken history button when viewing historical deleted file. (@NikitaIvanovV)
* Fix: non-ascii characters in page names are not rendered correctly in the preview tab of the "Edit" page. #1739 (@yy0931)
* Fix: anchors and header display on JRuby. #1779
# 5.2.3 / 2021-04-18
* Fix bug preventing page titles from being displayed
# 5.2.1 / 2021-02-25
* Fix include call to a missing asset (@benjaminwil). This caused slow first page loads on JRuby.
# 5.2 / 2021-02-24
* Improved styling and Primer upgrade (@benjaminwil)
* Add redirect to rename commit (@ViChyavIn)
* Updated dependencies
* Bugfixes
# 5.1.2
* Guard against malicious filenames in breadcrumbs
# 5.1
* Bugfixes
* Add autosave feature (#1576)
* Add Add quick access to diff of each commit in the history
# 5.0 / 2020-03-17
This is a major new release that introduces many new features, bugfixes, and removes major limitations. See [here](https://github.com/gollum/gollum/wiki/5.0-release-notes) for a list of changes.
**Note**: due to changes to the way in which Gollum handles filenames, you may have to change some links in your wiki when migrating from gollum 4.x. See the [release notes](https://github.com/gollum/gollum/wiki/5.0-release-notes#migrating-your-wiki) for more details. You may be find the `bin/gollum-migrate-tags` script helpful to accomplish this. Also see the `--lenient-tag-lookup` option for making tag lookup backwards compatible with 4.x, though note that this will decrease performance on large wikis with many tags.
Many thanks to all the users who have provided feedback, and everyone who has chipped in in the development process!
Many of these changes have been made possible by removing the default grit adapter in favour of the new [rugged adapter](https://github.com/gollum/rugged_adapter).
# 4.1.4 /2018-01-10
* Depend on new version of gollum-lib that relies on a patched version of sanitize, which solves a vulnerability (CVE-2018-3740). See https://github.com/gollum/gollum-lib/pull/296.
# 4.1.3 /2018-17-09
* Solves a vulnerability in the File view and All Pages view that would allow XSS.
# 4.1.2 /2017-08-07
* Lock to a newer version of gollum-lib to avoid installing an outdated and vulnerable dependency (nokogiri) on ruby 2.0. See https://github.com/gollum/gollum-lib/pull/279. Note: this breaks semantic versioning so those using outdated rubies will discover the problem on update.
# 4.1.0 /2017-03-09
* Added file deletion functionality to file view
* Various performance improvements
* Emoji support
# 4.0.0 /2015-04-11
* Now compatible with JRuby (via the [rjgit](https://github.com/repotag/rjgit) [adapter](https://github.com/repotag/gollum-lib_rjgit_adapter))
# 3.1.1 /2014-12-04
* Security fix for [remote code execution issue](https://github.com/gollum/gollum/issues/913). Please update!
# 3.1 / 2014-11-28
* New features
* Drag-and-drop uploading in the editor [@lucas-clemente](https://github.com/lucas-clemente)
* Latest changes view [@etienneCharignon](https://github.com/etienneCharignon) (#707)
* Option `--no-edit` to disable editing from the web interface [@bambycha](https://github.com/bambycha) (#879)
* Option `--mathjax-config` to specify custom mathjax configuration [@hardywu](https://github.com/hardywu) (#842)
* Major enhancements
* Made the Gollum theme responsive [@rtrvrtg](https://github.com/rtrvrtg) (#831)
* Depends on new [gollum-lib](https://github.com/gollum/gollum-lib) `4.0.0`
* Allows specifiying [git adapter](https://github.com/gollum/gollum/wiki/Git-adapters) with `--adapter` [@bartkamphorst](https://github.com/bartkamphorst), [@dometto](https://github.com/dometto)
* Numerous bugfixes
* **NB**: please pass `--h1-title` if you do not want page titles to default to the page's filepath. See [here](https://github.com/gollum/gollum/wiki/Page-titles).
# 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
-3
View File
@@ -1,3 +0,0 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vulputate tincidunt sollicitudin. Quisque sit amet leo sed nunc eleifend rhoncus in consectetur leo. Vivamus posuere semper convallis. Duis malesuada lacus sed erat lobortis tincidunt mattis ligula consectetur. Sed aliquam vulputate eros at euismod. Aenean egestas lorem ligula, quis faucibus turpis. Curabitur a eros in ipsum gravida ornare. Sed elementum enim vel mi scelerisque dapibus. Nulla id libero ligula, quis tempus sem. Morbi nec felis tortor, ac cursus risus. Mauris elementum tortor id lacus eleifend non lobortis tellus pharetra. Etiam posuere cursus vestibulum. $x \lt y$
Morbi tincidunt dolor vel massa dictum volutpat. Vestibulum quis nibh metus, id tincidunt nisl. Vivamus eget sem ac risus eleifend rhoncus at eu nisl. Nunc elit massa, vulputate ac gravida eget, condimentum quis justo. Integer scelerisque, libero vel consequat ultricies, eros libero sagittis libero, pellentesque bibendum quam massa ut orci. Maecenas sit amet urna eget quam aliquam posuere. Nulla facilisi. Duis imperdiet augue sit amet metus ornare et hendrerit dui feugiat. Aenean a lacus neque. Sed eu enim tincidunt dolor pharetra porttitor. Vestibulum ut felis dui, rutrum iaculis orci. Duis eu bibendum tortor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse mollis sagittis purus sit amet sollicitudin. Phasellus vel interdum erat.
+13
View File
@@ -0,0 +1,13 @@
# 5.3.0 / 2022-05-24
* Feature: allow for overriding only specific Mustache templates/partials (@beporter)
* Feature: Add option to show browser's local time (@NikitaIvanovV)
* Improvement: presentation on mobile devises (@benjaminwil)
* Improvement: Add page context to template filter. #1603 (@tevino)
* Fix: restore normalize check on file upload (@manofstick)
* Fix mathjax on edit and create pages. #1772 (@fhchl)
* Fix utf-8 issues: #1721 #1758 #1801 (@basking2, @dometto)
* Fix an IME rendering issue. #1735 (@yy0931)
* Fix broken history button when viewing historical deleted file. (@NikitaIvanovV)
* Fix: non-ascii characters in page names are not rendered correctly in the preview tab of the "Edit" page. #1739 (@yy0931)
* Fix: anchors and header display on JRuby. #1779
+1 -1
View File
@@ -1,6 +1,6 @@
(The MIT License)
Copyright (c) Tom Preston-Werner, Rick Olson
Copyright (c) Tom Preston-Werner, Rick Olson, Dawa Ometto, Bart Kamphorst
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
+122 -494
View File
@@ -1,535 +1,163 @@
gollum -- A wiki built on top of Git
gollum -- A git-based Wiki
====================================
[![Build Status](https://secure.travis-ci.org/github/gollum.png?branch=master)](http://travis-ci.org/github/gollum)
[![Gem Version](https://badge.fury.io/rb/gollum.svg)](http://badge.fury.io/rb/gollum)
![Build Status](https://github.com/gollum/gollum/actions/workflows/test.yaml/badge.svg)
[![Open Source Helpers](https://www.codetriage.com/gollum/gollum/badges/users.svg)](https://www.codetriage.com/gollum/gollum)
[![Cutting Edge Dependency Status](https://dometto-cuttingedge.herokuapp.com/github/gollum/gollum/svg 'Cutting Edge Dependency Status')](https://dometto-cuttingedge.herokuapp.com/github/gollum/gollum/info)
[![Docker Pulls](https://img.shields.io/docker/pulls/gollumwiki/gollum)](https://hub.docker.com/r/gollumwiki/gollum)
See the [wiki](https://github.com/gollum/gollum/wiki) for extensive documentation, along with [screenshots](https://github.com/gollum/gollum/wiki/Screenshots) of Gollum's features.
## DESCRIPTION
Gollum is a simple wiki system built on top of Git that powers GitHub Wikis.
Gollum is a simple wiki system built on top of Git. A Gollum Wiki is simply a git repository of a specific nature:
Gollum wikis are simply Git repositories that adhere to a specific format.
Gollum pages may be written in a variety of formats and can be edited in a
number of ways depending on your needs. You can edit your wiki locally:
* A Gollum repository's contents are human-editable text or markup files.
* Pages may be organized into directories any way you choose.
* Other content can also be included, for example images, PDFs and headers/footers for your pages.
* Gollum pages:
* May be written in a variety of [markups](#markups).
* Can be edited with your favourite editor (changes will be visible after committing) or with the built-in web interface.
* Can be displayed in all versions, reverted, etc.
* Gollum strives to be [compatible](https://github.com/gollum/gollum/wiki/5.0-release-notes#compatibility-option) with [GitHub](https://docs.github.com/en/communities/documenting-your-project-with-wikis/about-wikis) and [GitLab](https://docs.gitlab.com/ee/user/project/wiki/#create-or-edit-wiki-pages-locally) wikis.
* Just clone your GitHub/GitLab wiki and view and edit it locally!
* Gollum supports advanced functionality like:
* [UML diagrams](https://github.com/gollum/gollum/wiki#plantuml-diagrams)
* [BibTeX and Citation support](https://github.com/gollum/gollum/wiki/BibTeX-and-Citations)
* Annotations using [CriticMarkup](https://github.com/gollum/gollum/wiki#criticmarkup-annotations)
* Mathematics via [MathJax](https://github.com/gollum/gollum/wiki#mathematics)
* [Macros](https://github.com/gollum/gollum/wiki/Standard-Macros)
* [Redirects](https://github.com/gollum/gollum/wiki#redirects)
* [RSS Feed](https://github.com/gollum/gollum/wiki/5.0-release-notes#rss-feed) of latest changes
* ...and [more](https://github.com/gollum/gollum/wiki)
* With your favorite text editor or IDE (changes will be visible after committing).
* With the built-in web interface.
* With the Gollum Ruby API.
Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
[TomDoc](http://tomdoc.org/) for inline documentation.
### SYSTEM REQUIREMENTS
Gollum runs on Unix-like systems using its default [adapter](https://github.com/gollum/rugged_adapter) for [rugged](https://github.com/libgit2/rugged). You can also run Gollum on [JRuby](https://github.com/jruby/jruby) via its [adapter](https://github.com/repotag/gollum-lib_rjgit_adapter) for [RJGit](https://github.com/repotag/rjgit/). On Windows, Gollum runs only on JRuby.
## INSTALLATION
The best way to install Gollum is with RubyGems:
### As a Ruby Gem
$ [sudo] gem install gollum
Ruby is best installed either via [RVM](https://rvm.io/) or a package manager of choice. Then simply:
```
gem install gollum
```
Installation examples for individual systems can be seen [here](https://github.com/gollum/gollum/wiki/Installation).
If you're installing from source, you can use [Bundler][bundler] to pick up all the
gems:
To run, simply:
$ bundle install
1. Run: `gollum /path/to/wiki` where `/path/to/wiki` is an initialized Git repository.
2. Open `http://localhost:4567` in your browser.
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.
### Via Docker
* [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`
* [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.
See [here](https://github.com/gollum/gollum/wiki/Gollum-via-Docker) for instructions on how to run Gollum via Docker.
### Misc
See [below](#running-from-source) for information on running Gollum from source, as a Rack app, and more.
## MARKUPS
Gollum allows using different markup languages on different wiki pages. It presently ships with support for the following markups:
* [Markdown](http://daringfireball.net/projects/markdown/syntax) (see [below](#Markdown-flavors) for more information on Markdown flavors)
* [RDoc](http://rdoc.sourceforge.net/)
* [ReStructuredText](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils`
* [Textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth`
You can easily activate support for other markups by installing additional renderers (any that are supported by [github-markup](https://github.com/github/markup)):
* [AsciiDoc](http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/) -- `gem install asciidoctor`
* [Creole](http://www.wikicreole.org/wiki/CheatSheet) -- `gem install creole`
* [MediaWiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
* [Org](http://orgmode.org/worg/dev/org-syntax.html) -- `gem install org-ruby`
* [Pod](http://perldoc.perl.org/perlpod.html) -- requires Perl >= 5.10 (the `perl` command must be available on your command line)
* Lower versions should install `Pod::Simple` from CPAN.
* [ReStructuredText](http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html) -- requires python >= 3
* Note that Gollum will also need you to install `docutils` for python
* [Textile](http://redcloth.org/hobix.com/textile/quick.html) -- `gem install RedCloth`
[bundler]: http://gembundler.com/
### Markdown flavors
## RUNNING
By default, Gollum ships with the `kramdown` gem to render Markdown. However, you can use any [Markdown renderer supported by github-markup](https://github.com/github/markup/blob/master/lib/github/markup/markdown.rb). This includes [CommonMark](https://commonmark.org/) support via the `commonmarker` gem. The first installed renderer from the list will be used (e.g., `redcarpet` will NOT be used if `github/markdown` is installed). Just `gem install` the renderer of your choice.
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:
See [here](https://github.com/gollum/gollum/wiki/Custom-rendering-gems) for instructions on how to use custom rendering gems and set custom options.
$ gollum
## RUNNING FROM SOURCE
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:
1. `git clone https://github.com/gollum/gollum`
2. `cd gollum`
3. `[sudo] bundle install`
4. `bundle exec bin/gollum`
5. Open `http://localhost:4567` in your browser.
$ gollum --help
### Rack
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).
Gollum can also be run with any [rack-compatible web server](https://github.com/rack/rack#supported-web-servers). More on that [over here](https://github.com/gollum/gollum/wiki/Gollum-via-Rack).
## REPO STRUCTURE
### Rack, with an authentication server
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.
Gollum can also be run alongside a CAS (Central Authentication Service) SSO (single sign-on) server. With a bit of tweaking, this adds basic user-support to Gollum. To see an example and an explanation, navigate [over here](https://github.com/gollum/gollum/wiki/Gollum-via-Rack-and-CAS-SSO).
### Service
## PAGE FILES
Gollum can also be run as a service. More on that [over here](https://github.com/gollum/gollum/wiki/Gollum-as-a-service).
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:
## CONFIGURATION
* 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 comes with the following command line options:
Gollum detects the page file format via the extension, so files must have one
of the supported extensions in order to be converted.
| Option | Arguments | Description |
| ----------------- | --------- | ----------- |
| --host | [HOST] | Specify the hostname or IP address to listen on. Default: '0.0.0.0'.<sup>1</sup> |
| --port | [PORT] | Specify the port to bind Gollum with. Default: `4567`. |
| --config | [FILE] | Specify path to Gollum's [configuration file](#Config-file). |
| --ref | [REF] | Specify the git branch to serve. Default: `master`. |
| --bare | none | Tell Gollum that the git repository should be treated as bare. |
| --adapter | [ADAPTER] | Launch Gollum using a specific git adapter. Default: `rugged`.<sup>2</sup> |
| --base-path | [PATH] | Specify the leading portion of all Gollum URLs (path info). Setting this to `/wiki` will make the wiki accessible under `http://localhost:4567/wiki/`. Default: `/`. |
| --page-file-dir | [PATH] | Specify the subdirectory for all pages. If set, Gollum will only serve pages from this directory and its subdirectories. Default: repository root. |
| --static, --no-static | none | Use static assets. Defaults to false in development/test, true in production/staging. |
| --assets | [PATH] | Set the path to look for static assets. |
| --css | none | Tell Gollum to inject custom CSS into each page. Uses `custom.css` from wiki root.<sup>3</sup> |
| --js | none | Tell Gollum to inject custom JS into each page. Uses `custom.js` from wiki root.<sup>3</sup> |
| --no-edit | none | Disable the feature of editing pages. |
| --local-time | none | Use the browser's local timezone instead of the server's for displaying dates. Default: false.
| --follow-renames, --no-follow-renames | none | Follow pages across renames in the History view. Default: true.
| --allow-uploads | [MODE] | Enable file uploads. If set to `dir`, Gollum will store all uploads in the `/uploads/` directory in repository root. If set to `page`, Gollum will store each upload at the currently edited page.<sup>4</sup> |
| --mathjax | none | Enables MathJax (renders mathematical equations). By default, uses the `TeX-AMS-MML_HTMLorMML` config with the `autoload-all` extension.<sup>5</sup> |
| --critic-markup | none | Enable support for annotations using [CriticMarkup](http://criticmarkup.com/). |
| --irb | none | Launch Gollum in "console mode", with a [predefined API](https://github.com/gollum/gollum-lib/). |
| --h1-title | none | Tell Gollum to use the first `<h1>` as page title. |
| --no-display-metadata | none | Do not render metadata tables in pages. |
| --user-icons | [MODE] | Tell Gollum to use specific user icons for history view. Can be set to `gravatar`, `identicon` or `none`. Default: `none`. |
| --mathjax-config | [FILE] | Specify path to a custom MathJax configuration. If not specified, uses the `mathjax.config.js` file from repository root. |
| --template-dir | [PATH] | Specify custom mustache template directory. Only overrides templates that exist in this directory. |
| --template-page | none | Use _Template in root as a template for new pages. Must be committed. |
| --emoji | none | Parse and interpret emoji tags (e.g. `:heart:`) except when the leading colon is backslashed (e.g. `\:heart:`). |
| --lenient-tag-lookup | none | Internal links resolve case-insensitively, will treat spaces as hyphens, and will match the first page found with a certain filename, anywhere in the repository. Provides compatibility with Gollum 4.x. |
| --help | none | Display the list of options on the command line. |
| --version | none | Display the current version of Gollum. |
| --versions | none | Display the current version of Gollum and auxiliary gems. |
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.
**Notes:**
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.
1. The `0.0.0.0` IP address allows remote access. Should you wish for Gollum to turn into a personal Wiki, use `127.0.0.1`.
2. Before using `--adapter`, you should probably read [this](https://github.com/gollum/gollum/wiki/Git-adapters) first.
3. When `--css` or `--js` is used, respective files must be committed to your git repository or you will get a 302 redirect to the create a page.
4. Files can be uploaded simply by dragging and dropping them onto the editor's text area when `--allow-uploads` is used.
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.
### Config file
## SIDEBAR FILES
When `--config` option is used, certain inner parts of Gollum can be customized. This is used throughout our wiki for certain user-level alterations, among which [customizing supported markups](https://github.com/gollum/gollum/wiki/Formats-and-extensions) will probably stand out.
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.
**All of the mentioned alterations work both for Gollum's config file (`config.rb`) and Rack's config file (`config.ru`).**
## HEADER FILES
## CONTRIBUTING
Header files allow you to add a simple header to your wiki. Header files must
be named `_Header.ext` where the extension is one of the supported formats.
Like sidebars, headers affect all pages in their directory and any
subdirectories that do not have a header file of their own.
Please consider helping out! See [CONTRIBUTING](CONTRIBUTING.md) for information on how to submit issues, and how to start hacking on gollum.
## FOOTER FILES
## THANKS TO
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.
## TABLE OF CONTENTS
Gollum has a special tag to insert a table of contents (new in v2.1)
'[[_TOC_]]
This tag is case sensitive, use all upper case. The TOC tag can be inserted
into the `_Header`, `_Footer` or `_Sidebar` files too.
There is also a wiki option `:universal_toc` which will display a
table of contents at the top of all your wiki pages if it is enabled.
The `:universal_toc` is not enabled by default. To set the option,
add the option to the `:wiki_options` hash before starting the
frontend app:
Precious::App.set(:wiki_options, {:universal_toc => true})
## 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 \).
### INSTALLATION REQUIREMENTS
In order to get the mathematical equations rendering to work, you need the following binaries:
* LaTex, TeTex or MacTex/BasicTeX (pdflatex)
* Netpbm (pnmcrop, pnmpad, pnmscale, ppmtopgm, pnmgamma, pnmtopng)
* Ghostscript (gs)
## 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 the header (if any) for a given page:
page.header
# => <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)
### RACK
You can also run gollum with any rack-compatible server by placing this config.ru
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'
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
## Windows Filename Validation
Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
## CONTRIBUTE
If you'd like to hack on Gollum, start by forking my repo on GitHub:
http://github.com/github/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:
1. Clone down your fork
1. Create a thoughtfully named topic branch to contain your change
1. Hack away
1. Add tests and make sure everything still passes by running `rake`
1. If you are adding new functionality, document it in the README
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.
## RELEASING
Update VERSION in lib/gollum.rb
$ rake gemspec
$ git tag vX.Y.Z
$ git push origin vX.Y.Z
$ gem build gollum.gemspec
$ gem push gollum-X.Y.Z.gem
## BUILDING THE GEM FROM MASTER
$ gem uninstall -ax gollum
$ git clone https://github.com/github/gollum.git
$ cd gollum
gollum$ rake build
gollum$ gem install --no-ri --no-rdoc pkg/gollum*.gem
[![Testing Powered By SauceLabs](https://opensource.saucelabs.com/images/opensauce/powered-by-saucelabs-badge-gray.png?sanitize=true "Testing Powered By SauceLabs")](https://saucelabs.com)
+111 -12
View File
@@ -1,6 +1,7 @@
require 'rubygems'
require 'rake'
require 'date'
require 'tempfile'
#############################################################################
#
@@ -8,6 +9,10 @@ require 'date'
#
#############################################################################
def date
Time.now.strftime("%Y-%m-%d")
end
def name
@name ||= Dir['*.gemspec'].first.split('.').first
end
@@ -17,12 +22,33 @@ def version
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
end
def date
Date.today.to_s
def latest_changes_file
'LATEST_CHANGES.md'
end
def rubyforge_project
name
def history_file
'HISTORY.md'
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 gemspec_file
@@ -50,6 +76,7 @@ Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test' << '.'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
test.warning = false
end
desc "Generate RCov test coverage and open in your browser"
@@ -71,7 +98,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
#############################################################################
#
@@ -79,19 +113,24 @@ end
#
#############################################################################
desc 'Create a release build'
desc 'Create a release build and push to rubygems'
task :release => :build do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
exit!
end
Rake::Task[:changelog].execute
sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git pull --rebase origin master"
sh "git tag v#{version}"
sh "git push origin master"
sh "git push origin v#{version}"
sh "gem push pkg/#{name}-#{version}.gem"
end
desc 'Publish to rubygems. Same as release'
task :publish => :release
desc 'Build gem'
task :build => :gemspec do
sh "mkdir -p pkg"
@@ -99,25 +138,27 @@ task :build => :gemspec do
sh "mv #{gem_file} pkg"
end
desc "Build and install"
task :install => :build do
sh "gem install --local --no-document pkg/#{name}-#{version}.gem"
end
desc 'Update gemspec'
task :gemspec => :validate do
# read spec file and split out manifest section
spec = File.read(gemspec_file)
head, manifest, tail = spec.split(" # = MANIFEST =\n")
# replace name version and date
# replace name and version
replace_header(head, :name)
replace_header(head, :version)
replace_header(head, :date)
#comment this out if your rubyforge_project has a different name
replace_header(head, :rubyforge_project)
# determine file list from git ls-files
files = `git ls-files`.
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 +180,62 @@ task :validate do
puts "A `VERSION` file at root level violates Gem best practices."
exit!
end
end
end
desc 'Build changlog'
task :changelog do
[latest_changes_file, history_file].each do |f|
unless File.exists?(f)
puts "#{f} does not exist but is required to build a new release."
exit!
end
end
latest_changes = File.open(latest_changes_file)
version_pattern = "# #{version}"
if !`grep "#{version_pattern}" #{history_file}`.empty?
puts "#{version} is already described in #{history_file}"
exit!
end
begin
unless latest_changes.readline.chomp! =~ %r{#{version_pattern}}
puts "#{latest_changes_file} should begin with '#{version_pattern}'"
exit!
end
rescue EOFError
puts "#{latest_changes_file} is empty!"
exit!
end
body = latest_changes.read
body.scan(/\s*#\s+\d\.\d.*/) do |match|
puts "#{latest_changes_file} may not contain multiple markdown headers!"
exit!
end
temp = Tempfile.new
temp.puts("#{version_pattern} / #{date}\n#{body}\n")
temp.close
`cat #{history_file} >> #{temp.path}`
`cat #{temp.path} > #{history_file}`
end
desc 'Precompile assets'
task :precompile do
require './lib/gollum/app.rb'
Precious::App.set(:environment, :production)
env = Precious::Assets.sprockets
path = ENV.fetch('GOLLUM_ASSETS_PATH', ::File.join(File.dirname(__FILE__), 'lib/gollum/public/assets'))
manifest = Sprockets::Manifest.new(env, path)
Sprockets::Helpers.configure do |config|
config.environment = env
config.prefix = Precious::Assets::ASSET_URL
config.digest = true
config.public_path = path
config.manifest = manifest
end
puts "Precompiling assets to #{path}..."
manifest.compile(Precious::Assets::MANIFEST)
end
+220 -70
View File
@@ -1,90 +1,221 @@
#!/usr/bin/env ruby
#!/usr/bin/env -S ruby -Eutf-8
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
help = <<HELP
Gollum is a multi-format Wiki Engine/API/Frontend.
Basic Command Line Usage:
gollum [OPTIONS] [PATH]
PATH The path to the Gollum repository (default .).
Options:
HELP
require 'optparse'
require 'rubygems'
require 'gollum'
require 'erb'
require 'sprockets'
exec = {}
options = { 'port' => 4567, 'bind' => '0.0.0.0' }
wiki_options = {}
exec = {}
options = {
:port => 4567,
:bind => '0.0.0.0',
}
wiki_options = {
:allow_uploads => false,
:allow_editing => true,
}
opts = OptionParser.new do |opts|
opts.banner = help
# define program name (although this defaults to the name of the file, just in case...)
opts.program_name = 'gollum'
opts.on("--port [PORT]", "Bind port (default 4567).") do |port|
options['port'] = port.to_i
# set basic info for the '--help' command (options will be appended automatically from the below definitions)
opts.banner = '
Gollum is a multi-format Wiki Engine/API/Frontend.
Usage:
gollum [options] [git-repo]
Arguments:
[git-repo] Path to the git repository being served. If not specified, current working directory is used.
Notes:
Paths for all options are relative to <git-repo> unless absolute.
This message is only a basic description. For more information, please visit:
https://github.com/gollum/gollum
OPTIONS'
# define gollum options
opts.separator ''
opts.separator ' Major:'
opts.on('-h', '--host [HOST]', 'Specify the hostname or IP address to listen on. Default: \'0.0.0.0\'.') do |host|
options[:bind] = host
end
opts.on('-p', '--port [PORT]', 'Specify the port to bind Gollum with. Default: \'4567\'.') do |port|
begin
# don't use 'port.to_i' here... it doesn't raise errors which might result in a nice confusion later on
options[:port] = Integer(port)
rescue ArgumentError
puts "Error: '#{port}' is not a valid port number."
exit 1
end
end
opts.on('-c', '--config [FILE]', 'Specify path to the Gollum\'s configuration file.') do |file|
options[:config] = file
end
opts.on('-r', '--ref [REF]', 'Specify the branch to serve. Default: \'master\'.') do |ref|
wiki_options[:ref] = ref
end
opts.on("--bare", "Declare '<git-repo>' to be bare.") do
wiki_options[:repo_is_bare] = true
end
opts.on('-a', '--adapter [ADAPTER]', 'Launch Gollum using a specific git adapter. Default: \'rugged\'.') do |adapter|
Gollum::GIT_ADAPTER = adapter
end
opts.on('-b', '--base-path [PATH]', 'Specify the leading portion of all Gollum URLs (path info). Default: \'/\'.',
'Example: setting this to \'/wiki\' will make the wiki accessible under \'http://localhost:4567/wiki/\'.') do |base_path|
# first trim a leading slash, if any
base_path.sub!(/^\/+/, '')
# make a backup of the option and sanitize it
base_path_original = base_path.dup
base_path = ERB::Util.url_encode(base_path)
base_path.gsub!('%2F', '/')
# then let the user know if we changed the URL
unless base_path_original == base_path
puts <<MSG
Warning: your base-path has been sanitized:
- original: "#{base_path_original}"
- sanitized: "#{base_path}"
MSG
end
# and finally, let others enjoy our hard work:
wiki_options[:base_path] = base_path unless base_path.empty?
end
opts.on('--page-file-dir [PATH]', 'Specify the subdirectory for all pages. Default: repository root.',
'Example: setting this to \'pages\' will make Gollum serve only pages at \'<git-repo>/pages/*\'.') do |path|
wiki_options[:page_file_dir] = path
end
opts.on('--static', 'Use static assets. Defaults to false in development/test, defaults to true in production/staging.') do
wiki_options[:static] = true
end
opts.on('--no-static', 'Do not use static assets (even when in production/staging).') do
wiki_options[:static] = false
end
opts.on('--assets [PATH]', 'Set the path to look for static assets. Only used if --static is set to true, or environment is production/staging. Default: ./public/assets') do |path|
wiki_options[:static_assets_path] = path
end
opts.on('--css', 'Inject custom CSS into each page. The \'<wiki-root>/custom.css\' file is used (must be committed).') do
wiki_options[:css] = true
end
opts.on('--js', 'Inject custom JavaScript into each page. The \'<wiki-root>/custom.js\' file is used (must be committed).') do
wiki_options[:js] = true
end
opts.on('--no-edit', 'Disable the feature of editing pages.') do
wiki_options[:allow_editing] = false
end
opts.on('--local-time', "Use the browser's local timezone instead of the server's for displaying dates.") do
wiki_options[:show_local_time] = true
end
opts.on('--follow-renames', 'Follow pages across renames in the History view. Default: true.') do
wiki_options[:follow_renames] = true
end
opts.on('--no-follow-renames', 'Do not follow pages across renames in the History view.') do
wiki_options[:follow_renames] = false
end
opts.on('--allow-uploads [MODE]', [:dir, :page], 'Enable file uploads.',
'If set to \'dir\', Gollum will store all uploads in the \'<git-repo>/uploads/\' directory.',
'If set to \'page\', Gollum will store uploads per page in \'<git-repo>/uploads/[pagename]\'.') do |mode|
wiki_options[:allow_uploads] = true
wiki_options[:per_page_uploads] = true if mode == :page
end
opts.on('--mathjax', 'Enable MathJax (renders mathematical equations).',
'By default, uses the \'TeX-AMS-MML_HTMLorMML\' config with the \'autoload-all\' extension.') do
wiki_options[:mathjax] = true
wiki_options[:mathjax_config] = 'mathjax.config.js'
end
opts.on('--critic-markup', 'Enable support for annotations using CriticMarkup.') do
wiki_options[:critic_markup] = true
end
opts.on('--irb', 'Launch Gollum in \'console mode\', with a predefined API.') do
options[:irb] = true
end
opts.on("--host [HOST]", "Hostname or IP address to listen on (default 0.0.0.0).") do |host|
options['bind'] = host
end
opts.separator ''
opts.separator ' Minor:'
opts.on("--version", "Display current version.") do
puts "Gollum " + Gollum::VERSION
opts.on('--h1-title', 'Use the first \'<h1>\' as page title.') do
wiki_options[:h1_title] = true
end
opts.on('--no-display-metadata', 'Do not render metadata tables in pages.') do
wiki_options[:display_metadata] = false
end
opts.on('--user-icons [MODE]', [:gravatar, :identicon], 'Use specific user-icons for history view.',
'Can be set to \'gravatar\' or \'identicon\'. Default: standard avatar.') do |mode|
wiki_options[:user_icons] = mode.to_s
end
opts.on('--template-dir [PATH]', 'Specify custom mustache template directory. Only overrides templates that exist in this directory.') do |path|
wiki_options[:template_dir] = path
end
opts.on('--template-page', 'Use _Template.{ext} as a template for new pages.') do
wiki_options[:template_page] = true
end
opts.on('--lenient-tag-lookup', 'Internal links resolve case-insensitively, will treat spaces as hyphens, and will match the first page found with a certain filename, anywhere in the repository. Provides compatibility with Gollum 4.x.') do
wiki_options[:case_insensitive_tag_lookup] = true
wiki_options[:global_tag_lookup] = true
wiki_options[:hyphened_tag_lookup] = true
end
opts.on('--emoji', 'Parse and interpret emoji tags (e.g. :heart:) except when the leading colon is backslashed (e.g. \\:heart:).') do
wiki_options[:emoji] = true
end
opts.separator ''
opts.separator ' Common:'
opts.on('--help', 'Display this message.') do
puts opts
exit 0
end
opts.on('--version', 'Display the current version of Gollum.') do
puts 'Gollum ' + Gollum::VERSION
exit 0
end
opts.on('--versions', 'Display the current version of Gollum and auxiliary gems.') do
require 'gollum-lib'
puts 'Gollum ' + Gollum::VERSION
puts "Running on: #{RUBY_PLATFORM} with Ruby version #{RUBY_VERSION}"
puts 'Using:'
loaded_gemspecs = Gem.loaded_specs
gollum_gems = ['gollum-lib', 'gollum-rjgit_adapter', 'rjgit', 'gollum-rugged_adapter', 'rugged']
puts Gem.loaded_specs.select{|name, spec| gollum_gems.include?(name)}.map {|name, spec| "#{name} #{spec.version}"}
puts "Markdown rendering gem: #{GitHub::Markup::Markdown.implementation_name}"
puts 'Other renderering gems:'
renderer_gems = ['RedCloth', 'org-ruby', 'creole', 'asciidoctor', 'wikicloth']
renderer_gems.each do |renderer|
begin
require renderer
rescue LoadError
end
end
results = Gem.loaded_specs.select{|name, spec| renderer_gems.include?(name)}.map {|name, spec| "#{name} #{spec.version}"}
puts results.empty? ? 'none' : results
exit 0
end
opts.on("--config [CONFIG]", "Path to additional configuration file") do |config|
options['config'] = config
end
opts.on("--irb", "Start an irb process with gollum loaded for the current wiki.") do
options['irb'] = 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("--mathjax", "Enables mathjax.") do
options['mathjax'] = true
end
opts.separator ''
end
# Read command line options into `options` hash
begin
opts.parse!
rescue OptionParser::InvalidOption
puts "gollum: #{$!.message}"
puts "gollum: try 'gollum --help' for more information"
exit
rescue OptionParser::InvalidOption => e
puts "gollum: #{e.message}"
puts 'gollum: try \'gollum --help\' for more information'
exit 1
end
# --gollum-path wins over ARGV[0]
gollum_path = wiki_options[:gollum_path] ?
wiki_options[:gollum_path] :
ARGV[0] || Dir.pwd
gollum_path = ARGV[0] || Dir.pwd
if options['irb']
if options[:irb]
require 'irb'
# http://jameskilton.com/2009/04/02/embedding-irb-into-your-ruby-application/
module IRB # :nodoc:
@@ -110,36 +241,55 @@ 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}."
if !wiki.exist? then
raise Gollum::InvalidGitRepositoryError
end
puts
puts 'Loaded Gollum wiki at:'
puts "#{File.expand_path(gollum_path).inspect}"
puts
puts 'Example API calls:'
puts %( page = wiki.page('page-name'))
puts %( # => <Gollum::Page>)
puts
puts %( page.raw_data)
puts %( # => "# My wiki page")
puts %( # => '# My wiki page')
puts
puts %( page.formatted_data)
puts %( # => "<h1>My wiki page</h1>")
puts %( # => '<h1>My wiki page</h1>')
puts
puts 'Full API documentation at:'
puts 'https://github.com/gollum/gollum-lib'
puts
puts "Check out the Gollum README for more."
IRB.start_session(binding)
rescue Grit::InvalidGitRepositoryError, Grit::NoSuchPathError
rescue Gollum::InvalidGitRepositoryError, Gollum::NoSuchPathError
puts "Invalid Gollum wiki at #{File.expand_path(gollum_path).inspect}"
exit 0
end
else
require 'gollum/frontend/app'
require 'gollum/app'
Precious::App.set(:environment, ENV.fetch('RACK_ENV', :production).to_sym)
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:wiki_options, wiki_options)
if cfg = options['config']
if cfg = options[:config]
# If the path begins with a '/' it will be considered an absolute path,
# otherwise it will be relative to the CWD
cfg = File.join(Dir.getwd, cfg) unless cfg.slice(0) == File::SEPARATOR
require cfg
end
Precious::App.run!(options)
base_path = wiki_options[:base_path]
if base_path.nil?
Precious::App.run!(options)
else
require 'rack'
# Rack::Handler does not work with Ctrl + C. Use Rack::Server instead.
Rack::Server.new(:app => Precious::MapGollum.new(base_path), :Port => options[:port], :Host => options[:bind]).start
end
end
+283
View File
@@ -0,0 +1,283 @@
#!/usr/bin/env ruby
#coding:utf-8
require 'optparse'
require 'pathname'
require 'rubygems'
wiki_options = {}
options = {}
migrate_options = {
:hyphenate => true
}
def setting(variable_name)
class_variable_name = :"@@#{variable_name.to_s}"
Object.class_variable_defined?(class_variable_name) &&
Object.class_variable_get(class_variable_name)
end
opts = OptionParser.new do |opts|
opts.banner = <<EOF
Use this tool to migrate a wiki repository created under Gollum versions 4.x or earlier to a 5.x compatibile repo.
It finds and repairs Gollum link tags that no longer work under 5.x for three reasons:
* 5.x wiki internal links may contain spaces. [[Bilbo Baggins]] and [[Bilbo-Baggins]] therefore link to distinct pages.
* 5.x wiki internal links are case senitive
* 5.x wiki internal links are no longer 'global'.
* NB: you can use the --lenient-tag-lookup option in gollum >= 5.x to enable 4.x-backwards compatible tags.
See https://github.com/gollum/gollum/wiki/5.0-release-notes#filename-handling for more information.
Usage of this script comes without any warranty.
Usage: gollum-migrate-tags /path/to/repo
NB: without the --write flag, this will be a 'dry run' that doesn't actually make any changes, but outputs the changes that would be made.
You can use the --page-file-dir and --config options as you would normally with gollum.
Requires a non-bare repository. Recommended usage:
1. Clone your wiki's repository to create a backup.
2. Run this script on your cloned repo.
3. If all looks sane, run the script with the --write option. This will overwrite files in your working directory, but not commit the changes, so you have time to review them.
4. Do a 'git diff' to inspect the changes.
5. Commit the changes if all looks sane, and push/pull them back into your original repo.
Options:
EOF
opts.on('-c', '--config [FILE]', 'Specify path to the Gollum\'s configuration file.') do |file|
options[:config] = file
end
opts.on('--page-file-dir [PATH]', 'Specify the subdirectory for all pages. Default: repository root.') do |path|
wiki_options[:page_file_dir] = path
end
opts.on('--prefer-relative-links', 'When specified, will try to replace broken links with relative links (\'[[Foo/Bar]]\' instead of \'[[/Subdir/Foo/Bar]]\') where possible.') do
migrate_options[:prefer_relative] = true
end
opts.on('--hyphenate', 'Default. Repair links that use spaces instead of hyphens: [[Bilbo Baggins]] -> [[Bilbo-Baggins]]') do
migrate_options[:hyphenate] = true
end
opts.on('--no-hyphenate', 'Turn off the --hyphenate option.') do
migrate_options[:hyphenate] = false
end
opts.on('--run-silent', 'Don\'t output anything.') do
migrate_options[:run_silent] = true
end
opts.on('--write', 'No dry run: actually perform the substitutions.') do
migrate_options[:no_dry_run] = true
end
end
# Read command line options into `options` hash
begin
opts.parse!
migrate_options.each do |setting, value|
variable_name = :"@@#{setting.to_s}"
unless Object.class_variable_defined?(variable_name)
Object.class_variable_set(variable_name, value)
end
end
wiki_options[:page_file_dir] = setting(:page_file_dir) ? setting(:page_file_dir) : wiki_options[:page_file_dir] # Allow settings :page_file_dir through PAGE_FILE_DIR constant.
rescue OptionParser::InvalidOption
puts "gollum-migrate-tags: #{$!.message}"
puts "gollum-migrate-tags: try 'gollum-migrate-tags --help' for more information"
exit
end
wiki_directory = ARGV[0] || Dir.pwd
require 'gollum-lib'
if cfg = options[:config]
# If the path begins with a '/' it will be considered an absolute path,
# otherwise it will be relative to the CWD
cfg = File.join(Dir.getwd, cfg) unless cfg.slice(0) == File::SEPARATOR
require cfg
end
class Gollum::Filter::CodeMigrator < Gollum::Filter::Code
def extract(data)
case @markup.format
when :asciidoc
data.gsub!(/^(\[source,([^\r\n]*)\]\n)?----\n(.+?)\n----$/m) do
cache_codeblock($~.to_s)
end
when :org
org_headers = %r{([ \t]*#\+HEADER[S]?:[^\r\n]*\n)*}
org_name = %r{([ \t]*#\+NAME:[^\r\n]*\n)?}
org_lang = %r{[ ]*([^\n \r]*)[ ]*[^\r\n]*}
org_begin = %r{([ \t]*)#\+BEGIN_SRC#{org_lang}\r?\n}
org_end = %r{\r?\n[ \t]*#\+END_SRC[ \t\r]*}
data.gsub!(/^#{org_headers}#{org_name}#{org_begin}(.+?)#{org_end}$/mi) do
cache_codeblock($~.to_s)
end
when :markdown
data.gsub!(/^([ ]{0,3})(~~~+) ?([^\r\n]+)?\r?\n(.+?)\r?\n[ ]{0,3}(~~~+)[ \t\r]*$/m) do
m_indent = Regexp.last_match[1]
m_start = Regexp.last_match[2] # ~~~
m_lang = Regexp.last_match[3]
m_code = Regexp.last_match[4]
m_end = Regexp.last_match[5] # ~~~
# The closing code fence must be at least as long as the opening fence
next '' if m_end.length < m_start.length
lang = m_lang ? m_lang.strip.split.first : nil
cache_codeblock($~.to_s)
end
end
data.gsub!(/^([ ]{0,3})``` ?([^\r\n]+)?\r?\n(.+?)\r?\n[ ]{0,3}```[ \t]*\r?$/m) do
cache_codeblock($~.to_s)
end
data
end
def process(data)
return data if data.nil? || data.size.zero? || @map.size.zero?
@map.each do |id, block| ## Just put the code blocks back in verbatim
data.gsub!(id, block)
end
data
end
def cache_codeblock(block)
id = "#{open_pattern}#{Digest::SHA1.hexdigest(block)}#{close_pattern}"
@map[id] = block
id
end
end
class ::Gollum::Filter::TagMigrator < Gollum::Filter::Tags
def process_tag(tag)
link_part, extra = parse_tag_parts(tag)
orig_tag = %{[[#{tag}]]}
return orig_tag if link_part.nil?
img_args = extra ? [extra, link_part] : [link_part]
mime = MIME::Types.type_for(::File.extname(img_args.first.to_s)).first
# For any kind of tag other than an internal link: just return the tag.
if tag =~ /^_TOC_/ || link_part =~ /^_$/ || link_part =~ /^#{INCLUDE_TAG}/ || (mime && mime.content_type =~ /^image/) || process_external_link_tag(link_part, extra) || process_file_link_tag(link_part, extra)
return orig_tag
end
# Try to resolve it as an internal Page link tag.
link = link_part
page = find_page_or_file_from_path(link)
anchor = nil
if page.nil? # No match yet, now try finding the page with anchor removed
if pos = link.rindex('#')
anchor = link[pos..-1]
link = link[0...pos]
end
if link.empty? && anchor # Internal anchor link, don't search for the page but return the original tag
return orig_tag
end
page = find_page_or_file_from_path(link)
end
if page
# Great, the link is not broken. Return the original tag.
return orig_tag
else
possibles = find_linked(link)
if possibles.empty?
log(:info, "Found no candidates for broken link: #{orig_tag}")
return orig_tag
else
if possibles.size > 1
log(:empty)
log(:warn, "Found multiple possibilities for the link '#{orig_tag}':")
possibles.map! {|p| Pathname.new(p)}
possibles.sort!
possibles.each{|p| log(:none, "* #{p}")}
log(:warn,"Picking #{possibles.first}")
log(:empty)
end
pick = possibles.first
return tag_for_pick(pick, orig_tag, extra, anchor, @markup.page.path)
end
end
end
private
def tag_for_pick(pick, orig_tag, extra, anchor, linking_page_path)
pick = if setting(:prefer_relative)
overlapping_path = Pathname.new(linking_page_path).dirname.to_s
overlapping_path = overlapping_path == '.' ? '' : ::File.join('/', overlapping_path)
relative_path = pick.to_s.match(/^#{overlapping_path}\/(.+)/)
relative_path ? relative_path[1] : pick
else
pick
end
new_tag = extra.nil? ? %{[[#{pick}#{anchor}]]} : %{[[#{extra}|#{pick}#{anchor}]]}
log(:info, "#{@markup.page.path}: Changing #{orig_tag} -> #{new_tag}")
new_tag
end
end
class ::Gollum::Filter::PlainTextMigrator < Gollum::Filter::PlainText
def extract(data)
data
end
end
filter_chain = [:PlainTextMigrator, :CodeMigrator, :TagMigrator]
wiki = ::Gollum::Wiki.new(wiki_directory, wiki_options.merge({:filter_chain => filter_chain}))
Object.class_variable_set(
:"@@wiki_tree",
wiki.tree_list(wiki.ref, true, true).map {|file| ::File.join('/', file.path)}
)
def find_linked(link)
link.gsub!(' ', '-') if setting(:hyphenate) # Match paths containing dashes instead of spaces
# If the link has no explicit file extension, test against the link + the '.' character.
# This is to avoid that 'Samwi' matches 'Samwise.md'
# If it has an explicit file extension ('Samwi.md'), just test against that.
test_path = ::File.extname(link).empty? ? /#{link}\..+/ : link
# Select pages from the wiki whose path =~ 'Foo/Bar/Samwi.*'
# Match case-insenstively to mimic 4.x behavior!
Object.class_variable_get(:"@@wiki_tree").select { |path|
path =~ /^\/(.*\/)?#{test_path}/i
}
end
def log(kind, msg = nil)
unless setting(:run_silent)
if kind == :none
puts msg
elsif kind == :empty
puts
else
puts "[#{kind.to_s.upcase}] #{msg}"
end
end
end
wiki.pages.each do |page|
log(:info,"Page #{page.path}")
new_data = page.formatted_data
if setting(:no_dry_run)
path = ::File.join(wiki.path, page.path)
f = File.new(path, 'w')
f.write(new_data)
f.close
end
log(:none, '====')
end
+11
View File
@@ -0,0 +1,11 @@
=begin
This file can be used to (e.g.):
- alter certain inner parts of Gollum,
- extend it with your stuff.
It is especially useful for customizing supported formats/markups. For more information and examples:
- https://github.com/gollum/gollum#config-file
=end
# enter your Ruby code here ...
+12
View File
@@ -0,0 +1,12 @@
=begin
You should use this file, if you wish to:
- launch Gollum as a Rack app,
- alter certain startup behaviour of Gollum.
For more information and examples:
- https://github.com/gollum/gollum/wiki/Gollum-via-Rack
- https://github.com/gollum/gollum#config-file
=end
# enter your Ruby code here ...
+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/env ruby
#
# Distributed under the terms of the MIT License.
#
# Author: Sam Baskinger <basking2@yahoo.com>
#
# Description: gollum-post is an example script that shows how
# to post a file to Gollum. This may be used
# to build scripts around CI/CD pipelines that
# publish their documentation to Gollum.
#
require 'uri'
require 'mechanize'
require 'digest'
GOLLUM=URI('https://mygollum.server')
m = Mechanize.new()
page="TestPage"
path="/automated/docs"
format="asciidoc"
content="""
= This is #{page}
This page is automatically generated.
"""
message='Posting current documentation.'
# Check if the page exists.
p = m.get("#{GOLLUM}#{path}/#{page}")
# If we were redirected to the creat page...
if p.uri.to_s =~ /\/gollum\/create/
# ... then create the page.
p = m.post("#{GOLLUM}/gollum/create",
'keybinding' => 'default',
'page' => page,
'path' => path,
'format' => 'asciidoc',
'message' => 'Publish bot.',
'content' => content)
else
# ... else, get the previous content and update it.
p = m.get("#{GOLLUM}/gollum/edit#{path}/#{page}")
# Get the previous content. You _could_ check if this is unchanged at this
# step and post nothing.
previous_content = p.xpath('//textarea[@id="gollum-editor-body"]')[0].text
# The previous ETag is the Git SHA-1. We need this to replace the previous contents.
prev_etag = Digest::SHA1.hexdigest("blob #{previous_content.length}\0#{previous_content}")
# Post the updated document using the ETag of the previous document to avoid collisions.
p = m.post("#{GOLLUM}/gollum/edit#{path}/#{page}",
'keybinding' => 'default',
'page' => page,
'path' => path,
'format' => 'asciidoc',
'message' => message,
'etag' => prev_etag,
'content' => content)
end
+3
View File
@@ -0,0 +1,3 @@
GOLLUM_USER=gollum
GOLLUM_BASE=/home/gollum/wiki
GOLLUM_OPTS="--config /home/gollum/config.rb"
+36
View File
@@ -0,0 +1,36 @@
#!/sbin/runscript
# Distributed under the terms of the MIT License
NAME=gollum
PID=/var/run/${NAME}.pid
EXEC=/usr/local/bin/gollum
LOG=/var/log/gollum.log
depend() {
need net
}
start() {
# Change log file to be owned by GOLLUM_USER
touch "${LOG}"
chown "${GOLLUM_USER}" "${LOG}"
ebegin "Starting Gollum"
start-stop-daemon --start \
--name "${NAME}" \
--user "${GOLLUM_USER}" \
--pidfile "${PID}" \
--make-pidfile --background \
--stderr "${LOG}" \
--exec "${EXEC}" -- $GOLLUM_OPTS "$GOLLUM_BASE"
eend $?
}
stop() {
ebegin "Stopping Gollum"
start-stop-daemon --stop \
--name "${NAME}" \
--user "${GOLLUM_USER}" \
--pidfile "${PID}"
eend $?
}
+12
View File
@@ -0,0 +1,12 @@
[Unit]
Description=Gollum wiki server
After=network.target
[Service]
Type=simple
User=%i
ExecStart=/usr/bin/gollum
Restart=on-abort
[Install]
WantedBy=multi-user.target
+79
View File
@@ -0,0 +1,79 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: gollum
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Start/stop gollum wiki
### END INIT INFO
# Distributed under the terms of the MIT License
set -e
# Edit these settings to your liking:
GOLLUM_USER=gollum
GOLLUM_BASE=/var/lib/gollum/.git
GOLLUM_OPTS="--bare"
NAME=gollum
PID=/var/run/${NAME}.pid
EXEC=/usr/local/bin/gollum
LOG=/var/log/gollum.log
. /lib/lsb/init-functions
start ()
{
# Change log file to be owned by GOLLUM_USER
touch "${LOG}"
chown "${GOLLUM_USER}" "${LOG}"
log_daemon_msg "Starting Gollum"
start-stop-daemon --start \
--name "${NAME}" \
--user "${GOLLUM_USER}" \
--chuid "${GOLLUM_USER}" \
--pidfile "${PID}" \
--make-pidfile --background \
--startas /bin/sh -- -c "exec ${EXEC} $GOLLUM_OPTS \"$GOLLUM_BASE\" > \"${LOG}\" 2>&1"
log_end_msg $?
}
stop ()
{
log_daemon_msg "Stopping Gollum"
start-stop-daemon --stop \
--user "${GOLLUM_USER}" \
--signal INT \
--pidfile "${PID}" \
--retry 10
log_end_msg $?
}
status ()
{
status_of_proc -p $PID $EXEC $NAME
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
log_success_msg "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
Executable
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
# Initialize the wiki
if [ ! -d .git ]; then
git init
fi
# Set git user.name and user.email
if [ ${GOLLUM_AUTHOR_USERNAME:+1} ]; then
git config user.name "${GOLLUM_AUTHOR_USERNAME}"
fi
if [ ${GOLLUM_AUTHOR_EMAIL:+1} ]; then
git config user.email "${GOLLUM_AUTHOR_EMAIL}"
fi
# Start gollum service
[[ "$@" != *--mathjax* ]] && echo "WARNING: Mathjax will soon be disabled by default. To explicitly enable it, use --mathjax" >&2
exec gollum $@ --mathjax
-32
View File
@@ -1,32 +0,0 @@
Sanitization Rules
==================
Gollum uses the [Sanitize](http://wonko.com/post/sanitize) gem for HTML
sanitization.
See `lib/gollum.rb` for actual settings.
## ALLOWED TAGS
a, abbr, acronym, address, area, b, big, blockquote, br, button, caption,
center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em,
fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, img, input, ins, kbd,
label, legend, li, map, menu, ol, optgroup, option, p, pre, q, s, samp,
select, small, span, strike, strong, sub, sup, table, tbody, td, textarea,
tfoot, th, thead, tr, tt, u, ul, var
## ALLOWED ATTRIBUTES
abbr, accept, accept-charset, accesskey, action, align, alt, axis, border,
cellpadding, cellspacing, char, charoff, charset, checked, cite, class, clear,
cols, colspan, color, compact, coords, datetime, dir, disabled, enctype, for,
frame, headers, height, href, hreflang, hspace, id, ismap, label, lang,
longdesc, maxlength, media, method, multiple, name, nohref, noshade, nowrap,
prompt, readonly, rel, rev, rows, rowspan, rules, scope, selected, shape,
size, span, src, start, summary, tabindex, target, title, type, usemap,
valign, value, vspace, width
## ALLOWED PROTOCOLS
a href: http, https, mailto
img src: http, https
+1213 -589
View File
File diff suppressed because it is too large Load Diff
+21 -28
View File
@@ -1,47 +1,40 @@
# ~*~ encoding: utf-8 ~*~
# stdlib
require 'digest/md5'
require 'digest/sha1'
require 'ostruct'
# external
require 'grit'
require 'i18n'
require 'github/markup'
require 'sanitize'
require 'rhino' if RUBY_PLATFORM == 'java'
# 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/file_view', __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/frontend/uri_encode_component', __FILE__)
require ::File.expand_path('../gollum/uri_encode_component', __FILE__)
module Gollum
VERSION = '2.1.9'
VERSION = '5.3.0'
::I18n.available_locales = [:en]
::I18n.load_path = Dir[::File.expand_path("lib/gollum/locales") + "/*.yml"]
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
class TemplateFilter
@@filters = {}
class DuplicatePageError < Error
attr_accessor :dir
attr_accessor :existing_path
attr_accessor :attempted_path
def self.add_filter(pattern, &replacement)
@@filters[pattern] = replacement
end
def initialize(dir, existing, attempted, message = nil)
@dir = dir
@existing_path = existing
@attempted_path = attempted
super(message || "Cannot write #{@dir}/#{@attempted_path}, found #{@dir}/#{@existing_path}.")
def self.apply_filters(wiki_page, data)
@@filters.each do |pattern, replacement|
params = replacement.parameters.length == 0 ? nil : wiki_page
data.gsub!(pattern, replacement.call(*params))
end
data
end
end
end
+733
View File
@@ -0,0 +1,733 @@
# encoding: UTF-8
require 'cgi'
require 'sinatra'
require 'sinatra/namespace'
require 'gollum-lib'
require 'mustache/sinatra'
require 'json'
require 'sprockets'
require 'sprockets-helpers'
require 'octicons'
require 'sass'
require 'pathname'
require 'gollum'
require 'gollum/assets'
require 'gollum/views/helpers'
require 'gollum/views/helpers/locale_helpers'
require 'gollum/views/layout'
require 'gollum/views/editable'
require 'gollum/views/has_page'
require 'gollum/views/has_user_icons'
require 'gollum/views/has_math'
require 'gollum/views/pagination'
require 'gollum/views/rss.rb'
require 'gollum/views/template_cascade'
require File.expand_path '../helpers', __FILE__
#required to upload bigger binary files
Gollum::set_git_timeout(120)
Gollum::set_git_max_filesize(190 * 10**6)
# 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
# For use with the --base-path option.
class MapGollum
def initialize(base_path)
@mg = Rack::Builder.new do
map "/#{base_path}" do
run Precious::App
end
map '/' do
run Proc.new { [302, { 'Location' => "/#{base_path}" }, []] }
end
map '/*' do
run Proc.new { [302, { 'Location' => "/#{base_path}" }, []] }
end
end
end
def call(env)
@mg.call(env)
end
end
class App < Sinatra::Base
register Mustache::Sinatra
register Sinatra::Namespace
include Precious::Helpers
Encoding.default_external = "UTF-8"
dir = File.dirname(File.expand_path(__FILE__))
set :sprockets, ::Precious::Assets.sprockets(dir)
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
@allow_editing = settings.wiki_options.fetch(:allow_editing, true)
@critic_markup = settings.wiki_options[:critic_markup]
@redirects_enabled = settings.wiki_options.fetch(:redirects_enabled, true)
@per_page_uploads = settings.wiki_options[:per_page_uploads]
@show_local_time = settings.wiki_options.fetch(:show_local_time, false)
@wiki_title = settings.wiki_options.fetch(:title, 'Gollum Wiki')
if settings.wiki_options[:template_dir]
Precious::Views::Layout.extend Precious::Views::TemplateCascade
Precious::Views::Layout.template_priority_path = settings.wiki_options[:template_dir]
end
@base_url = url('/', false).chomp('/').force_encoding('utf-8')
@page_dir = settings.wiki_options[:page_file_dir].to_s
# 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]
@mathjax_config = settings.wiki_options[:mathjax_config]
@mathjax = settings.wiki_options[:mathjax]
@use_static_assets = settings.wiki_options.fetch(:static, settings.environment != :development)
@static_assets_path = settings.wiki_options.fetch(:static_assets_path, ::File.join(File.dirname(__FILE__), 'public/assets'))
@mathjax_path = ::File.join(File.dirname(__FILE__), 'public/gollum/javascript/MathJax')
Sprockets::Helpers.configure do |config|
config.environment = settings.sprockets
config.environment.context_class.class_variable_set(:@@base_url, @base_url)
config.prefix = "#{@base_url}/#{Precious::Assets::ASSET_URL}"
config.digest = @use_static_assets
if @use_static_assets
config.public_path = @static_assets_path
config.manifest = Sprockets::Manifest.new(settings.sprockets, @static_assets_path)
end
end
forbid unless @allow_editing || request.request_method == 'GET'
end
get '/' do
redirect clean_url(::File.join(@base_url, wiki_new.index_page))
end
namespace '/gollum' do
get '/feed/' do
url = "#{env['rack.url_scheme']}://#{env['HTTP_HOST']}"
changes = wiki_new.latest_changes(::Gollum::Page.log_pagination_options(
per_page: settings.wiki_options.fetch(:pagination_count, 10),
page_num: 0)
)
content_type :rss
RSSView.new(@base_url, @wiki_title, url, changes).render
end
get '/assets/mathjax/*' do
env['PATH_INFO'].sub!('/gollum/assets/mathjax', '')
Rack::Static.new(not_found_proc, {:root => @mathjax_path, :urls => ['']}).call(env)
end
get '/assets/*' do
env['PATH_INFO'].sub!("/#{Precious::Assets::ASSET_URL}", '')
if @use_static_assets
env['PATH_INFO'].sub!(Sprockets::Helpers.prefix, '') if @base_url
Rack::Static.new(not_found_proc, {:root => @static_assets_path, :urls => ['']}).call(env)
else
settings.sprockets.call(env)
end
end
get '/last_commit_info' do
content_type :json
if page = wiki_page(params[:path]).page
version = page.last_version
authored_date = version.authored_date
authored_date = authored_date.utc.iso8601 if @show_local_time
{:author => version.author.name, :date => authored_date}.to_json
end
end
get '/emoji/:name' do
begin
[200, {'Content-Type' => 'image/png'}, emoji(params['name'])]
rescue ArgumentError
not_found
end
end
get '/data/*' do
if page = wiki_page(params[:splat].first).page
page.raw_data
end
end
get %r{/(edit|create)/(\.redirects.gollum|(custom|mathjax\.config)\.(js|css))} do
forbid('Changing this resource is not allowed.')
end
post %r{/(delete|rename|edit|create)/(\.redirects.gollum|(custom|mathjax\.config)\.(js|css))} do
forbid('Changing this resource is not allowed.')
end
post %r{/revert/(\.redirects.gollum|(custom|mathjax\.config\.)\.(js|css)/.*/.*)} do
forbid('Changing this resource is not allowed.')
end
get '/edit/*' do
forbid unless @allow_editing && @user_authed
wikip = wiki_page(params[:splat].first)
@name = wikip.fullname
@path = wikip.path
@upload_dest = find_upload_dest(wikip.fullpath)
wiki = wikip.wiki
@allow_uploads = wiki.allow_uploads
if page = wikip.page
@page = page
@content = page.text_data
@etag = page.sha
mustache :edit
else
path = ::File.join('gollum/create', @path, @name)
redirect to(clean_url(encodeURIComponent(path)))
end
end
# AJAX calls only
post '/upload_file' do
wiki = wiki_new
halt 405 unless wiki.allow_uploads
forbid unless @user_authed
if params[:file]
fullname = params[:file][:filename]
tempfile = params[:file][:tempfile]
end
halt 500 unless tempfile.is_a? Tempfile
if wiki.per_page_uploads
dir = request.referer.match(/^https?:\/\/#{request.host_with_port}\/(.*)/)[1]
# remove base path if it is set
dir.sub!(/^#{wiki.base_path}/, '') if wiki.base_path
# remove base_url and gollum/* subpath if necessary
dir.sub!(/^\/gollum\/[-\w]+\//, '')
# remove file extension
dir.sub!(/#{::File.extname(dir)}$/, '')
# revert escaped whitespaces
dir.gsub!(/%20/, ' ')
dir = ::File.join('uploads', dir)
else
# store all uploads together
dir = 'uploads'
end
halt 500 if dir.include?('..')
halt 500 unless Pathname(dir).relative?
ext = ::File.extname(fullname)
format = ext.split('.').last || 'txt'
filename = ::File.basename(fullname, ext)
contents = ::File.read(tempfile)
reponame = "#{dir}/#{filename}.#{format}"
options = { :message => "Uploaded file to #{reponame}" }
options[:parent] = wiki.repo.head.commit if wiki.repo.head
author = session['gollum.author']
unless author.nil?
options.merge! author
end
options[:normalize] = Gollum::Page.valid_extension?(fullname)
begin
wiki.write_file(reponame, contents, options)
redirect to(request.referer)
rescue Gollum::IllegalDirectoryPath => e
@message = e.message
mustache :error
rescue Gollum::DuplicatePageError
halt 409 # Signal conflict
end
end
post '/rename/*' do
wikip = wiki_page(params[:splat].first)
halt 500 if wikip.nil?
forbid unless @user_authed
wiki = wikip.wiki
page = wikip.page
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
# Renaming preserves format, so add the page's format to the renamed path to retrieve the renamed page
new_path = "#{rename}.#{Gollum::Page.format_to_ext(page.format)}"
# Add a redirect from the old page to the new
wiki.add_redirect(page.url_path, clean_url(new_path), commit) if @redirects_enabled
committer.commit
page = wiki_page(new_path).page
return if page.nil?
redirect to("/#{page.escaped_url_path}")
end
post '/edit/*' do
etag = params[:etag]
path = "/#{clean_url(sanitize_empty_params(params[:path]))}"
wiki = wiki_new
page = wiki.page(::File.join(path, params[:page]))
forbid unless @user_authed
return if page.nil?
if etag != page.sha
# Signal edit collision and return the page's most recent version
halt 412, {etag: page.sha, text_data: page.text_data}.to_json
end
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
end
post '/delete/*' do
forbid unless @allow_editing
forbid unless @user_authed
wiki = wiki_new
filepath = params[:splat].first
unless filepath.nil?
commit = commit_message
commit[:message] = "Deleted #{filepath}"
wiki.delete_file(filepath, commit)
end
end
get '/create/*' do
forbid unless @allow_editing
forbid unless @user_authed
wikip = wiki_page(params[:splat].first)
@name = wikip.name
@ext = wikip.ext
@path = wikip.path
@template_page = load_template(wikip, @path) if settings.wiki_options[:template_page]
@allow_uploads = wikip.wiki.allow_uploads
@upload_dest = find_upload_dest(wikip.fullpath)
page = wikip.page
if page
redirect to("/#{clean_url(page.escaped_url_path)}")
else
unless Gollum::Page.format_for("#{@name}#{@ext}")
@name = "#{@name}#{@ext}"
@ext = nil
end
mustache :create
end
end
post '/create' do
name = params[:page]
path = sanitize_empty_params(params[:path]) || ''
format = params[:format].intern
wiki = wiki_new
forbid unless @user_authed
path.gsub!(/^\//, '')
begin
wiki.write_page(::File.join(path, name), format, params[:content], commit_message)
redirect to("/#{clean_url(::File.join(encodeURIComponent(path), encodeURIComponent(wiki.page_file_name(name, format))))}")
rescue Gollum::DuplicatePageError, Gollum::IllegalDirectoryPath => e
@message = e.message
mustache :error
end
end
post '/revert/*/:sha1/:sha2' do
wikip = wiki_page(params[:splat].first)
@path = wikip.path
@name = wikip.fullname
wiki = wikip.wiki
@page = wikip.page
sha1 = params[:sha1]
sha2 = params[:sha2]
commit = commit_message
commit[:message] = "Revert commit #{sha2.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]
@diff = wiki.repo.diff(@versions.first, @versions.last, @page.path)
@message = 'The patch does not apply.'
mustache :compare
end
end
post '/preview' do
wiki = wiki_new
@name = params[:page] ? strip_page_name(params[:page]) : 'Preview'
@page = wiki.preview_page(@name, params[:content], params[:format])
['sidebar', 'header', 'footer'].each do |subpage|
@page.send("set_#{subpage}".to_sym, params[subpage]) if params[subpage]
end
@content = @page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@h1_title = wiki.h1_title
@editable = false
@bar_side = wiki.bar_side
@allow_uploads = false
@navbar = false
@preview = true
mustache :page
end
get %r{
/history/ # match any URL beginning with /history/
(.+?) # extract the full path (including any directories)
/
([0-9a-f]{40}) # match SHA
}x do |path, version|
wiki = wiki_new
show_history wiki_page(path, wiki.commit_for(version), wiki)
end
get '/history/*' do
show_history wiki_page(params[:splat].first)
end
get '/latest_changes' do
@wiki = wiki_new
@page_num = [params[:page_num].to_i, 1].max
@max_count = settings.wiki_options.fetch(:pagination_count, 10)
@versions = @wiki.latest_changes(::Gollum::Page.log_pagination_options(per_page: @max_count, page_num: @page_num))
mustache :latest_changes
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.fullname
@versions = [start_version, end_version]
wiki = wikip.wiki
@page = wikip.page
@diff = wiki.repo.diff(@versions.first, @versions.last, @page.path)
if @diff.empty?
@message = 'Could not compare these two revisions, no differences were found.'
mustache :error
else
mustache :compare
end
end
get '/compare/*' do
@file = clean_url(encodeURIComponent(params[:splat].first))
@versions = params[:versions] || []
if @versions.size == 1
wikip = wiki_page(params[:splat].first)
commit = wikip.wiki.repo.commit(@versions.first)
parent = commit.parent
if parent.nil?
redirect to("#{@file}/#{@commit.id}")
else
@versions.push(parent.id)
end
end
if @versions.empty?
redirect to("gollum/history/#{@file}")
else
redirect to("gollum/compare/%s/%s...%s" % [
@file,
@versions.last,
@versions.first]
)
end
end
get %r{
/commit/ # match any URL beginning with /show/
(\w+) # match the SHA1
}x do |version|
@version = version
wiki = wiki_new
begin
@commit = wiki.repo.commit(version)
parent = @commit.parent
parent_id = parent.nil? ? nil : parent.id
@diff = wiki.repo.diff(parent_id, version)
mustache :commit
rescue Gollum::Git::NoSuchShaFound
@message = "Invalid commit: #{@version}"
mustache :error
end
end
get '/search' do
@query = params[:q] || ''
@name = @query
if @query.empty?
@results = []
@search_terms = []
else
@page_num = [params[:page_num].to_i, 1].max
@max_count = 10
wiki = wiki_new
@results, @search_terms = wiki.search(@query)
end
mustache :search
end
get %r{
/overview # match any URL beginning with /overview
(?: # begin an optional non-capturing group
/(.+) # capture any path after the "/overview" excluding the leading slash
)? # end the optional non-capturing group
}x do |path|
wiki = wiki_new
@results = wiki.tree_list
if path
@path = Pathname.new(path).cleanpath.to_s
check_path = wiki.page_file_dir ? ::File.join(wiki.page_file_dir, @path, '/') : "#{@path}/"
@results.select! {|result| result.path.start_with?(check_path) }
end
@results.sort_by! {|result| result.name.downcase}
@ref = wiki.ref
@newable = true
mustache :overview
end
end # gollum namespace
get %r{/(.+?)/([0-9a-f]{40})} do
file_path = params[:captures][0]
version = params[:captures][1]
wikip = wiki_page(file_path, version)
name = wikip.fullname
path = wikip.path
if page = wikip.page
@page = page
@name = name
@content = page.formatted_data
@version = version
@historical = true
@bar_side = wikip.wiki.bar_side
@navbar = true
mustache :page
elsif file = wikip.wiki.file(file_path, version, true)
show_file(file)
else
halt 404
end
end
get '/\.redirects\.gollum' do
forbid('Accessing this resource is not allowed.')
end
get '/*' do
show_page_or_file(params[:splat].first)
end
private
def show_history(wikip)
@name = wikip.fullname
@page = wikip.page
@page_num = [params[:page_num].to_i, 1].max
@max_count = settings.wiki_options.fetch(:pagination_count, 10)
unless @page.nil?
@wiki = @page.wiki
@versions = @page.versions(
per_page: @max_count,
page_num: @page_num,
follow: settings.wiki_options.fetch(:follow_renames, true)
)
mustache :history
else
redirect to("/")
end
end
def folder_exists(path, wiki)
paths = wiki.tree_list
return paths.any? { |item| item.path.start_with?(path) }
end
def show_page(page, fullpath, wiki)
@page = page
@name = page.filename_stripped
@content = page.formatted_data
@upload_dest = find_upload_dest(Pathname.new(fullpath).cleanpath.to_s)
# Extensions and layout data
@editable = true
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@h1_title = wiki.h1_title
@bar_side = wiki.bar_side
@allow_uploads = wiki.allow_uploads
@navbar = true
return mustache :page
end
def show_page_or_file(fullpath)
wiki = wiki_new
if fullpath[-1] != '/' ? page = wiki.page(fullpath) : false
show_page(page, fullpath, wiki)
elsif page = wiki.page("#{fullpath}/#{wiki.index_page}")
show_page(page, fullpath, wiki)
elsif page = wiki.page("#{fullpath}/#{File.basename(fullpath)}")
show_page(page, fullpath, wiki)
elsif file = wiki.file(fullpath, wiki.ref, true)
show_file(file)
elsif @redirects_enabled && redirect_path = wiki.redirects[fullpath]
redirect to("#{encodeURIComponent(redirect_path)}?redirected_from=#{encodeURIComponent(fullpath)}")
elsif folder_exists(fullpath, wiki)
redirect to("/gollum/overview/#{clean_url(encodeURIComponent(fullpath))}")
else
if @allow_editing && @user_authed
path = fullpath[-1] == '/' ? "#{fullpath}#{wiki.index_page}" : fullpath # Append default index page if no page name is supplied
redirect to("/gollum/create/#{clean_url(encodeURIComponent(path))}")
else
@message = "The requested page does not exist."
status 404
return mustache :error
end
end
end
def show_file(file)
return unless file
if file.on_disk?
send_file file.on_disk_path, :disposition => 'inline'
else
content_type file.mime_type
file.raw_data
end
end
def load_template(wiki_page, path)
template_page = wiki_page(::File.join(path, '_Template')).page || wiki_page('/_Template').page
template_page ? Gollum::TemplateFilter.apply_filters(wiki_page, template_page.text_data) : nil
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
def wiki_page(path, version = nil, wiki = nil)
pathname = (Pathname.new('/') + path).cleanpath
wiki = wiki_new if wiki.nil?
OpenStruct.new(:wiki => wiki, :page => wiki.page(pathname.to_s, version = version),
:name => pathname.basename.sub_ext('').to_s, :path => pathname.dirname.to_s, :ext => pathname.extname, :fullname => pathname.basename.to_s, :fullpath => pathname.to_s)
end
def wiki_new
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
end
# 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
def find_upload_dest(path)
settings.wiki_options[:allow_uploads] ?
(settings.wiki_options[:per_page_uploads] ?
path : 'uploads'
) : ''
end
end
end
+29
View File
@@ -0,0 +1,29 @@
require 'octicons'
module Precious
module Assets
MANIFEST = %w(app.js editor.js app.css criticmarkup.css fileview.css ie7.css print.css *.png *.jpg *.svg *.eot *.ttf)
ASSET_URL = 'gollum/assets'
def self.sprockets(dir = File.dirname(File.expand_path(__FILE__)))
env = Sprockets::Environment.new
env.append_path ::File.join(dir, 'public/gollum/stylesheets/')
env.append_path ::File.join(dir, 'public/gollum/javascript')
env.append_path ::File.join(dir, 'public/gollum/images')
env.append_path ::File.join(dir, 'public/gollum/fonts')
env.js_compressor = :uglify unless Precious::App.development?
env.css_compressor = :scss
env.context_class.class_eval do
def base_url
self.class.class_variable_get(:@@base_url)
end
include ::Octicons
include ::Precious::Views::RouteHelpers
include ::Precious::Views::OcticonHelpers
end
env
end
end
end
-90
View File
@@ -1,90 +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
# Gets a File instance for this blob.
#
# wiki - Gollum::Wiki instance for the Gollum::File
#
# Returns a Gollum::File instance.
def file(wiki, commit)
blob = self.blob(wiki.repo)
file = wiki.file_class.new(wiki).populate(blob, self.dir)
file.version = commit
file
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
-231
View File
@@ -1,231 +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 / (@wiki.page_file_dir || '/')
tree = tree / dir unless tree.nil?
end
if tree
downpath = path.downcase.sub(/\.\w+$/, '')
tree.blobs.each do |blob|
next if page_path_scheduled_for_deletion?(index.tree, fullpath)
existing_file = blob.name.downcase.sub(/\.\w+$/, '')
existing_file_ext = ::File.extname(blob.name).sub(/^\./, '')
new_file_ext = ::File.extname(path).sub(/^\./, '')
if downpath == existing_file && !(allow_same_ext && new_file_ext == existing_file_ext)
raise DuplicatePageError.new(dir, blob.name, path)
end
end
end
fullpath = fullpath.force_encoding('ascii-8bit') if fullpath.respond_to?(:force_encoding)
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
path = path.force_encoding('ascii-8bit') if path.respond_to?(:force_encoding)
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)
args.map! { |item| item.respond_to?(:force_encoding) ? item.force_encoding('ascii-8bit') : item }
index.send(name, *args)
end
end
end
-77
View File
@@ -1,77 +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
alias filename name
# 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_accessor :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
# Populate the File with information from the Blob.
#
# blob - The Grit::Blob that contains the info.
# path - The String directory path of the file.
#
# Returns the populated Gollum::File.
def populate(blob, path=nil)
@blob = blob
@path = "#{path}/#{blob.name}"[1..-1]
self
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
-145
View File
@@ -1,145 +0,0 @@
module Gollum
=begin
FileView requires that:
- All files in root dir are processed first
- Then all the folders are sorted and processed
=end
class FileView
def initialize pages
@pages = pages
end
def enclose_tree string
%Q(<ol class="tree">\n) + string + %Q(</ol>)
end
def new_page page
name = page.name
url = url_for_page page
%Q( <li class="file"><a href="#{url}">#{name}</a></li>\n)
end
def new_folder folder_path
new_sub_folder folder_path
end
def new_sub_folder path
<<-HTML
<li>
<label>#{path}</label> <input type="checkbox" checked />
<ol>
HTML
end
def end_folder
<<-HTML
</ol>
</li>
HTML
end
def url_for_page page
url = ::File.join(::File.dirname(page.path), page.filename_stripped)
url = url[2..-1] if url[0,2] == './'
url
end
def render_files
html = ''
count = @pages.size
folder_start = -1
# Process all pages until folders start
count.times do | index |
page = @pages[ index ]
path = page.path
unless path.include? '/'
# Page processed (not contained in a folder)
html += new_page page
else
# Folders start at the next index
folder_start = index
break # Pages finished, move on to folders
end
end
# If there are no folders, then we're done.
return enclose_tree(html) if folder_start <= -1
# Handle special case of only one folder.
if (count - folder_start == 1)
page = @pages[ folder_start ]
name = page.name
url = url_for_page page
html += <<-HTML
<li>
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" checked />
<ol>
<li class="file"><a href="#{url}">#{name}</a></li>
</ol>
</li>
HTML
return enclose_tree html
end
sorted_folders = []
(folder_start).upto count - 1 do | index |
sorted_folders += [[ @pages[ index ].path, index ]]
end
# http://stackoverflow.com/questions/3482814/sorting-list-of-string-paths-in-vb-net
sorted_folders.sort! do |first,second|
a = first[0]
b = second[0]
# use :: operator because gollum defines its own conflicting File class
dir_compare = ::File.dirname(a) <=> ::File.dirname(b)
# Sort based on directory name unless they're equal (0) in
# which case sort based on file name.
if dir_compare == 0
::File.basename(a) <=> ::File.basename(b)
else
dir_compare
end
end
# keep track of folder depth, 0 = at root.
cwd_array = []
changed = false
# process rest of folders
(0...sorted_folders.size).each do | index |
page = @pages[ sorted_folders[ index ][ 1 ] ]
path = page.path
folder = ::File.dirname path
tmp_array = folder.split '/'
(0...tmp_array.size).each do | index |
if cwd_array[ index ].nil? || changed
html += new_sub_folder tmp_array[ index ]
next
end
if cwd_array[ index ] != tmp_array[ index ]
changed = true
(cwd_array.size - index).times do
html += end_folder
end
html += new_sub_folder tmp_array[ index ]
end
end
html += new_page page
cwd_array = tmp_array
changed = false
end
# return the completed html
enclose_tree html
end # end render_files
end # end FileView class
end # end Gollum module
-382
View File
@@ -1,382 +0,0 @@
require 'cgi'
require 'sinatra'
require 'gollum'
require 'mustache/sinatra'
require 'useragent'
require 'stringex'
require 'gollum/frontend/views/layout'
require 'gollum/frontend/views/editable'
require 'gollum/frontend/views/has_page'
require File.expand_path '../helpers', __FILE__
# Fix to_url
class String
alias :upstream_to_url :to_url
# _Header => header which causes errors
def to_url
return nil if self.nil?
return self if ['_Header', '_Footer', '_Sidebar'].include? self
upstream_to_url
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/frontend/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('/')
settings.wiki_options.merge!({ :base_path => @base_url }) unless settings.wiki_options.has_key? :base_path
end
get '/' do
redirect File.join(settings.wiki_options[:base_path].to_s, 'Home')
end
# Removes all slashes from the start of string.
def clean_url url
return url if url.nil?
url.gsub('%2F','/').gsub(/^\/+/,'')
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)
path = name if path.nil?
name = extract_name(name)
path = extract_path(path)
path = '/' if exact && path.nil?
wiki = wiki_new
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 '/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)
rename = params[:rename].to_url if params[:rename]
name = 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.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
page = wiki.page(rename) if rename
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 = wikip.page
if page
redirect to("/#{page.escaped_url_path}")
else
mustache :create
end
end
post '/create' do
name = params[:page].to_url
path = sanitize_empty_params(params[:path])
path = '' if path.nil?
format = params[:format].intern
# write_page is not directory aware so use wiki_options to emulate dir support.
wiki_options = settings.wiki_options.merge({ :page_file_dir => path })
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
begin
wiki.write_page(name, format, params[:content], commit_message)
redirect to("/#{clean_url(CGI.escape(::File.join(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
if wiki.revert_page(@page, sha1, sha2, commit_message)
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
@editable = false
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 '/_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
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
@editable = true
mustache :page
else
halt 404
end
end
get '/search' do
@query = params[:q]
wiki = wiki_new
@results = wiki.search @query
@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
@ref = wiki.ref
mustache :pages
end
get '/fileview' do
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@results = Gollum::FileView.new(wiki.pages).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)
name = extract_name(fullpath)
path = extract_path(fullpath)
wiki = wiki_new
path = '/' if path.nil?
if page = wiki.paged(name, path, exact = true)
@page = page
@name = name
@editable = true
@content = page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
mustache :page
elsif file = wiki.file(fullpath)
content_type file.mime_type
file.raw_data
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
def commit_message
{ :message => params[:message] }
end
end
end
-21
View File
@@ -1,21 +0,0 @@
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)
::File.basename(file_path)
end
def sanitize_empty_params(param)
[nil,''].include?(param) ? nil : CGI.unescape(param)
end
end
end
@@ -1,121 +0,0 @@
*, 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
{
background: url(../images/fileview/document.png) 0 0 no-repeat;
color: #fff;
padding-left: 21px;
text-decoration: none;
display: block;
}
li.file a[href *= '.pdf'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href *= '.html'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.css'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.js'] { 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 */ }
@@ -1,141 +0,0 @@
/* @control dialog */
#gollum-dialog-dialog {
display: block;
overflow: visible;
position: absolute;
top: 50%;
left: 50%;
}
#gollum-dialog-dialog.active {
display: block;
}
#gollum-dialog-dialog-inner {
margin: 0 0 0 -225px;
position: relative;
width: 450px;
border: 7px solid #999;
border: 7px solid rgba(0, 0, 0, 0.3);
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
#gollum-dialog-dialog-bg {
background-color: #fff;
overflow: hidden;
padding: 1em;
background: -webkit-gradient(linear, left top, left bottom, from(#f7f7f7), to(#ffffff));
background: -moz-linear-gradient(top, #f7f7f7, #ffffff);
}
#gollum-dialog-dialog-inner h4 {
border-bottom: 1px solid #ddd;
color: #000;
font-size: 1.8em;
line-height: normal;
font-weight: bold;
margin: 0 0 0.75em 0;
padding: 0 0 0.3em 0;
}
#gollum-dialog-dialog-body {
font-size: 1.2em;
line-height: 1.6em;
}
#gollum-dialog-dialog-body fieldset {
display: block;
border: 0;
margin: 0;
overflow: hidden;
padding: 0;
}
#gollum-dialog-dialog-body fieldset .field {
margin: 0 0 1.5em 0;
padding: 0;
}
#gollum-dialog-dialog-body fieldset .field label {
color: #000;
display: block;
font-size: 1.2em;
font-weight: bold;
line-height: 1.6em;
margin: 0;
padding: 0;
min-width: 80px;
}
#gollum-dialog-dialog-body fieldset .field input[type="text"] {
border: 1px solid #ddd;
display: block;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1.2em;
line-height: 1.6em;
margin: 0.3em 0 0 0;
padding: 0.3em 0.5em;
width: 96.5%;
}
#gollum-dialog-dialog-body fieldset .field input.code {
font-family: 'Monaco', 'Courier New', Courier, monospace;
}
#gollum-dialog-dialog-body fieldset .field:last-child {
margin: 0 0 1em 0;
}
#gollum-dialog-dialog-buttons {
border-top: 1px solid #ddd;
overflow: hidden;
margin: 1.5em 0 0 0;
padding: 1em 0 0 0;
}
#gollum-dialog-dialog a.minibutton {
float: right;
margin-right: 0.5em;
width: auto;
}
#gollum-dialog-dialog a.minibutton,
#gollum-dialog-dialog a.minibutton:visited {
background-color: #f7f7f7;
border: 1px solid #d4d4d4;
color: #333;
cursor: pointer;
display: block;
font-size: 1.2em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold;
margin: 0 0 0 0.8em;
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;
}
#gollum-dialog-dialog a.minibutton: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);
}
@@ -1,539 +0,0 @@
/*
editor.css
Wiki editor formatting
*/
a {
-moz-outline: none !important;
}
.jaws {
/* JAWS should see it, but you can't */
display: block;
height: 1px;
left: -5000px;
overflow: hidden;
position: absolute;
top: -5000px;
width: 1px;
}
#gollum-editor {
border: 1px solid #e4e4e4;
background: #f9f9f9;
margin: 1em 0 5em;
overflow: hidden;
padding: 1em 1em 0.4em;
border-radius: 1em;
-moz-border-radius: 1em;
-webkit-border-radius: 1em;
}
.ff #gollum-editor,
.ie #gollum-editor {
padding-bottom: 1em;
}
#gollum-editor form fieldset {
border: 0;
margin: 0;
padding: 0;
width: 100%;
}
#gollum-editor .singleline {
display: block;
margin: 0 0 0.7em 0;
overflow: hidden;
}
#gollum-editor .singleline input {
background: #fff;
border: 1px solid #ddd;
color: #000;
font-size: 1.1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.5em;
margin: 1em 0 0.4em;
padding: 0.5em;
width: 98%;
}
#gollum-editor .singleline input.ph {
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;
}
#gollum-editor-title-field.active {
border-bottom: 1px solid #ddd;
display: block;
margin: 0 0 0.3em 0;
padding: 0 0 0.5em 0;
}
#gollum-editor-title-field input#gollum-editor-page-title.ph {
color: #000;
}
/* @control editor-view-tab */
#gollum-editor #gollum-editor-type-switcher {
display: none;
}
/* @control function-bar */
#gollum-editor #gollum-editor-function-bar {
border-bottom: 1px solid #ddd;
overflow: hidden;
padding: 0;
}
#gollum-editor-title-field + #gollum-editor-function-bar {
margin-top: 0.6em;
}
#gollum-editor #gollum-editor-function-bar #gollum-editor-function-buttons {
display: none;
}
#gollum-editor #gollum-editor-function-bar.active #gollum-editor-function-buttons {
display: block;
float: left;
overflow: hidden;
padding: 0 0 1.1em 0;
}
#gollum-editor #gollum-editor-function-bar a.function-button {
background: #f7f7f7;
border: 1px solid #ddd;
color: #333;
display: block;
float: left;
height: 25px;
overflow: hidden;
margin: 0.2em 0.5em 0 0;
/* text-indent: -5000px; */
text-shadow: 0 1px 0 #fff;
width: 25px;
border-radius: 0.3em;
-moz-border-radius: 0.3em;
-webkit-border-radius: 0.3em;
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);
}
#gollum-editor #gollum-editor-function-bar a.function-button:hover {
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);
}
#gollum-editor #gollum-editor-function-bar a span {
background-image: url(../images/icon-sprite.png);
background-repeat: no-repeat;
display: block;
height: 25px;
overflow: hidden;
text-indent: -5000px;
width: 25px;
}
a#function-bold span { background-position: 0 0; }
a#function-italic span { background-position: -27px 0; }
a#function-underline span { background-position: -54px 0; }
a#function-code span { background-position: -82px 0; }
a#function-ul span { background-position: -109px 0; }
a#function-ol span { background-position: -136px 0; }
a#function-blockquote span { background-position: -163px 0; }
a#function-hr span { background-position: -190px 0; }
a#function-h1 span { background-position: -217px 0; }
a#function-h2 span { background-position: -244px 0; }
a#function-h3 span { background-position: -271px 0; }
a#function-link span { background-position: -298px 0; }
a#function-image span { background-position: -324px 0; }
a#function-help span { background-position: -405px 0; }
a#function-bold:hover span { background-position: 0 -28px; }
a#function-italic:hover span { background-position: -27px -28px; }
a#function-underline:hover span { background-position: -54px -28px; }
a#function-code:hover span { background-position: -82px -28px; }
a#function-ul:hover span { background-position: -109px -28px; }
a#function-ol:hover span { background-position: -136px -28px; }
a#function-blockquote:hover span { background-position: -163px -28px; }
a#function-hr:hover span { background-position: -190px -28px; }
a#function-h1:hover span { background-position: -217px -28px; }
a#function-h2:hover span { background-position: -244px -28px; }
a#function-h3:hover span { background-position: -271px -28px; }
a#function-link:hover span { background-position: -298px -28px; }
a#function-image:hover span { background-position: -324px -28px; }
a#function-help:hover span { background-position: -405px -28px; }
#gollum-editor #gollum-editor-function-bar a.disabled {
display: none;
}
#gollum-editor #gollum-editor-function-bar span.function-divider {
display: block;
float: left;
width: 0.5em;
}
#gollum-editor #gollum-editor-function-bar #gollum-editor-format-selector {
overflow: hidden;
padding: .2em 0 .5em 0;
}
#gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector select {
background-color: #f9f9f9;
border: 1px solid #ddd;
color: #333;
float: right;
font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold;
line-height: 1.6em;
padding: 0.3em 0.4em;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
}
#gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector label {
color: #999;
float: right;
font-size: 1em;
font-weight: bold;
line-height: 1.6em;
padding: .3em 0.5em 0 0;
}
#gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector label:after {
content: ':';
}
/* @section form-fields */
#gollum-editor textarea {
background: #fff;
border: 1px solid #ddd;
font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.4em;
margin: 1em 0 0.4em;
padding: 0.5em;
width: 98%;
height: 20em;
}
#gollum-editor input#gollum-editor-submit {
background-color: #f7f7f7;
border: 1px solid #d4d4d4;
color: #333;
cursor: pointer;
display: block;
float: left;
font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
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;
}
.webkit #gollum-editor input#gollum-editor-submit {
padding: 0.5em 1em 0.45em;
}
.ie #gollum-editor input#gollum-editor-submit {
padding: 0.4em 1em 0.5em;
}
#gollum-editor input#gollum-editor-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);
}
#gollum-editor .collapsed,
#gollum-editor .expanded {
border-bottom: 1px solid #ddd;
display: block;
overflow: hidden;
padding: 0.5em 0 0;
}
#gollum-editor #gollum-editor-body + .collapsed,
#gollum-editor #gollum-editor-body + .expanded {
border-top: 1px solid #ddd;
margin-top: 0.7em;
}
#gollum-editor .collapsed a.button,
#gollum-editor .expanded a.button {
background: #f7f7f7;
border: 1px solid #ddd;
color: #333;
display: block;
float: left;
height: 25px;
overflow: hidden;
margin: 0.2em 0.5em 0.75em 0;
text-shadow: 0 1px 0 #fff;
width: 25px;
border-radius: 0.3em;
-moz-border-radius: 0.3em;
-webkit-border-radius: 0.3em;
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);
}
#gollum-editor .collapsed h4,
#gollum-editor .expanded h4 {
font-size: 1.6em;
float: left;
margin: 0;
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 a.button:hover {
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);
}
#gollum-editor .collapsed a span,
#gollum-editor .expanded a span {
background-image: url(../images/icon-sprite.png);
background-position: -351px -1px;
background-repeat: no-repeat;
display: block;
height: 25px;
overflow: hidden;
text-indent: -5000px;
width: 25px;
}
#gollum-editor .collapsed a:hover span {
background-position: -351px -28px;
}
#gollum-editor .expanded a span {
background-position: -378px 0;
}
#gollum-editor .expanded a:hover span {
background-position: -378px -28px;
}
#gollum-editor .collapsed textarea {
display: none;
}
#gollum-editor .expanded textarea {
background-color: #fff;
border: 1px solid #ddd;
clear: both;
display: block;
font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
height: 7em;
line-height: 1.4em;
margin: 0.7em 0;
padding: 0.5em;
width: 98%;
}
/* @control minibutton */
#gollum-editor a.minibutton,
#gollum-editor a.minibutton:visited {
background-color: #f7f7f7;
border: 1px solid #d4d4d4;
color: #333;
cursor: pointer;
display: block;
font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold;
line-height: 1.2em;
margin: 0 0 0 0.8em;
padding: 0.5em 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;
}
#gollum-editor a.minibutton: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);
}
#gollum-editor #gollum-editor-preview {
float: left;
font-weight: normal;
padding: left;
}
/* @section help */
#gollum-editor-help {
margin: 0;
overflow: hidden;
padding: 0;
border: 1px solid #ddd;
border-width: 0 1px 1px 1px;
}
#gollum-editor-help-parent,
#gollum-editor-help-list {
display: block;
float: left;
height: 17em;
list-style-type: none;
overflow: auto;
margin: 0;
padding: 1em 0;
width: 18%;
}
#gollum-editor-help-parent {
border-right: 1px solid #eee;
}
#gollum-editor-help-list {
background: #fafafa;
border-right: 1px solid #eee;
}
#gollum-editor-help-parent li,
#gollum-editor-help-list li {
font-size: 1.2em;
line-height: 1.6em;
margin: 0;
padding: 0;
}
#gollum-editor-help-parent li a,
#gollum-editor-help-list li a {
border: 1px solid transparent;
border-width: 1px 0;
display: block;
font-weight: bold;
height: 100%;
width: auto;
padding: 0.2em 1em;
text-shadow: 0 -1px 0 #fff;
}
#gollum-editor-help-parent li a:hover,
#gollum-editor-help-list li a:hover {
background: #fff;
border-color: #f0f0f0;
text-decoration: none;
box-shadow: none;
}
#gollum-editor-help-parent li a.selected,
#gollum-editor-help-list li a.selected {
border: 1px solid #eee;
border-bottom-color: #e7e7e7;
border-width: 1px 0;
background: #fff;
color: #000;
box-shadow: 0 1px 2px #f0f0f0;
}
#gollum-editor-help-wrapper {
background: #fff;
overflow: auto;
height: 17em;
padding: 1em;
}
#gollum-editor-help-content {
font-size: 1.2em;
margin: 0 1em 0 0.5em;
padding: 0;
line-height: 1.8em;
}
#gollum-editor-help-content p {
margin: 0 0 1em 0;
padding: 0;
}
/* IE */
.ie #gollum-editor .singleline input {
padding-top: 0.25em;
padding-bottom: 0.75em;
}
@@ -1,716 +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 {
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 */
#wiki-body {
display: block;
float: left;
clear: left;
margin-right: 3%;
margin-bottom: 40px;
width: 100%;
}
.has-rightbar #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 rightbar */
#wiki-rightbar {
background-color: #f7f7f7;
border: 1px solid #ddd;
font-size: 13px;
float: right;
padding: 7px;
width: 25%;
color: #555;
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: 10px;
}
#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: "← ";
}
/* @section footer */
#wiki-footer {
clear: both;
margin: 2em 0 5em;
}
.has-rightbar #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;
}
@@ -1,69 +0,0 @@
/* IE7-specific styles */
.ie #head #searchbar #searchbar-fauxtext input#search-query {
border: 0;
float: left;
padding: 0.4em 0 0 0.5em;
}
.ie #head #searchbar #searchbar-fauxtext #search-submit span {
height: 2.25em;
}
#head #searchbar,
#head ul.actions {
margin: 1em 0 0 0;
}
ul.actions {
margin-left: 0;
}
.compare #footer ul.actions {
margin-top: 1em;
}
.compare div.data {
overflow: auto;
}
.history #version-form {
margin: -0.5em 0 -0.5em !important;
}
#gollum-editor {
padding-bottom: 0;
}
#gollum-editor-help-parent li a,
#gollum-editor-help-list li a {
height: auto;
}
#gollum-editor #gollum-editor-format-selector {
margin-top: 6px;
}
#gollum-editor .singleline input {
padding-top: 0.25em;
}
#gollum-editor .collapsed {
padding-bottom: 1.1em;
}
#gollum-editor #gollum-editor-submit {
padding: 0.5em 1em 0.3em !important;
}
#gollum-editor #gollum-editor-preview {
line-height: 1.3em;
}
#gollum-editor form {
margin: 0;
}
#gollum-editor #gollum-editor-format-selector label {
padding-top: 0.1em !important;
}
@@ -1,633 +0,0 @@
/*
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: 50px;
margin-bottom: 20px;
}
.markdown-body h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
margin-top: 40px;
margin-bottom: 20px;
}
.markdown-body h3 {
font-size: 18px;
margin-top: 30px;
margin-bottom: 15px;
}
.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 li,
.markdown-body table,
.markdown-body pre {
margin: 15px 0;
}
.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{
margin-top: 30px;
}
.markdown-body h2+h3{
margin-top: 10px;
}
.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.

Before

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

@@ -1,168 +0,0 @@
/**
* ASCIIDoc Language Definition
*
*/
(function($) {
var ASCIIDoc = {
'function-bold' : {
search: /(^[\n]+)([\n\s]*)/g,
replace: "*$1*$2"
},
'function-italic' : {
search: /(^[\n]+)([\n\s]*)/g,
replace: "_$1_$2"
},
'function-code' : {
search: /(^[\n]+)([\n\s]*)/g,
replace: "+$1+$2"
},
'function-ul' : {
search: /(^[\n]+)([\n\s]*)/g,
replace: "* $1$2"
},
'function-ol' : {
search: /(.+)([\n]?)/g,
replace: ". $1$2"
},
'function-blockquote' : {
search: /(.+)([\n]?)/g,
replace: "----\n$1$2\n----\n"
},
'function-link' : {
exec: function( txt, selText, $field ) {
var results = null;
$.GollumEditor.Dialog.init({
title: 'Insert Link',
fields: [
{
id: 'text',
name: 'Link Text',
type: 'text',
help: 'The text to display to the user.',
defaultValue: selText
},
{
id: 'href',
name: 'URL',
type: 'text',
help: 'The URL to link to.'
}
],
OK: function( res ) {
var h = '';
if ( res['text'] && res['href'] ) {
h = res['href'] + '[' +
res['text'] + ']';
}
$.GollumEditor.replaceSelection( h );
}
});
}
},
'function-image' : {
exec: function( txt, selText, $field ) {
var results = null;
$.GollumEditor.Dialog.init({
title: 'Insert Image',
fields: [
{
id: 'url',
name: 'Image URL',
type: 'text'
},
{
id: 'alt',
name: 'Alt Text',
type: 'text'
}
],
OK: function( res ) {
var h = '';
if ( res['url'] && res['alt'] ) {
h = 'image::' + res['url'] +
'[' + res['alt'] + ']';
}
$.GollumEditor.replaceSelection( h );
}
});
}
}
};
$.GollumEditor.defineLanguage('asciidoc', ASCIIDoc);
var ASCIIDocHelp = [
{
menuName: 'Text Formatting',
content: [
{
menuName: 'Headers',
data: '<p>ASCIIDoc headers can be written in two ways: with differing underlines or with different indentation using <code>=</code> (equals sign). ASCIIDoc supports headings 1-4. The editor will automatically use the <code>=</code> notation. To create a level one header, prefix your line with one <code>=</code>. Level two headers are created with <code>==</code> and so on.</p>'
},
{
menuName: 'Bold / Italic',
data: '<p>To display text as <strong>bold</strong>, wrap the text in <code>*</code> (asterisks). To display text as <em>italic</em>, wrap the text in <code>_</code> (underscores). To create <code>monospace</code> text, wrap the text in <code>+</code> (plus signs).'
},
{
menuName: 'Scripts',
data: '<p>Superscript and subscript is created the same way as other inline formats. To create superscript text, wrap your text in <code>^</code> (carats). To create subscript text, wrap your text in <code>~</code> (tildes).</p>'
},
{
menuName: 'Special Characters',
data: '<p>ASCIIDoc will automatically convert textual representations of commonly-used special characters. For example, <code>(R)</code> becomes &reg;, <code>(C)</code> becomes &copy; and <code>(TM)</code> becomes &trade;.</p>'
}
]
},
{
menuName: 'Blocks',
content: [
{
menuName: 'Paragraphs',
data: '<p>ASCIIDoc allows paragraphs to have optional titles or icons to denote special sections. To make a normal paragraph, simply add a line between blocks and a new paragraph will start. If you want to title your paragraphs, adda line prefixed by <code>.</code> (full stop). An example paragraph with optional title is displayed below:<br><br><code>.Optional Title<br><br>This is my paragraph. It is two sentences long.</code></p>'
},
{
menuName: 'Source Blocks',
data: '<p>To create source blocks (long blocks of code), follow the same syntax as above but with an extra line denoting the inline source and lines of four dashes (<code>----</code>) delimiting the source block.. An example of Python source is below:<br><br><code>.python.py<br>[source,python]<br>----<br># i just wrote a comment in python<br># and maybe one more<br>----</code></p>'
},
{
menuName: 'Comment Blocks',
data: '<p>Comment blocks are useful if you want to keep notes for yourself inline but do not want them displayed to the public. To create a comment block, simply wrap the paragraph in dividers with four slashes (<code>////</code>). An example comment block is below:<br><br><code>////<br>My comment block is here now<br><br>It can be multiple paragraphs. Really.<br>////</p>'
},
{
menuName: 'Quote Blocks',
data: '<p>Quote blocks work much like comment blocks &mdash; simply create dividers using four underscores (<code>____</code>) around your quote. An example quote block is displayed below:<br><code>____<br>This is my quote block. Quote something nice here, otherwise there is no point in quoting.<br>____</code></p>'
}
]
},
{
menuName: 'Macros',
content: [
{
menuName: 'Links',
data: '<p>To create links to external pages, you can simply write the URI if you want the URI to link to itself. (i.e., <code>http://github.com/</code> will automatically be parsed to <a href="javascript:void(0);">http://github.com/</a>. If you want different text to be displayed, simply append it to the end of the URI in between <code>[</code> (brackets.) For example, <code>http://github.com/[GitHub]</code> will be parsed as <a href="javascript:void(0);">GitHub</a>, with the URI pointing to <code>http://github.com</code>.</p>'
},
{
menuName: 'Images',
data: '<p>Images in ASCIIDoc work much like hyperlinks, but image URLs are prefixed with <code>image:</code>. For example, to link to an image at <code>images/icons/home.png</code>, write <code>image:images/icons/home.png</code>. Alt text can be added by appending the text to the URI in <code>[</code> (brackets).</p>'
}
]
}
];
$.GollumEditor.defineHelp('asciidoc', ASCIIDocHelp);
})(jQuery);
@@ -1,105 +0,0 @@
/**
* Creole Language Definition
*
*/
(function($) {
var Creole = {
'function-bold' : {
search: /([^\n]+)([\n]*)/gi,
replace: "**$1**$2"
},
'function-italic' : {
search: /([^\n]+)([\n]*)/gi,
replace: "//$1//$2"
},
'function-code' : {
search: /([^\n]+)([\n]*)/gi,
replace: "{{{$1}}}$2"
},
'function-hr' : {
append: "\n\n----\n\n"
},
'function-ul' : {
search: /(.+)([\n]?)/gi,
replace: "* $1$2"
},
/* This looks silly but is completely valid Markdown */
'function-ol' : {
search: /(.+)([\n]?)/gi,
replace: "# $1$2"
},
'function-link' : {
exec: function( txt, selText, $field ) {
var results = null;
$.GollumEditor.Dialog.init({
title: 'Insert Link',
fields: [
{
id: 'text',
name: 'Link Text',
type: 'text',
help: 'The text to display to the user.',
defaultValue: selText
},
{
id: 'href',
name: 'URL',
type: 'text',
help: 'The URL to link to.'
}
],
OK: function( res ) {
var h = '[[' + res['href'] + '|' +
res['text'] + ']]';
$.GollumEditor.replaceSelection( h );
}
});
}
},
'function-image' : {
exec: function( txt, selText, $field ) {
var results = null;
$.GollumEditor.Dialog.init({
title: 'Insert Image',
fields: [
{
id: 'url',
name: 'Image URL',
type: 'text'
},
{
id: 'alt',
name: 'Alt Text',
type: 'text'
}
],
OK: function( res ) {
var h = '';
if ( res['url'] && res['alt'] ) {
h = '{{' + res['url'];
if ( res['alt'] != '' ) {
h += '|' + res['alt'] + '}}';
}
}
$.GollumEditor.replaceSelection( h );
}
});
}
}
};
$.GollumEditor.defineLanguage('creole', Creole);
})(jQuery);
@@ -1,223 +0,0 @@
/**
* Markdown Language Definition
*
* A language definition for string manipulation operations, in this case
* for the Markdown, uh, markup language. Uses regexes for various functions
* by default. If regexes won't do and you need to do some serious
* manipulation, you can declare a function in the object instead.
*
* Code example:
* 'functionbar-id' : {
* exec: function(text, selectedText) {
* functionStuffHere();
* },
* search: /somesearchregex/gi,
* replace: 'replace text for RegExp.replace',
* append: "just add this where the cursor is"
* }
*
**/
(function($) {
var MarkDown = {
'function-bold' : {
search: /([^\n]+)([\n\s]*)/g,
replace: "**$1**$2"
},
'function-italic' : {
search: /([^\n]+)([\n\s]*)/g,
replace: "_$1_$2"
},
'function-code' : {
search: /([^\n]+)([\n\s]*)/g,
replace: "`$1`$2"
},
'function-hr' : {
append: "\n***\n"
},
'function-ul' : {
search: /(.+)([\n]?)/g,
replace: "* $1$2"
},
/* based on rdoc.js */
'function-ol' : {
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' : {
search: /(.+)([\n]?)/g,
replace: "> $1$2"
},
'function-h1' : {
search: /(.+)([\n]?)/g,
replace: "# $1$2"
},
'function-h2' : {
search: /(.+)([\n]?)/g,
replace: "## $1$2"
},
'function-h3' : {
search: /(.+)([\n]?)/g,
replace: "### $1$2"
},
'function-link' : {
exec: function( txt, selText, $field ) {
var results = null;
$.GollumEditor.Dialog.init({
title: 'Insert Link',
fields: [
{
id: 'text',
name: 'Link Text',
type: 'text',
defaultValue: selText
},
{
id: 'href',
name: 'URL',
type: 'text'
}
],
OK: function( res ) {
var rep = '';
if ( res['text'] && res['href'] ) {
rep = '[' + res['text'] + '](' +
res['href'] + ')';
}
$.GollumEditor.replaceSelection( rep );
}
});
}
},
'function-image' : {
exec: function( txt, selText, $field ) {
var results = null;
$.GollumEditor.Dialog.init({
title: 'Insert Image',
fields: [
{
id: 'url',
name: 'Image URL',
type: 'text'
},
{
id: 'alt',
name: 'Alt Text',
type: 'text'
}
],
OK: function( res ) {
var rep = '';
if ( res['url'] && res['alt'] ) {
rep = '![' + res['alt'] + ']' +
'(' + res['url'] + ')';
}
$.GollumEditor.replaceSelection( rep );
}
});
}
}
};
var MarkDownHelp = [
{
menuName: 'Block Elements',
content: [
{
menuName: 'Paragraphs &amp; Breaks',
data: '<p>To create a paragraph, simply create a block of text that is not separated by one or more blank lines. Blocks of text separated by one or more blank lines will be parsed as paragraphs.</p><p>If you want to create a line break, end a line with two or more spaces, then hit Return/Enter.</p>'
},
{
menuName: 'Headers',
data: '<p>Markdown supports two header formats. The wiki editor uses the &ldquo;atx&rsquo;-style headers. Simply prefix your header text with the number of <code>#</code> characters to specify heading depth. For example: <code># Header 1</code>, <code>## Header 2</code> and <code>### Header 3</code> will be progressively smaller headers. You may end your headers with any number of hashes.</p>'
},
{
menuName: 'Blockquotes',
data: '<p>Markdown creates blockquotes email-style by prefixing each line with the <code>&gt;</code>. This looks best if you decide to hard-wrap text and prefix each line with a <code>&gt;</code> character, but Markdown supports just putting <code>&gt;</code> before your paragraph.</p>'
},
{
menuName: 'Lists',
data: '<p>Markdown supports both ordered and unordered lists. To create an ordered list, simply prefix each line with a number (any number will do &mdash; this is why the editor only uses one number.) To create an unordered list, you can prefix each line with <code>*</code>, <code>+</code> or <code>-</code>.</p> List items can contain multiple paragraphs, however each paragraph must be indented by at least 4 spaces or a tab.'
},
{
menuName: 'Code Blocks',
data: '<p>Markdown wraps code blocks in pre-formatted tags to preserve indentation in your code blocks. To create a code block, indent the entire block by at least 4 spaces or one tab. Markdown will strip the extra indentation you&rsquo;ve added to the code block.</p>'
},
{
menuName: 'Horizontal Rules',
data: 'Horizontal rules are created by placing three or more hyphens, asterisks or underscores on a line by themselves. Spaces are allowed between the hyphens, asterisks or underscores.'
}
]
},
{
menuName: 'Span Elements',
content: [
{
menuName: 'Links',
data: '<p>Markdown has two types of links: <strong>inline</strong> and <strong>reference</strong>. For both types of links, the text you want to display to the user is placed in square brackets. For example, if you want your link to display the text &ldquo;GitHub&rdquo;, you write <code>[GitHub]</code>.</p><p>To create an inline link, create a set of parentheses immediately after the brackets and write your URL within the parentheses. (e.g., <code>[GitHub](http://github.com/)</code>). Relative paths are allowed in inline links.</p><p>To create a reference link, use two sets of square brackets. <code>[my internal link][internal-ref]</code> will link to the internal reference <code>internal-ref</code>.</p>'
},
{
menuName: 'Emphasis',
data: '<p>Asterisks (<code>*</code>) and underscores (<code>_</code>) are treated as emphasis and are wrapped with an <code>&lt;em&gt;</code> tag, which usually displays as italics in most browsers. Double asterisks (<code>**</code>) or double underscores (<code>__</code>) are treated as bold using the <code>&lt;strong&gt;</code> tag. To create italic or bold text, simply wrap your words in single/double asterisks/underscores. For example, <code>**My double emphasis text**</code> becomes <strong>My double emphasis text</strong>, and <code>*My single emphasis text*</code> becomes <em>My single emphasis text</em>.</p>'
},
{
menuName: 'Code',
data: '<p>To create inline spans of code, simply wrap the code in backticks (<code>`</code>). Markdown will turn <code>`myFunction`</code> into <code>myFunction</code>.</p>'
},
{
menuName: 'Images',
data: '<p>Markdown image syntax looks a lot like the syntax for links; it is essentially the same syntax preceded by an exclamation point (<code>!</code>). For example, if you want to link to an image at <code>http://github.com/unicorn.png</code> with the alternate text <code>My Unicorn</code>, you would write <code>![My Unicorn](http://github.com/unicorn.png)</code>.</p>'
}
]
},
{
menuName: 'Miscellaneous',
content: [
{
menuName: 'Automatic Links',
data: '<p>If you want to create a link that displays the actual URL, markdown allows you to quickly wrap the URL in <code>&lt;</code> and <code>&gt;</code> to do so. For example, the link <a href="javascript:void(0);">http://github.com/</a> is easily produced by writing <code>&lt;http://github.com/&gt;</code>.</p>'
},
{
menuName: 'Escaping',
data: '<p>If you want to use a special Markdown character in your document (such as displaying literal asterisks), you can escape the character with the backslash (<code>\\</code>). Markdown will ignore the character directly after a backslash.'
}
]
}
];
$.GollumEditor.defineLanguage('markdown', MarkDown);
$.GollumEditor.defineHelp('markdown', MarkDownHelp);
})(jQuery);
@@ -1,74 +0,0 @@
/**
* Markdown Language Definition
*
* A language definition for string manipulation operations, in this case
* for the Markdown, uh, markup language. Uses regexes for various functions
* by default. If regexes won't do and you need to do some serious
* manipulation, you can declare a function in the object instead.
*
* Code example:
* 'functionbar-id' : {
* exec: function(text, selectedText) {
* functionStuffHere();
* },
* search: /somesearchregex/gi,
* replace: 'replace text for RegExp.replace',
* append: "just add this where the cursor is"
* }
*
**/
(function($) {
var RDoc = {
'function-bold' : {
search: /([^\n]+)([\n\s]*)/g,
replace: "((*$1*))$2"
},
'function-code' : {
search: /([^\n]+)([\n\s]*)/g,
replace: "(({$1}))$2"
},
'function-ul' : {
search: /(.+)([\n]?)/gi,
replace: "* $1$2"
},
'function-ol' : {
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];
}
}
$.GollumEditor.replaceSelection( repText );
}
},
'function-h1' : {
search: /(.+)([\n]?)/gi,
replace: "= $1$2"
},
'function-h2' : {
search: /(.+)([\n]?)/gi,
replace: "== $1$2"
},
'function-h3' : {
search: /(.+)([\n]?)/gi,
replace: "=== $1$2"
}
};
$.GollumEditor.defineLanguage('rdoc', RDoc);
})(jQuery);
@@ -1,215 +0,0 @@
// ua
$(document).ready(function() {
$('#delete-link').click( function(e) {
var ok = confirm($(this).data('confirm'));
if ( ok ) {
var loc = window.location;
loc = baseUrl + '/delete' + loc.pathname.replace(baseUrl,'');
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-rename-page').length) {
$('#minibutton-rename-page').removeClass('jaws');
$('#minibutton-rename-page').click(function(e) {
e.preventDefault();
// Path name without the leading slash.
var pathname = window.location.pathname.substr(1);
var slashIndex = pathname.lastIndexOf('/');
var oldName = pathname.substr(slashIndex + 1)
var path = pathname.substr(0, slashIndex);
$.GollumDialog.init({
title: 'Rename Page',
fields: [
{
id: 'name',
name: 'Rename to',
type: 'text',
defaultValue: oldName || ''
}
],
OK: function( res ) {
var newName = 'Rename Page';
if ( res['name'] ) {
newName = res['name'];
}
var msg = 'Renamed ' + oldName + ' to ' + newName;
jQuery.ajax( {
type: 'POST',
url: baseUrl + '/edit/' + oldName,
data: { path: path, rename: newName, page: oldName, message: msg },
success: function() {
window.location = baseUrl + '/' + encodeURIComponent(newName);
}
});
}
});
});
}
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',
defaultValue: ''
}
],
OK: function( res ) {
var name = 'New Page';
if ( res['name'] ) {
name = res['name'];
}
window.location = baseUrl + '/' + encodeURIComponent(name);
}
});
});
}
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();
});
}
});
@@ -1,123 +0,0 @@
/*
* jQuery Color Animations
* Copyright 2007 John Resig
* Released under the MIT and GPL licenses.
*/
(function(jQuery){
// We override the animation for all of these color styles
jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
jQuery.fx.step[attr] = function(fx){
if ( fx.state == 0 ) {
fx.start = getColor( fx.elem, attr );
fx.end = getRGB( fx.end );
}
fx.elem.style[attr] = "rgb(" + [
Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
].join(",") + ")";
}
});
// Color Conversion functions from highlightFade
// By Blair Mitchelmore
// http://jquery.offput.ca/highlightFade/
// Parse strings looking for color tuples [255,255,255]
function getRGB(color) {
var result;
// Check if we're already dealing with an array of colors
if ( color && color.constructor == Array && color.length == 3 )
return color;
// Look for rgb(num,num,num)
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
// Look for rgb(num%,num%,num%)
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
// Look for #a0b1c2
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
// Look for #fff
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
// Otherwise, we're most likely dealing with a named color
return colors[jQuery.trim(color).toLowerCase()];
}
function getColor(elem, attr) {
var color;
do {
color = jQuery.curCSS(elem, attr);
// Keep going until we find an element that has color, or we hit the body
if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
break;
attr = "backgroundColor";
} while ( elem = elem.parentNode );
return getRGB(color);
};
// Some named colors to work with
// From Interface by Stefan Petre
// http://interface.eyecon.ro/
var colors = {
aqua:[0,255,255],
azure:[240,255,255],
beige:[245,245,220],
black:[0,0,0],
blue:[0,0,255],
brown:[165,42,42],
cyan:[0,255,255],
darkblue:[0,0,139],
darkcyan:[0,139,139],
darkgrey:[169,169,169],
darkgreen:[0,100,0],
darkkhaki:[189,183,107],
darkmagenta:[139,0,139],
darkolivegreen:[85,107,47],
darkorange:[255,140,0],
darkorchid:[153,50,204],
darkred:[139,0,0],
darksalmon:[233,150,122],
darkviolet:[148,0,211],
fuchsia:[255,0,255],
gold:[255,215,0],
green:[0,128,0],
indigo:[75,0,130],
khaki:[240,230,140],
lightblue:[173,216,230],
lightcyan:[224,255,255],
lightgreen:[144,238,144],
lightgrey:[211,211,211],
lightpink:[255,182,193],
lightyellow:[255,255,224],
lime:[0,255,0],
magenta:[255,0,255],
maroon:[128,0,0],
navy:[0,0,128],
olive:[128,128,0],
orange:[255,165,0],
pink:[255,192,203],
purple:[128,0,128],
violet:[128,0,128],
red:[255,0,0],
silver:[192,192,192],
white:[255,255,255],
yellow:[255,255,0]
};
})(jQuery);
@@ -1,8 +0,0 @@
/* 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={}}}}();
@@ -1,132 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

@@ -1,49 +0,0 @@
<!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='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>
<!--<script>(function(d,j){
j = d.createElement('script');
j.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
(d.head || d.getElementsByTagName('head')[0]).appendChild(j);
}(document));
</script>-->
</body>
</html>
@@ -1,103 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Skywriter.
*
* The Initial Developer of the Original Code is
* Mozilla.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Kevin Dangoor (kdangoor@mozilla.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* class Ace
*
* The main class required to set up an Ace instance in the browser.
*
*
**/
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("./keyboard/state_handler");
require("./placeholder");
exports.config = require("./config");
/**
* Ace.edit(el) -> Editor
* - el (String | DOMElement): Either the id of an element, or the element itself
*
* This method embeds the Ace editor into the DOM, at the element provided by `el`.
*
**/
exports.edit = function(el) {
if (typeof(el) == "string") {
el = document.getElementById(el);
}
if (el.env && el.env.editor instanceof Editor)
return el.env.editor;
var doc = new EditSession(Dom.getInnerText(el));
doc.setUndoManager(new UndoManager());
el.innerHTML = '';
var editor = new Editor(new Renderer(el, require("./theme/textmate")));
new MultiSelect(editor);
editor.setSession(doc);
var env = {};
env.document = doc;
env.editor = editor;
editor.resize();
Event.addListener(window, "resize", function() {
editor.resize();
});
el.env = env;
// Store env on editor such that it can be accessed later on from
// the returned object.
editor.env = env;
return editor;
};
});
@@ -1,254 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("./lib/oop");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
/**
* class Anchor
*
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated
*
**/
/**
* new Anchor(doc, row, column)
* - doc (Document): The document to associate with the anchor
* - row (Number): The starting row position
* - column (Number): The starting column position
*
* Creates a new `Anchor` and associates it with a document.
*
**/
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);
/**
* Anchor.getPosition() -> Object
*
* Returns an object identifying the `row` and `column` position of the current anchor.
*
**/
this.getPosition = function() {
return this.$clipPositionToDocument(this.row, this.column);
};
/**
* Anchor.getDocument() -> Document
*
* Returns the current document.
*
**/
this.getDocument = function() {
return this.document;
};
/**
* Anchor@onChange(e)
* - e (Event): Contains data about the event
*
* Fires whenever the anchor position changes. Events that can trigger this function include `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
*
**/
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);
};
/**
* Anchor.setPosition(row, column, noClip)
* - row (Number): The row index to move the anchor to
* - column (Number): The column index to move the anchor to
* - noClip (Boolean): Identifies if you want the position to be clipped
*
* Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not 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
});
};
/**
* Anchor.detach()
*
* When called, the `'change'` event listener is removed.
*
**/
this.detach = function() {
this.document.removeEventListener("change", this.$onChange);
};
/** internal, hide
* Anchor.clipPositionToDocument(row, column)
* - row (Number): The row index to clip the anchor to
* - column (Number): The column index to clip the anchor to
*
* Clips the anchor position to the specified row and column.
*
**/
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);
});
@@ -1,184 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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()
}
@@ -1,261 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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;
/**
* class BackgroundTokenizer
*
* 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.
*
**/
/**
* new BackgroundTokenizer(tokenizer, editor)
* - tokenizer (Tokenizer): The tokenizer to use
* - editor (Editor): The editor to associate with
*
* Creates a new `BackgroundTokenizer` object.
*
*
**/
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);
/**
* BackgroundTokenizer.setTokenizer(tokenizer)
* - tokenizer (Tokenizer): The new tokenizer to use
*
* Sets a new tokenizer for this object.
*
**/
this.setTokenizer = function(tokenizer) {
this.tokenizer = tokenizer;
this.lines = [];
this.states = [];
this.start(0);
};
/**
* BackgroundTokenizer.setDocument(doc)
* - doc (Document): The new document to associate with
*
* Sets a new document to associate with this object.
*
**/
this.setDocument = function(doc) {
this.doc = doc;
this.lines = [];
this.states = [];
this.stop();
};
/**
* BackgroundTokenizer.fireUpdateEvent(firstRow, lastRow)
* - firstRow (Number): The starting row region
* - lastRow (Number): The final row region
*
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
*
**/
this.fireUpdateEvent = function(firstRow, lastRow) {
var data = {
first: firstRow,
last: lastRow
};
this._emit("update", {data: data});
};
/**
* BackgroundTokenizer.start(startRow)
* - startRow (Number): The row to start at
*
* Starts tokenizing at the row indicated.
*
**/
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);
};
/**
* BackgroundTokenizer.stop()
*
* Stops tokenizing.
*
**/
this.stop = function() {
if (this.running)
clearTimeout(this.running);
this.running = false;
};
/** related to: BackgroundTokenizer.$tokenizeRows
* BackgroundTokenizer.getTokens(firstRow, lastRow) -> [Object]
* - firstRow (Number): The row to start at
* - lastRow (Number): The row to finish at
*
* Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
*
**/
this.getTokens = function(row) {
return this.lines[row] || this.$tokenizeRow(row);
};
/**
* BackgroundTokenizer.getState(row) -> String
* - row (Number): The row to start at
*
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
**/
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;
});
@@ -1,92 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Harutyun Amirjanyan <harutyun@c9.io>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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()
}
@@ -1,121 +0,0 @@
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)
* - platform (String): Identifier for the platform; must be either `'mac'` or `'win'`
* - commands (Array): A list of commands
*
* TODO
*
*
**/
var CommandManager = function(platform, commands) {
this.platform = platform;
this.commands = {};
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() {
if (this.$inReplay)
return;
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();
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;
});
@@ -1,193 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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();
},
replay: function(editor) {
editor.cm.replay();
},
cm1: function(editor, arg) {
called += "1" + (arg || "");
},
cm2: function(editor) {
called += "2";
}
});
this.cm.exec("togglerecording", this);
assert.ok(this.cm.recording);
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() {
var called = "";
this.cm.addCommands({
cm1: function(editor, arg) {
called += "1" + (arg || "");
},
cm2: function(editor) {
called += "2";
}
});
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);
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
}
@@ -1,460 +0,0 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* Julian Viereck <julian.viereck@gmail.com>
* Mihai Sucan <mihai.sucan@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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(); },
readOnly: true
}, {
name: "gotostart",
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
exec: function(editor) { editor.navigateFileStart(); },
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(); },
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-P"),
exec: function(editor) { editor.jumpToMatching(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selecttomatching",
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
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: "togglecomment",
bindKey: bindKey("Ctrl-/", "Command-/"),
exec: function(editor) { editor.toggleCommentLines(); },
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"
}];
});
@@ -1,101 +0,0 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Harutyun Amirjanyan <amirjanyan AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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-Shift-L", mac: "Ctrl-Shift-L"},
readonly: true
}];
// commands active 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);
});
@@ -1,124 +0,0 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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: "",
modePath: "",
themePath: "",
suffix: ".js"
};
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.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(); });
}
});
Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

@@ -1,327 +0,0 @@
.ace_editor {
position: absolute;
overflow: hidden;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Droid Sans Mono', 'Consolas', monospace;
font-size: 12px;
}
.ace_scroller {
position: absolute;
overflow: hidden;
}
.ace_content {
position: absolute;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
cursor: text;
}
.ace_gutter {
position: absolute;
overflow : hidden;
height: 100%;
width: auto;
cursor: default;
z-index: 4;
}
.ace_scroller.horscroll {
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
}
.ace_gutter-cell {
padding-left: 19px;
padding-right: 6px;
}
.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-repeat: no-repeat;
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_editor .ace_sb {
position: absolute;
overflow-x: hidden;
overflow-y: scroll;
right: 0;
}
.ace_editor .ace_sb div {
position: absolute;
width: 1px;
left: 0;
}
.ace_editor .ace_print_margin_layer {
z-index: 0;
position: absolute;
overflow: hidden;
margin: 0;
left: 0;
height: 100%;
width: 100%;
}
.ace_editor .ace_print_margin {
position: absolute;
height: 100%;
}
.ace_editor > textarea {
position: absolute;
z-index: 0;
width: 0.5em;
height: 1em;
opacity: 0;
background: transparent;
appearance: none;
-moz-appearance: none;
border: none;
resize: none;
outline: none;
overflow: hidden;
}
.ace_editor > textarea.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%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-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 .ace_layer {
position: relative;
min-width: 40px;
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;
}
.ace_cursor.ace_hidden {
opacity: 0.2;
}
.ace_editor.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;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.ace_line .ace_fold {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-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_dragging .ace_content {
cursor: move;
}
.ace_folding-enabled > .ace_gutter-cell {
padding-right: 13px;
}
.ace_fold-widget {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
margin: 0 -12px 1px 1px;
display: inline-block;
height: 14px;
width: 11px;
vertical-align: text-bottom;
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 4px;
border-radius: 3px;
border: 1px solid transparent;
}
.ace_fold-widget.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.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);
background-position: center 4px;
}
.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.end {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget.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.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;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 B

@@ -1,617 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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;
/**
* class Document
*
* Contains the text of the document. Documents are controlled by a single [[EditSession `EditSession`]]. At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
*
*
**/
/**
* new Document([text])
* - text (String | Array): The starting text
*
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
*
**/
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);
/**
* Document.setValue(text) -> Void
* - text (String): The text to use
*
* Replaces all the lines in the current `Document` with the value of `text`.
**/
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);
};
/**
* Document.getValue() -> String
*
* 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());
};
/**
* Document.createAnchor(row, column) -> Anchor
* - row (Number): The row number to use
* - column (Number): The column number to use
*
* Creates a new `Anchor` to define a floating point in the document.
**/
this.createAnchor = function(row, column) {
return new Anchor(this, row, column);
};
/** internal, hide
* Document.$split(text) -> [String]
* - text (String): The text to work with
* + ([String]): A String array, with each index containing a piece of the original `text` string.
*
* Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
*
*
**/
// 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/);
};
/** internal, hide
* Document.$detectNewLine(text) -> Void
*
*
**/
this.$detectNewLine = function(text) {
var match = text.match(/^.*?(\r\n|\r|\n)/m);
if (match) {
this.$autoNewLine = match[1];
} else {
this.$autoNewLine = "\n";
}
};
/**
* Document.getNewLineCharacter() -> String
* + (String): If `newLineMode == windows`, `\r\n` is returned.<br/>
* If `newLineMode == unix`, `\n` is returned.<br/>
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
*
* Returns the newline character that's being used, depending on the value of `newLineMode`.
*
*
*
**/
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";
/**
* Document.setNewLineMode(newLineMode) -> Void
* - newLineMode(String): [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
*
* [Sets the new line mode.]{: #Document.setNewLineMode.desc}
**/
this.setNewLineMode = function(newLineMode) {
if (this.$newLineMode === newLineMode)
return;
this.$newLineMode = newLineMode;
};
/**
* Document.getNewLineMode() -> String
*
* [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode}
*
**/
this.getNewLineMode = function() {
return this.$newLineMode;
};
/**
* Document.isNewLine(text) -> Boolean
* - text (String): The text to check
*
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
*
**/
this.isNewLine = function(text) {
return (text == "\r\n" || text == "\r" || text == "\n");
};
/**
* Document.getLine(row) -> String
* - row (Number): The row index to retrieve
*
* Returns a verbatim copy of the given line as it is in the document
*
**/
this.getLine = function(row) {
return this.$lines[row] || "";
};
/**
* Document.getLines(firstRow, lastRow) -> [String]
* - firstRow (Number): The first row index to retrieve
* - lastRow (Number): The final row index to retrieve
*
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
*
**/
this.getLines = function(firstRow, lastRow) {
return this.$lines.slice(firstRow, lastRow + 1);
};
/**
* Document.getAllLines() -> [String]
*
* 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());
};
/**
* Document.getLength() -> Number
*
* Returns the number of rows in the document.
**/
this.getLength = function() {
return this.$lines.length;
};
/**
* Document.getTextRange(range) -> String
* - range (Range): The range to work with
*
* [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
**/
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());
}
};
/** internal, hide
* Document.$clipPosition(position) -> Number
*
*
**/
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;
};
/**
* Document.insert(position, text) -> Number
* - position (Number): The position to start inserting at
* - text (String): A chunk of text to insert
* + (Number): The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
* Inserts a block of `text` and the indicated `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;
};
/**
* Document.insertLines(row, lines) -> Object
* - row (Number): The index of the row to insert at
* - lines (Array): An array of strings
* + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}```<br/>
* If `lines` is empty, this function returns an object containing the current row, and column, like this:<br/>
* ```{row: row, column: 0}```
*
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
*
*
**/
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;
};
/**
* Document.insertNewLine(position) -> Object
* - position (String): The position to insert at
* + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}```
*
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
*
*
*
**/
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;
};
/**
* Document.insertInLine(position, text) -> Object | Number
* - position (Number): The position to insert at
* - text (String): A chunk of text
* + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}```
* + (Number): If `text` is empty, this function returns the value of `position`
*
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
*
*
*
**/
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;
};
/**
* Document.remove(range) -> Object
* - range (Range): A specified Range to remove
* + (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`.
*
* Removes the `range` from the document.
*
*
**/
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;
};
/**
* Document.removeInLine(row, startColumn, endColumn) -> Object
* - row (Number): The row to remove from
* - startColumn (Number): The column to start removing at
* - endColumn (Number): The column to stop removing at
* + (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.
*
* Removes the specified columns from the `row`. This method also triggers the `'change'` event.
*
*
**/
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;
};
/**
* Document.removeLines(firstRow, lastRow) -> [String]
* - firstRow (Number): The first row to be removed
* - lastRow (Number): The last row to be removed
* + ([String]): Returns all the removed lines.
*
* Removes a range of full lines. This method also triggers the `'change'` event.
*
*
**/
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;
};
/**
* Document.removeNewLine(row) -> Void
* - row (Number): The row to check
*
* Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
*
**/
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 });
};
/**
* Document.replace(range, text) -> Object
* - range (Range): A specified Range to replace
* - text (String): The new text to use as a replacement
* + (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.
*
* Replaces a range in the document with the new `text`.
*
**/
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;
};
/**
* Document.applyDeltas(deltas) -> Void
*
* 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);
}
};
/**
* Document.revertDeltas(deltas) -> Void
*
* 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;
});
@@ -1,314 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* Julian Viereck <julian.viereck@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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
@@ -1,252 +0,0 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var TokenIterator = require("../token_iterator").TokenIterator;
var Range = require("../range").Range;
/**
* class BracketMatch
*
*
*
*
**/
/**
* new BracketMatch(position)
* - platform (String): Identifier for the platform; must be either `'mac'` or `'win'`
* - commands (Array): A list of commands
*
* TODO
*
*
**/
function BracketMatch() {
/**
* new findMatchingBracket(position)
* - position (Number): Identifier for the platform; must be either `'mac'` or `'win'`
* - commands (Array): A list of commands
*
* TODO
*
*
**/
this.findMatchingBracket = function(position) {
if (position.column == 0) return null;
var charBeforeCursor = 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;
});
@@ -1,116 +0,0 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Julian Viereck <julian DOT viereck AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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);
});
@@ -1,276 +0,0 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Julian Viereck <julian DOT viereck AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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;
});
@@ -1,759 +0,0 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Julian Viereck <julian DOT viereck AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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 (fold.placeholder.length < 2)
throw "Placeholder has to be at least 2 characters";
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) {
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) {
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(/\..*/, "\\."));
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);
do {
token = iterator.stepForward();
} while(token && re.test(token.type));
token = iterator.stepBackward();
range.end.row = iterator.getCurrentTokenRow();
range.end.column = iterator.getCurrentTokenColumn() + token.value.length;
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) {
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.className += " 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;
});
@@ -1,981 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* Julian Viereck <julian DOT viereck AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
require("./test/mockdom");
}
define(function(require, exports, module) {
"use strict";
var lang = require("./lib/lang");
var EditSession = require("./edit_session").EditSession;
var Editor = require("./editor").Editor;
var UndoManager = require("./undomanager").UndoManager;
var MockRenderer = require("./test/mockrenderer").MockRenderer;
var Range = require("./range").Range;
var assert = require("./test/assertions");
var JavaScriptMode = require("./mode/javascript").Mode;
function createFoldTestSession() {
var lines = [
"function foo(items) {",
" for (var i=0; i<items.length; i++) {",
" alert(items[i] + \"juhu\");",
" } // Real Tab.",
"}"
];
var session = new EditSession(lines.join("\n"));
session.setUndoManager(new UndoManager());
session.addFold("args...", new Range(0, 13, 0, 18));
session.addFold("foo...", new Range(1, 10, 2, 10));
session.addFold("bar...", new Range(2, 20, 2, 25));
return session;
}
module.exports = {
"test: find matching opening bracket in Text mode" : function() {
var session = new EditSession(["(()(", "())))"]);
assert.position(session.findMatchingBracket({row: 0, column: 3}), 0, 1);
assert.position(session.findMatchingBracket({row: 1, column: 2}), 1, 0);
assert.position(session.findMatchingBracket({row: 1, column: 3}), 0, 3);
assert.position(session.findMatchingBracket({row: 1, column: 4}), 0, 0);
assert.equal(session.findMatchingBracket({row: 1, column: 5}), null);
},
"test: find matching closing bracket in Text mode" : function() {
var session = new EditSession(["(()(", "())))"]);
assert.position(session.findMatchingBracket({row: 1, column: 1}), 1, 1);
assert.position(session.findMatchingBracket({row: 1, column: 1}), 1, 1);
assert.position(session.findMatchingBracket({row: 0, column: 4}), 1, 2);
assert.position(session.findMatchingBracket({row: 0, column: 2}), 0, 2);
assert.position(session.findMatchingBracket({row: 0, column: 1}), 1, 3);
assert.equal(session.findMatchingBracket({row: 0, column: 0}), null);
},
"test: find matching opening bracket in JavaScript mode" : function() {
var lines = [
"function foo() {",
" var str = \"{ foo()\";",
" if (debug) {",
" // write str (a string) to the console",
" console.log(str);",
" }",
" str += \" bar() }\";",
"}"
];
var session = new EditSession(lines.join("\n"), new JavaScriptMode());
assert.position(session.findMatchingBracket({row: 0, column: 14}), 0, 12);
assert.position(session.findMatchingBracket({row: 7, column: 1}), 0, 15);
assert.position(session.findMatchingBracket({row: 6, column: 20}), 1, 15);
assert.position(session.findMatchingBracket({row: 1, column: 22}), 1, 20);
assert.position(session.findMatchingBracket({row: 3, column: 31}), 3, 21);
assert.position(session.findMatchingBracket({row: 4, column: 24}), 4, 19);
assert.equal(session.findMatchingBracket({row: 0, column: 1}), null);
},
"test: find matching closing bracket in JavaScript mode" : function() {
var lines = [
"function foo() {",
" var str = \"{ foo()\";",
" if (debug) {",
" // write str (a string) to the console",
" console.log(str);",
" }",
" str += \" bar() }\";",
"}"
];
var session = new EditSession(lines.join("\n"), new JavaScriptMode());
assert.position(session.findMatchingBracket({row: 0, column: 13}), 0, 13);
assert.position(session.findMatchingBracket({row: 0, column: 16}), 7, 0);
assert.position(session.findMatchingBracket({row: 1, column: 16}), 6, 19);
assert.position(session.findMatchingBracket({row: 1, column: 21}), 1, 21);
assert.position(session.findMatchingBracket({row: 3, column: 22}), 3, 30);
assert.position(session.findMatchingBracket({row: 4, column: 20}), 4, 23);
},
"test: handle unbalanced brackets in JavaScript mode" : function() {
var lines = [
"function foo() {",
" var str = \"{ foo()\";",
" if (debug) {",
" // write str a string) to the console",
" console.log(str);",
" ",
" str += \" bar() \";",
"}"
];
var session = new EditSession(lines.join("\n"), new JavaScriptMode());
assert.equal(session.findMatchingBracket({row: 0, column: 16}), null);
assert.equal(session.findMatchingBracket({row: 3, column: 30}), null);
assert.equal(session.findMatchingBracket({row: 1, column: 16}), null);
},
"test: match different bracket types" : function() {
var session = new EditSession(["({[", ")]}"]);
assert.position(session.findMatchingBracket({row: 0, column: 1}), 1, 0);
assert.position(session.findMatchingBracket({row: 0, column: 2}), 1, 2);
assert.position(session.findMatchingBracket({row: 0, column: 3}), 1, 1);
assert.position(session.findMatchingBracket({row: 1, column: 1}), 0, 0);
assert.position(session.findMatchingBracket({row: 1, column: 2}), 0, 2);
assert.position(session.findMatchingBracket({row: 1, column: 3}), 0, 1);
},
"test: move lines down" : function() {
var session = new EditSession(["a1", "a2", "a3", "a4"]);
session.moveLinesDown(0, 1);
assert.equal(session.getValue(), ["a3", "a1", "a2", "a4"].join("\n"));
session.moveLinesDown(1, 2);
assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
session.moveLinesDown(2, 3);
assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
session.moveLinesDown(2, 2);
assert.equal(session.getValue(), ["a3", "a4", "a2", "a1"].join("\n"));
},
"test: move lines up" : function() {
var session = new EditSession(["a1", "a2", "a3", "a4"]);
session.moveLinesUp(2, 3);
assert.equal(session.getValue(), ["a1", "a3", "a4", "a2"].join("\n"));
session.moveLinesUp(1, 2);
assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
session.moveLinesUp(0, 1);
assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
session.moveLinesUp(2, 2);
assert.equal(session.getValue(), ["a3", "a1", "a4", "a2"].join("\n"));
},
"test: duplicate lines" : function() {
var session = new EditSession(["1", "2", "3", "4"]);
session.duplicateLines(1, 2);
assert.equal(session.getValue(), ["1", "2", "3", "2", "3", "4"].join("\n"));
},
"test: duplicate last line" : function() {
var session = new EditSession(["1", "2", "3"]);
session.duplicateLines(2, 2);
assert.equal(session.getValue(), ["1", "2", "3", "3"].join("\n"));
},
"test: duplicate first line" : function() {
var session = new EditSession(["1", "2", "3"]);
session.duplicateLines(0, 0);
assert.equal(session.getValue(), ["1", "1", "2", "3"].join("\n"));
},
"test: getScreenLastRowColumn": function() {
var session = new EditSession([
"juhu",
"12\t\t34",
"ぁぁa"
]);
assert.equal(session.getScreenLastRowColumn(0), 4);
assert.equal(session.getScreenLastRowColumn(1), 10);
assert.equal(session.getScreenLastRowColumn(2), 5);
},
"test: convert document to screen coordinates" : function() {
var session = new EditSession("01234\t567890\t1234");
session.setTabSize(4);
assert.equal(session.documentToScreenColumn(0, 0), 0);
assert.equal(session.documentToScreenColumn(0, 4), 4);
assert.equal(session.documentToScreenColumn(0, 5), 5);
assert.equal(session.documentToScreenColumn(0, 6), 8);
assert.equal(session.documentToScreenColumn(0, 12), 14);
assert.equal(session.documentToScreenColumn(0, 13), 16);
session.setTabSize(2);
assert.equal(session.documentToScreenColumn(0, 0), 0);
assert.equal(session.documentToScreenColumn(0, 4), 4);
assert.equal(session.documentToScreenColumn(0, 5), 5);
assert.equal(session.documentToScreenColumn(0, 6), 6);
assert.equal(session.documentToScreenColumn(0, 7), 7);
assert.equal(session.documentToScreenColumn(0, 12), 12);
assert.equal(session.documentToScreenColumn(0, 13), 14);
},
"test: convert document to screen coordinates with leading tabs": function() {
var session = new EditSession("\t\t123");
session.setTabSize(4);
assert.equal(session.documentToScreenColumn(0, 0), 0);
assert.equal(session.documentToScreenColumn(0, 1), 4);
assert.equal(session.documentToScreenColumn(0, 2), 8);
assert.equal(session.documentToScreenColumn(0, 3), 9);
},
"test: documentToScreen without soft wrap": function() {
var session = new EditSession([
"juhu",
"12\t\t34",
"ぁぁa"
]);
assert.position(session.documentToScreenPosition(0, 3), 0, 3);
assert.position(session.documentToScreenPosition(1, 3), 1, 4);
assert.position(session.documentToScreenPosition(1, 4), 1, 8);
assert.position(session.documentToScreenPosition(2, 2), 2, 4);
},
"test: documentToScreen with soft wrap": function() {
var session = new EditSession(["foo bar foo bar"]);
session.setUseWrapMode(true);
session.setWrapLimitRange(12, 12);
session.adjustWrapLimit(80);
assert.position(session.documentToScreenPosition(0, 11), 0, 11);
assert.position(session.documentToScreenPosition(0, 12), 1, 0);
},
"test: documentToScreen with soft wrap and multibyte characters": function() {
var session = new EditSession(["ぁぁa"]);
session.setUseWrapMode(true);
session.setWrapLimitRange(2, 2);
session.adjustWrapLimit(80);
assert.position(session.documentToScreenPosition(0, 1), 1, 0);
assert.position(session.documentToScreenPosition(0, 2), 2, 0);
assert.position(session.documentToScreenPosition(0, 4), 2, 1);
},
"test: documentToScreen should clip position to the document boundaries": function() {
var session = new EditSession("foo bar\njuhu kinners");
assert.position(session.documentToScreenPosition(-1, 4), 0, 0);
assert.position(session.documentToScreenPosition(3, 0), 1, 12);
},
"test: convert screen to document coordinates" : function() {
var session = new EditSession("01234\t567890\t1234");
session.setTabSize(4);
assert.equal(session.screenToDocumentColumn(0, 0), 0);
assert.equal(session.screenToDocumentColumn(0, 4), 4);
assert.equal(session.screenToDocumentColumn(0, 5), 5);
assert.equal(session.screenToDocumentColumn(0, 6), 5);
assert.equal(session.screenToDocumentColumn(0, 7), 5);
assert.equal(session.screenToDocumentColumn(0, 8), 6);
assert.equal(session.screenToDocumentColumn(0, 9), 7);
assert.equal(session.screenToDocumentColumn(0, 15), 12);
assert.equal(session.screenToDocumentColumn(0, 19), 16);
session.setTabSize(2);
assert.equal(session.screenToDocumentColumn(0, 0), 0);
assert.equal(session.screenToDocumentColumn(0, 4), 4);
assert.equal(session.screenToDocumentColumn(0, 5), 5);
assert.equal(session.screenToDocumentColumn(0, 6), 6);
assert.equal(session.screenToDocumentColumn(0, 12), 12);
assert.equal(session.screenToDocumentColumn(0, 13), 12);
assert.equal(session.screenToDocumentColumn(0, 14), 13);
},
"test: screenToDocument with soft wrap": function() {
var session = new EditSession(["foo bar foo bar"]);
session.setUseWrapMode(true);
session.setWrapLimitRange(12, 12);
session.adjustWrapLimit(80);
assert.position(session.screenToDocumentPosition(1, 0), 0, 12);
assert.position(session.screenToDocumentPosition(0, 11), 0, 11);
// Check if the position is clamped the right way.
assert.position(session.screenToDocumentPosition(0, 12), 0, 11);
assert.position(session.screenToDocumentPosition(0, 20), 0, 11);
},
"test: screenToDocument with soft wrap and multi byte characters": function() {
var session = new EditSession(["ぁ a"]);
session.setUseWrapMode(true);
session.adjustWrapLimit(80);
assert.position(session.screenToDocumentPosition(0, 1), 0, 0);
assert.position(session.screenToDocumentPosition(0, 2), 0, 1);
assert.position(session.screenToDocumentPosition(0, 3), 0, 2);
assert.position(session.screenToDocumentPosition(0, 4), 0, 3);
assert.position(session.screenToDocumentPosition(0, 5), 0, 3);
},
"test: screenToDocument should clip position to the document boundaries": function() {
var session = new EditSession("foo bar\njuhu kinners");
assert.position(session.screenToDocumentPosition(-1, 4), 0, 0);
assert.position(session.screenToDocumentPosition(0, -1), 0, 0);
assert.position(session.screenToDocumentPosition(0, 30), 0, 7);
assert.position(session.screenToDocumentPosition(2, 4), 1, 12);
assert.position(session.screenToDocumentPosition(1, 30), 1, 12);
assert.position(session.screenToDocumentPosition(20, 50), 1, 12);
assert.position(session.screenToDocumentPosition(20, 5), 1, 12);
// and the same for folded rows
session.addFold("...", new Range(0,1,1,3));
assert.position(session.screenToDocumentPosition(1, 2), 1, 12);
// for wrapped rows
session.setUseWrapMode(true);
session.setWrapLimitRange(5,5);
assert.position(session.screenToDocumentPosition(4, 1), 1, 12);
},
"test: wrapLine split function" : function() {
function computeAndAssert(line, assertEqual, wrapLimit, tabSize) {
wrapLimit = wrapLimit || 12;
tabSize = tabSize || 4;
line = lang.stringTrimRight(line);
var tokens = EditSession.prototype.$getDisplayTokens(line);
var splits = EditSession.prototype.$computeWrapSplits(tokens, wrapLimit, tabSize);
// console.log("String:", line, "Result:", splits, "Expected:", assertEqual);
assert.ok(splits.length == assertEqual.length);
for (var i = 0; i < splits.length; i++) {
assert.ok(splits[i] == assertEqual[i]);
}
}
// Basic splitting.
computeAndAssert("foo bar foo bar", [ 12 ]);
computeAndAssert("foo bar f bar", [ 12 ]);
computeAndAssert("foo bar f r", [ 14 ]);
computeAndAssert("foo bar foo bar foo bara foo", [12, 25]);
// Don't split if there is only whitespaces/tabs at the end of the line.
computeAndAssert("foo foo foo \t \t", [ ]);
// If there is no space to split, force split.
computeAndAssert("foooooooooooooo", [ 12 ]);
computeAndAssert("fooooooooooooooooooooooooooo", [12, 24]);
computeAndAssert("foo bar fooooooooooobooooooo", [8, 20]);
// Basic splitting + tabs.
computeAndAssert("foo \t\tbar", [ 6 ]);
computeAndAssert("foo \t \tbar", [ 7 ]);
// Ignore spaces/tabs at beginning of split.
computeAndAssert("foo \t \t \t \t bar", [ 14 ]);
// Test wrapping for asian characters.
computeAndAssert("ぁぁ", [1], 2);
computeAndAssert(" ぁぁ", [1, 2], 2);
computeAndAssert(" ぁ\tぁ", [1, 3], 2);
computeAndAssert(" ぁぁ\tぁ", [1, 4], 4);
// Test wrapping for punctuation.
computeAndAssert(" ab.c;ef++", [1, 3, 5, 7, 8], 2);
computeAndAssert(" a.b", [1, 2, 3], 1);
computeAndAssert("#>>", [1, 2], 1);
},
"test get longest line" : function() {
var session = new EditSession(["12"]);
session.setTabSize(4);
assert.equal(session.getScreenWidth(), 2);
session.doc.insertNewLine({row: 0, column: Infinity});
session.doc.insertLines(1, ["123"]);
assert.equal(session.getScreenWidth(), 3);
session.doc.insertNewLine({row: 0, column: Infinity});
session.doc.insertLines(1, ["\t\t"]);
assert.equal(session.getScreenWidth(), 8);
session.setTabSize(2);
assert.equal(session.getScreenWidth(), 4);
},
"test getDisplayString": function() {
var session = new EditSession(["12"]);
session.setTabSize(4);
assert.equal(session.$getDisplayTokens("\t").length, 4);
assert.equal(session.$getDisplayTokens("abc").length, 3);
assert.equal(session.$getDisplayTokens("abc\t").length, 4);
},
"test issue 83": function() {
var session = new EditSession("");
var editor = new Editor(new MockRenderer(), session);
var document = session.getDocument();
session.setUseWrapMode(true);
document.insertLines(0, ["a", "b"]);
document.insertLines(2, ["c", "d"]);
document.removeLines(1, 2);
},
"test wrapMode init has to create wrapData array": function() {
var session = new EditSession("foo bar\nfoo bar");
var editor = new Editor(new MockRenderer(), session);
var document = session.getDocument();
session.setUseWrapMode(true);
session.setWrapLimitRange(3, 3);
session.adjustWrapLimit(80);
// Test if wrapData is there and was computed.
assert.equal(session.$wrapData.length, 2);
assert.equal(session.$wrapData[0].length, 1);
assert.equal(session.$wrapData[1].length, 1);
},
"test first line blank with wrap": function() {
var session = new EditSession("\nfoo");
session.setUseWrapMode(true);
assert.equal(session.doc.getValue(), ["", "foo"].join("\n"));
},
"test first line blank with wrap 2" : function() {
var session = new EditSession("");
session.setUseWrapMode(true);
session.setValue("\nfoo");
assert.equal(session.doc.getValue(), ["", "foo"].join("\n"));
},
"test fold getFoldDisplayLine": function() {
var session = createFoldTestSession();
function assertDisplayLine(foldLine, str) {
var line = session.getLine(foldLine.end.row);
var displayLine =
session.getFoldDisplayLine(foldLine, foldLine.end.row, line.length);
assert.equal(displayLine, str);
}
assertDisplayLine(session.$foldData[0], "function foo(args...) {")
assertDisplayLine(session.$foldData[1], " for (vfoo...ert(items[bar...\"juhu\");");
},
"test foldLine idxToPosition": function() {
var session = createFoldTestSession();
function assertIdx2Pos(foldLineIdx, idx, row, column) {
var foldLine = session.$foldData[foldLineIdx];
assert.position(foldLine.idxToPosition(idx), row, column);
}
// "function foo(items) {",
// " for (var i=0; i<items.length; i++) {",
// " alert(items[i] + \"juhu\");",
// " } // Real Tab.",
// "}"
assertIdx2Pos(0, 12, 0, 12);
assertIdx2Pos(0, 13, 0, 13);
assertIdx2Pos(0, 14, 0, 13);
assertIdx2Pos(0, 19, 0, 13);
assertIdx2Pos(0, 20, 0, 18);
assertIdx2Pos(1, 10, 1, 10);
assertIdx2Pos(1, 11, 1, 10);
assertIdx2Pos(1, 15, 1, 10);
assertIdx2Pos(1, 16, 2, 10);
assertIdx2Pos(1, 26, 2, 20);
assertIdx2Pos(1, 27, 2, 20);
assertIdx2Pos(1, 32, 2, 25);
},
"test fold documentToScreen": function() {
var session = createFoldTestSession();
function assertDoc2Screen(docRow, docCol, screenRow, screenCol) {
assert.position(
session.documentToScreenPosition(docRow, docCol),
screenRow, screenCol
);
}
// One fold ending in the same row.
assertDoc2Screen(0, 0, 0, 0);
assertDoc2Screen(0, 13, 0, 13);
assertDoc2Screen(0, 14, 0, 13);
assertDoc2Screen(0, 17, 0, 13);
assertDoc2Screen(0, 18, 0, 20);
// Fold ending on some other row.
assertDoc2Screen(1, 0, 1, 0);
assertDoc2Screen(1, 10, 1, 10);
assertDoc2Screen(1, 11, 1, 10);
assertDoc2Screen(1, 99, 1, 10);
assertDoc2Screen(2, 0, 1, 10);
assertDoc2Screen(2, 9, 1, 10);
assertDoc2Screen(2, 10, 1, 16);
assertDoc2Screen(2, 11, 1, 17);
// Fold in the same row with fold over more then one row in the same row.
assertDoc2Screen(2, 19, 1, 25);
assertDoc2Screen(2, 20, 1, 26);
assertDoc2Screen(2, 21, 1, 26);
assertDoc2Screen(2, 24, 1, 26);
assertDoc2Screen(2, 25, 1, 32);
assertDoc2Screen(2, 26, 1, 33);
assertDoc2Screen(2, 99, 1, 40);
// Test one position after the folds. Should be all like normal.
assertDoc2Screen(3, 0, 2, 0);
},
"test fold screenToDocument": function() {
var session = createFoldTestSession();
function assertScreen2Doc(docRow, docCol, screenRow, screenCol) {
assert.position(
session.screenToDocumentPosition(screenRow, screenCol),
docRow, docCol
);
}
// One fold ending in the same row.
assertScreen2Doc(0, 0, 0, 0);
assertScreen2Doc(0, 13, 0, 13);
assertScreen2Doc(0, 13, 0, 14);
assertScreen2Doc(0, 18, 0, 20);
assertScreen2Doc(0, 19, 0, 21);
// Fold ending on some other row.
assertScreen2Doc(1, 0, 1, 0);
assertScreen2Doc(1, 10, 1, 10);
assertScreen2Doc(1, 10, 1, 11);
assertScreen2Doc(1, 10, 1, 15);
assertScreen2Doc(2, 10, 1, 16);
assertScreen2Doc(2, 11, 1, 17);
// Fold in the same row with fold over more then one row in the same row.
assertScreen2Doc(2, 19, 1, 25);
assertScreen2Doc(2, 20, 1, 26);
assertScreen2Doc(2, 20, 1, 27);
assertScreen2Doc(2, 20, 1, 31);
assertScreen2Doc(2, 25, 1, 32);
assertScreen2Doc(2, 26, 1, 33);
assertScreen2Doc(2, 33, 1, 99);
// Test one position after the folds. Should be all like normal.
assertScreen2Doc(3, 0, 2, 0);
},
"test getFoldsInRange()": function() {
var session = createFoldTestSession();
var foldLines = session.$foldData;
var folds = foldLines[0].folds.concat(foldLines[1].folds);
function test(startRow, startColumn, endColumn, endRow, folds) {
var r = new Range(startRow, startColumn, endColumn, endRow);
var retFolds = session.getFoldsInRange(r);
assert.ok(retFolds.length == folds.length);
for (var i = 0; i < retFolds.length; i++) {
assert.equal(retFolds[i].range + "", folds[i].range + "");
}
}
test(0, 0, 0, 13, [ ]);
test(0, 0, 0, 14, [ folds[0] ]);
test(0, 0, 0, 18, [ folds[0] ]);
test(0, 0, 1, 10, [ folds[0] ]);
test(0, 0, 1, 11, [ folds[0], folds[1] ]);
test(0, 18, 1, 11, [ folds[1] ]);
test(2, 0, 2, 13, [ folds[1] ]);
test(2, 10, 2, 20, [ ]);
test(2, 10, 2, 11, [ ]);
test(2, 19, 2, 20, [ ]);
},
"test fold one-line text insert": function() {
// These are mostly test for the FoldLine.addRemoveChars function.
var session = createFoldTestSession();
var undoManager = session.getUndoManager();
var foldLines = session.$foldData;
function insert(row, column, text) {
session.insert({row: row, column: column}, text);
// Force the session to store all changes made to the document NOW
// on the undoManager's queue. Otherwise we can't undo in separate
// steps later.
session.$syncInformUndoManager();
}
var foldLine, fold, folds;
// First line.
foldLine = session.$foldData[0];
fold = foldLine.folds[0];
insert(0, 0, "0");
assert.range(foldLine.range, 0, 14, 0, 19);
assert.range(fold.range, 0, 14, 0, 19);
insert(0, 14, "1");
assert.range(foldLine.range, 0, 15, 0, 20);
assert.range(fold.range, 0, 15, 0, 20);
insert(0, 20, "2");
assert.range(foldLine.range, 0, 15, 0, 20);
assert.range(fold.range, 0, 15, 0, 20);
// Second line.
foldLine = session.$foldData[1];
folds = foldLine.folds;
insert(1, 0, "3");
assert.range(foldLine.range, 1, 11, 2, 25);
assert.range(folds[0].range, 1, 11, 2, 10);
assert.range(folds[1].range, 2, 20, 2, 25);
insert(1, 11, "4");
assert.range(foldLine.range, 1, 12, 2, 25);
assert.range(folds[0].range, 1, 12, 2, 10);
assert.range(folds[1].range, 2, 20, 2, 25);
insert(2, 10, "5");
assert.range(foldLine.range, 1, 12, 2, 26);
assert.range(folds[0].range, 1, 12, 2, 10);
assert.range(folds[1].range, 2, 21, 2, 26);
insert(2, 21, "6");
assert.range(foldLine.range, 1, 12, 2, 27);
assert.range(folds[0].range, 1, 12, 2, 10);
assert.range(folds[1].range, 2, 22, 2, 27);
insert(2, 27, "7");
assert.range(foldLine.range, 1, 12, 2, 27);
assert.range(folds[0].range, 1, 12, 2, 10);
assert.range(folds[1].range, 2, 22, 2, 27);
// UNDO = REMOVE
undoManager.undo(); // 6
assert.range(foldLine.range, 1, 12, 2, 27);
assert.range(folds[0].range, 1, 12, 2, 10);
assert.range(folds[1].range, 2, 22, 2, 27);
undoManager.undo(); // 5
assert.range(foldLine.range, 1, 12, 2, 26);
assert.range(folds[0].range, 1, 12, 2, 10);
assert.range(folds[1].range, 2, 21, 2, 26);
undoManager.undo(); // 4
assert.range(foldLine.range, 1, 12, 2, 25);
assert.range(folds[0].range, 1, 12, 2, 10);
assert.range(folds[1].range, 2, 20, 2, 25);
undoManager.undo(); // 3
assert.range(foldLine.range, 1, 11, 2, 25);
assert.range(folds[0].range, 1, 11, 2, 10);
assert.range(folds[1].range, 2, 20, 2, 25);
undoManager.undo(); // Beginning first line.
assert.equal(foldLines.length, 2);
assert.range(foldLines[0].range, 0, 15, 0, 20);
assert.range(foldLines[1].range, 1, 10, 2, 25);
foldLine = session.$foldData[0];
fold = foldLine.folds[0];
undoManager.undo(); // 2
assert.range(foldLine.range, 0, 15, 0, 20);
assert.range(fold.range, 0, 15, 0, 20);
undoManager.undo(); // 1
assert.range(foldLine.range, 0, 14, 0, 19);
assert.range(fold.range, 0, 14, 0, 19);
undoManager.undo(); // 0
assert.range(foldLine.range, 0, 13, 0, 18);
assert.range(fold.range, 0, 13, 0, 18);
},
"test fold multi-line insert/remove": function() {
var session = createFoldTestSession(),
undoManager = session.getUndoManager(),
foldLines = session.$foldData;
function insert(row, column, text) {
session.insert({row: row, column: column}, text);
// Force the session to store all changes made to the document NOW
// on the undoManager's queue. Otherwise we can't undo in separate
// steps later.
session.$syncInformUndoManager();
}
var foldLines = session.$foldData, foldLine, fold, folds;
insert(0, 0, "\nfo0");
assert.equal(foldLines.length, 2);
assert.range(foldLines[0].range, 1, 16, 1, 21);
assert.range(foldLines[1].range, 2, 10, 3, 25);
insert(2, 0, "\nba1");
assert.equal(foldLines.length, 2);
assert.range(foldLines[0].range, 1, 16, 1, 21);
assert.range(foldLines[1].range, 3, 13, 4, 25);
insert(3, 10, "\nfo2");
assert.equal(foldLines.length, 2);
assert.range(foldLines[0].range, 1, 16, 1, 21);
assert.range(foldLines[1].range, 4, 6, 5, 25);
insert(5, 10, "\nba3");
assert.equal(foldLines.length, 3);
assert.range(foldLines[0].range, 1, 16, 1, 21);
assert.range(foldLines[1].range, 4, 6, 5, 10);
assert.range(foldLines[2].range, 6, 13, 6, 18);
insert(6, 18, "\nfo4");
assert.equal(foldLines.length, 3);
assert.range(foldLines[0].range, 1, 16, 1, 21);
assert.range(foldLines[1].range, 4, 6, 5, 10);
assert.range(foldLines[2].range, 6, 13, 6, 18);
undoManager.undo(); // 3
assert.equal(foldLines.length, 3);
assert.range(foldLines[0].range, 1, 16, 1, 21);
assert.range(foldLines[1].range, 4, 6, 5, 10);
assert.range(foldLines[2].range, 6, 13, 6, 18);
undoManager.undo(); // 2
assert.equal(foldLines.length, 2);
assert.range(foldLines[0].range, 1, 16, 1, 21);
assert.range(foldLines[1].range, 4, 6, 5, 25);
undoManager.undo(); // 1
assert.equal(foldLines.length, 2);
assert.range(foldLines[0].range, 1, 16, 1, 21);
assert.range(foldLines[1].range, 3, 13, 4, 25);
undoManager.undo(); // 0
assert.equal(foldLines.length, 2);
assert.range(foldLines[0].range, 1, 16, 1, 21);
assert.range(foldLines[1].range, 2, 10, 3, 25);
undoManager.undo(); // Beginning
assert.equal(foldLines.length, 2);
assert.range(foldLines[0].range, 0, 13, 0, 18);
assert.range(foldLines[1].range, 1, 10, 2, 25);
// TODO: Add test for inseration inside of folds.
},
"test fold wrap data compution": function() {
function assertArray(a, b) {
assert.ok(a.length == b.length);
for (var i = 0; i < a.length; i++) {
assert.equal(a[i], b[i]);
}
}
function assertWrap(line0, line1, line2) {
line0 && assertArray(wrapData[0], line0);
line1 && assertArray(wrapData[1], line1);
line2 && assertArray(wrapData[2], line2);
}
function removeFoldAssertWrap(docRow, docColumn, line0, line1, line2) {
session.removeFold(session.getFoldAt(docRow, docColumn));
assertWrap(line0, line1, line2);
}
var lines = [
"foo bar foo bar",
"foo bar foo bar",
"foo bar foo bar"
];
var session = new EditSession(lines.join("\n"));
session.setUseWrapMode(true);
session.$wrapLimit = 7;
session.$updateWrapData(0, 2);
var wrapData = session.$wrapData;
// Do a simple assertion without folds to check basic functionallity.
assertWrap([8], [8], [8]);
// --- Do in line folding ---
// Adding a fold. The split position is inside of the fold. As placeholder
// are not splitable, the split should be before the split.
session.addFold("woot", new Range(0, 4, 0, 15));
assertWrap([4], [8], [8]);
// Remove the fold again which should reset the wrapData.
removeFoldAssertWrap(0, 4, [8], [8], [8]);
session.addFold("woot", new Range(0, 6, 0, 9));
assertWrap([6, 13], [8], [8]);
removeFoldAssertWrap(0, 6, [8], [8], [8]);
// The fold fits into the wrap limit - no split expected.
session.addFold("woot", new Range(0, 3, 0, 15));
assertWrap([], [8], [8]);
removeFoldAssertWrap(0, 4, [8], [8], [8]);
// Fold after split position should be all fine.
session.addFold("woot", new Range(0, 8, 0, 15));
assertWrap([8], [8], [8]);
removeFoldAssertWrap(0, 8, [8], [8], [8]);
// Fold's placeholder is far too long for wrapSplit.
session.addFold("woot0123456789", new Range(0, 8, 0, 15));
assertWrap([8], [8], [8]);
removeFoldAssertWrap(0, 8, [8], [8], [8]);
// Fold's placeholder is far too long for wrapSplit
// + content at the end of the line
session.addFold("woot0123456789", new Range(0, 6, 0, 8));
assertWrap([6, 20], [8], [8]);
removeFoldAssertWrap(0, 8, [8], [8], [8]);
session.addFold("woot0123456789", new Range(0, 6, 0, 8));
session.addFold("woot0123456789", new Range(0, 8, 0, 10));
assertWrap([6, 20, 34], [8], [8]);
session.removeFold(session.getFoldAt(0, 7));
removeFoldAssertWrap(0, 8, [8], [8], [8]);
session.addFold("woot0123456789", new Range(0, 7, 0, 9));
session.addFold("woot0123456789", new Range(0, 13, 0, 15));
assertWrap([7, 21, 25], [8], [8]);
session.removeFold(session.getFoldAt(0, 7));
removeFoldAssertWrap(0, 14, [8], [8], [8]);
// --- Do some multiline folding ---
// Add a fold over two lines. Note, that the wrapData[1] stays the
// same. This is an implementation detail and expected behavior.
session.addFold("woot", new Range(0, 8, 1, 15));
assertWrap([8], [8 /* See comments */], [8]);
removeFoldAssertWrap(0, 8, [8], [8], [8]);
session.addFold("woot", new Range(0, 9, 1, 11));
assertWrap([8, 14], [8 /* See comments */], [8]);
removeFoldAssertWrap(0, 9, [8], [8], [8]);
session.addFold("woot", new Range(0, 9, 1, 15));
assertWrap([8], [8 /* See comments */], [8]);
removeFoldAssertWrap(0, 9, [8], [8], [8]);
return session;
},
"test add fold": function() {
var session = createFoldTestSession();
var fold;
function tryAddFold(placeholder, range, shouldFail) {
var fail = false;
try {
fold = session.addFold(placeholder, range);
} catch (e) {
fail = true;
}
if (fail != shouldFail) {
throw "Expected to get an exception";
}
}
tryAddFold("foo", new Range(0, 13, 0, 17), false);
tryAddFold("foo", new Range(0, 14, 0, 18), true);
tryAddFold("foo", new Range(0, 13, 0, 18), false);
assert.equal(session.$foldData[0].folds.length, 1);
tryAddFold("f", new Range(0, 13, 0, 18), true);
tryAddFold("foo", new Range(0, 18, 0, 21), false);
assert.equal(session.$foldData[0].folds.length, 2);
session.removeFold(fold);
tryAddFold("foo", new Range(0, 18, 0, 22), false);
tryAddFold("foo", new Range(0, 18, 0, 19), true);
tryAddFold("foo", new Range(0, 22, 1, 10), false);
},
"test add subfolds": function() {
var session = createFoldTestSession();
var fold, oldFold;
var foldData = session.$foldData;
oldFold = foldData[0].folds[0];
fold = session.addFold("fold0", new Range(0, 10, 0, 21));
assert.equal(foldData[0].folds.length, 1);
assert.equal(fold.subFolds.length, 1);
assert.equal(fold.subFolds[0], oldFold);
session.expandFold(fold);
assert.equal(foldData[0].folds.length, 1);
assert.equal(foldData[0].folds[0], oldFold);
assert.equal(fold.subFolds.length, 0);
fold = session.addFold("fold0", new Range(0, 13, 2, 10));
assert.equal(foldData.length, 1);
assert.equal(fold.subFolds.length, 2);
assert.equal(fold.subFolds[0], oldFold);
session.expandFold(fold);
assert.equal(foldData.length, 2);
assert.equal(foldData[0].folds.length, 1);
assert.equal(foldData[0].folds[0], oldFold);
assert.equal(fold.subFolds.length, 0);
session.unfold(null, true);
fold = session.addFold("fold0", new Range(0, 0, 0, 21));
session.addFold("fold0", new Range(0, 1, 0, 5));
session.addFold("fold0", new Range(0, 6, 0, 8));
assert.equal(fold.subFolds.length, 2);
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}
File diff suppressed because it is too large Load Diff
@@ -1,195 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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()
}
@@ -1,231 +0,0 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Mihai Sucan.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mihai Sucan <mihai.sucan@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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();
}
@@ -1,171 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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()
}
@@ -1,562 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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()
}
@@ -1,22 +0,0 @@
.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;
}
@@ -1,98 +0,0 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jan Jongboom <fabian AT ajax DOT org>
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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++) {
var lineTokens = session.getTokens(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, 0, lineTokens, true);
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
};
};
});
@@ -1,81 +0,0 @@
if (typeof process !== "undefined") {
require("amd-loader");
require("../test/mockdom");
}
define(function(require, exports, module) {
"use strict";
var assert = require("assert");
var highlighter = require("./static_highlight");
var JavaScriptMode = require("../mode/javascript").Mode;
// Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite
module.exports = {
timeout: 10000,
"test simple snippet": function(next) {
var theme = require("../theme/tomorrow");
var snippet = "/** this is a function\n\
*\n\
*/\n\
function hello (a, b, c) {\n\
console.log(a * b + c + 'sup?');\n\
}";
var mode = new JavaScriptMode();
var isError = false, result;
try {
result = highlighter.render(snippet, mode, theme);
}
catch (e) {
console.log(e);
isError = true;
}
// todo: write something more meaningful
assert.equal(isError, false);
next();
},
"test css from theme is used": function(next) {
var theme = require("../theme/tomorrow");
var snippet = "/** this is a function\n\
*\n\
*/\n\
function hello (a, b, c) {\n\
console.log(a * b + c + 'sup?');\n\
}";
var mode = new JavaScriptMode();
var isError = false, result;
result = highlighter.render(snippet, mode, theme);
assert.ok(result.css.indexOf(theme.cssText) !== -1);
next();
},
"test theme classname should be in output html": function (next) {
var theme = require("../theme/tomorrow");
var snippet = "/** this is a function\n\
*\n\
*/\n\
function hello (a, b, c) {\n\
console.log(a * b + c + 'sup?');\n\
}";
var mode = new JavaScriptMode();
var isError = false, result;
result = highlighter.render(snippet, mode, theme);
assert.equal(!!result.html.match(/<div class='ace-tomorrow'>/), true);
next();
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
}
@@ -1,536 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Skywriter.
*
* The Initial Developer of the Original Code is
* Mozilla.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Kevin Dangoor (kdangoor@mozilla.com)
* Julian Viereck <julian.viereck@gmail.com>
* Harutyun Amirjanyan [harutyun@c9.io]
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var event = require("../lib/event");
var UA = require("../lib/useragent");
var net = require("../lib/net");
var ace = require("../ace");
require("ace/theme/textmate");
module.exports = exports = ace;
/*
* Returns the CSS property of element.
* 1) If the CSS property is on the style object of the element, use it, OR
* 2) Compute the CSS property
*
* If the property can't get computed, is 'auto' or 'intrinsic', the former
* calculated property is used (this can happen in cases where the textarea
* is hidden and has no dimension styles).
*/
var getCSSProperty = function(element, container, property) {
var ret = element.style[property];
if (!ret) {
if (window.getComputedStyle) {
ret = window.getComputedStyle(element, '').getPropertyValue(property);
} else {
ret = element.currentStyle[property];
}
}
if (!ret || ret == 'auto' || ret == 'intrinsic') {
ret = container.style[property];
}
return ret;
};
function applyStyles(elm, styles) {
for (var style in styles) {
elm.style[style] = styles[style];
}
}
function setupContainer(element, getValue) {
if (element.type != 'textarea') {
throw "Textarea required!";
}
var parentNode = element.parentNode;
// This will hold the editor.
var container = document.createElement('div');
// To put Ace in the place of the textarea, we have to copy a few of the
// textarea's style attributes to the div container.
//
// The problem is that the properties have to get computed (they might be
// defined by a CSS file on the page - you can't access such rules that
// apply to an element via elm.style). Computed properties are converted to
// pixels although the dimension might be given as percentage. When the
// window resizes, the dimensions defined by percentages changes, so the
// properties have to get recomputed to get the new/true pixels.
var resizeEvent = function() {
var style = 'position:relative;';
[
'margin-top', 'margin-left', 'margin-right', 'margin-bottom'
].forEach(function(item) {
style += item + ':' +
getCSSProperty(element, container, item) + ';';
});
// Calculating the width/height of the textarea is somewhat tricky. To
// do it right, you have to include the paddings to the sides as well
// (eg. width = width + padding-left, -right). This works well, as
// long as the width of the element is not set or given in pixels. In
// this case and after the textarea is hidden, getCSSProperty(element,
// container, 'width') will still return pixel value. If the element
// has realtiv dimensions (e.g. width='95<percent>')
// getCSSProperty(...) will return pixel values only as long as the
// textarea is visible. After it is hidden getCSSProperty will return
// the relative dimensions as they are set on the element (in the case
// of width, 95<percent>).
// Making the sum of pixel vaules (e.g. padding) and realtive values
// (e.g. <percent>) is not possible. As such the padding styles are
// ignored.
// The complete width is the width of the textarea + the padding
// to the left and right.
var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px");
var height = getCSSProperty(element, container, 'height') || (element.clientHeight + "px");
style += 'height:' + height + ';width:' + width + ';';
// Set the display property to 'inline-block'.
style += 'display:inline-block;';
container.setAttribute('style', style);
};
event.addListener(window, 'resize', resizeEvent);
// Call the resizeEvent once, so that the size of the container is
// calculated.
resizeEvent();
// Insert the div container after the element.
if (element.nextSibling) {
parentNode.insertBefore(container, element.nextSibling);
} else {
parentNode.appendChild(container);
}
// Override the forms onsubmit function. Set the innerHTML and value
// of the textarea before submitting.
while (parentNode !== document) {
if (parentNode.tagName.toUpperCase() === 'FORM') {
var oldSumit = parentNode.onsubmit;
// Override the onsubmit function of the form.
parentNode.onsubmit = function(evt) {
element.innerHTML = getValue();
element.value = getValue();
// If there is a onsubmit function already, then call
// it with the current context and pass the event.
if (oldSumit) {
oldSumit.call(this, evt);
}
};
break;
}
parentNode = parentNode.parentNode;
}
return container;
}
exports.transformTextarea = function(element, loader) {
var session;
var container = setupContainer(element, function() {
return session.getValue();
});
// Hide the element.
element.style.display = 'none';
container.style.background = 'white';
//
var editorDiv = document.createElement("div");
applyStyles(editorDiv, {
top: "0px",
left: "0px",
right: "0px",
bottom: "0px",
border: "1px solid gray"
});
container.appendChild(editorDiv);
var settingOpener = document.createElement("div");
applyStyles(settingOpener, {
position: "absolute",
width: "15px",
right: "0px",
bottom: "0px",
background: "red",
cursor: "nw-resize",
borderStyle: "solid",
borderWidth: "9px 8px 10px 9px",
width: "2px",
borderColor: "lightblue gray gray lightblue",
zIndex: 101
});
var settingDiv = document.createElement("div");
var settingDivStyles = {
top: "0px",
left: "0px",
right: "0px",
bottom: "0px",
position: "absolute",
padding: "5px",
zIndex: 100,
color: "white",
display: "none",
overflow: "auto",
fontSize: "14px"
};
if (!UA.isOldIE) {
settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
} else {
settingDivStyles.backgroundColor = "#333";
}
applyStyles(settingDiv, settingDivStyles);
container.appendChild(settingDiv);
// Power up ace on the textarea:
var options = {};
var editor = ace.edit(editorDiv);
session = editor.getSession();
session.setValue(element.value || element.innerHTML);
editor.focus();
// Add the settingPanel opener to the editor's div.
editorDiv.appendChild(settingOpener);
// Create the API.
setupApi(editor, editorDiv, settingDiv, ace, options, loader);
// Create the setting's panel.
setupSettingPanel(settingDiv, settingOpener, editor, options);
var state = "";
event.addListener(settingOpener, "mousemove", function(e) {
var rect = this.getBoundingClientRect();
var x = e.clientX - rect.left, y = e.clientY - rect.top;
if (x + y < (rect.width + rect.height)/2) {
this.style.cursor = "pointer";
state = "toggle";
} else {
state = "resize";
this.style.cursor = "nw-resize";
}
});
event.addListener(settingOpener, "mousedown", function(e) {
if (state == "toggle") {
editor.setDisplaySettings();
return;
}
container.style.zIndex = 100000;
var rect = container.getBoundingClientRect();
var startX = rect.width + rect.left - e.clientX;
var startY = rect.height + rect.top - e.clientY;
event.capture(settingOpener, function(e) {
container.style.width = e.clientX - rect.left + startX + "px";
container.style.height = e.clientY - rect.top + startY + "px";
editor.resize();
}, function() {});
});
return editor;
};
function load(url, module, callback) {
net.loadScript(url, function() {
require([module], callback);
});
}
function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
var session = editor.getSession();
var renderer = editor.renderer;
loader = loader || load;
function toBool(value) {
return value == "true";
}
editor.setDisplaySettings = function(display) {
if (display == null)
display = settingDiv.style.display == "none";
settingDiv.style.display = display ? "block" : "none";
};
editor.setOption = function(key, value) {
if (options[key] == value) return;
switch (key) {
case "gutter":
renderer.setShowGutter(toBool(value));
break;
case "mode":
if (value != "text") {
// Load the required mode file. Files get loaded only once.
loader("mode-" + value + ".js", "ace/mode/" + value, function() {
var aceMode = require("../mode/" + value).Mode;
session.setMode(new aceMode());
});
} else {
session.setMode(new (require("../mode/text").Mode));
}
break;
case "theme":
if (value != "textmate") {
// Load the required theme file. Files get loaded only once.
loader("theme-" + value + ".js", "ace/theme/" + value, function() {
editor.setTheme("ace/theme/" + value);
});
} else {
editor.setTheme("ace/theme/textmate");
}
break;
case "fontSize":
editorDiv.style.fontSize = value;
break;
case "softWrap":
switch (value) {
case "off":
session.setUseWrapMode(false);
renderer.setPrintMarginColumn(80);
break;
case "40":
session.setUseWrapMode(true);
session.setWrapLimitRange(40, 40);
renderer.setPrintMarginColumn(40);
break;
case "80":
session.setUseWrapMode(true);
session.setWrapLimitRange(80, 80);
renderer.setPrintMarginColumn(80);
break;
case "free":
session.setUseWrapMode(true);
session.setWrapLimitRange(null, null);
renderer.setPrintMarginColumn(80);
break;
}
break;
case "useSoftTabs":
session.setUseSoftTabs(toBool(value));
break;
case "showPrintMargin":
renderer.setShowPrintMargin(toBool(value));
break;
case "showInvisibles":
editor.setShowInvisibles(toBool(value));
break;
}
options[key] = value;
};
editor.getOption = function(key) {
return options[key];
};
editor.getOptions = function() {
return options;
};
for (var option in exports.options) {
editor.setOption(option, exports.options[option]);
}
return editor;
}
function setupSettingPanel(settingDiv, settingOpener, editor, options) {
var BOOL = {
"true": true,
"false": false
};
var desc = {
mode: "Mode:",
gutter: "Display Gutter:",
theme: "Theme:",
fontSize: "Font Size:",
softWrap: "Soft Wrap:",
showPrintMargin: "Show Print Margin:",
useSoftTabs: "Use Soft Tabs:",
showInvisibles: "Show Invisibles"
};
var optionValues = {
mode: {
text: "Plain",
javascript: "JavaScript",
xml: "XML",
html: "HTML",
css: "CSS",
scss: "SCSS",
python: "Python",
php: "PHP",
java: "Java",
ruby: "Ruby",
c_cpp: "C/C++",
coffee: "CoffeeScript",
json: "json",
perl: "Perl",
clojure: "Clojure",
ocaml: "OCaml",
csharp: "C#",
haxe: "haXe",
svg: "SVG",
textile: "Textile",
groovy: "Groovy",
liquid: "Liquid",
Scala: "Scala"
},
theme: {
clouds: "Clouds",
clouds_midnight: "Clouds Midnight",
cobalt: "Cobalt",
crimson_editor: "Crimson Editor",
dawn: "Dawn",
eclipse: "Eclipse",
idle_fingers: "Idle Fingers",
kr_theme: "Kr Theme",
merbivore: "Merbivore",
merbivore_soft: "Merbivore Soft",
mono_industrial: "Mono Industrial",
monokai: "Monokai",
pastel_on_dark: "Pastel On Dark",
solarized_dark: "Solarized Dark",
solarized_light: "Solarized Light",
textmate: "Textmate",
twilight: "Twilight",
vibrant_ink: "Vibrant Ink"
},
gutter: BOOL,
fontSize: {
"10px": "10px",
"11px": "11px",
"12px": "12px",
"14px": "14px",
"16px": "16px"
},
softWrap: {
off: "Off",
40: "40",
80: "80",
free: "Free"
},
showPrintMargin: BOOL,
useSoftTabs: BOOL,
showInvisibles: BOOL
};
var table = [];
table.push("<table><tr><th>Setting</th><th>Value</th></tr>");
function renderOption(builder, option, obj, cValue) {
builder.push("<select title='" + option + "'>");
for (var value in obj) {
builder.push("<option value='" + value + "' ");
if (cValue == value) {
builder.push(" selected ");
}
builder.push(">",
obj[value],
"</option>");
}
builder.push("</select>");
}
for (var option in options) {
table.push("<tr><td>", desc[option], "</td>");
table.push("<td>");
renderOption(table, option, optionValues[option], options[option]);
table.push("</td></tr>");
}
table.push("</table>");
settingDiv.innerHTML = table.join("");
var selects = settingDiv.getElementsByTagName("select");
for (var i = 0; i < selects.length; i++) {
var onChange = (function() {
var select = selects[i];
return function() {
var option = select.title;
var value = select.value;
editor.setOption(option, value);
};
})();
selects[i].onchange = onChange;
}
var button = document.createElement("input");
button.type = "button";
button.value = "Hide";
event.addListener(button, "click", function() {
editor.setDisplaySettings(false);
});
settingDiv.appendChild(button);
}
// Default startup options.
exports.options = {
mode: "text",
theme: "textmate",
gutter: "false",
fontSize: "12px",
softWrap: "off",
showPrintMargin: "false",
useSoftTabs: "true",
showInvisibles: "true"
};
});
@@ -1,367 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Skywriter.
*
* The Initial Developer of the Original Code is
* Mozilla.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Julian Viereck (julian.viereck@gmail.com)
* Harutyun Amirjanyan (harutyun@c9.io)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var dom = require("../lib/dom");
var screenToTextBlockCoordinates = function(pageX, pageY) {
var canvasPos = this.scroller.getBoundingClientRect();
var col = Math.floor(
(pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft()) / this.characterWidth
);
var row = Math.floor(
(pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop()) / this.lineHeight
);
return this.session.screenToDocumentPosition(row, col);
};
var HashHandler = require("./hash_handler").HashHandler;
exports.handler = new HashHandler();
var initialized = false;
exports.handler.attach = function(editor) {
if (!initialized) {
initialized = true;
dom.importCssString('\
.emacs-mode .ace_cursor{\
border: 2px rgba(50,250,50,0.8) solid!important;\
-moz-box-sizing: border-box!important;\
box-sizing: border-box!important;\
background-color: rgba(0,250,0,0.9);\
opacity: 0.5;\
}\
.emacs-mode .ace_cursor.ace_hidden{\
opacity: 1;\
background-color: transparent;\
}\
.emacs-mode .ace_cursor.ace_overwrite {\
opacity: 1;\
background-color: transparent;\
border-width: 0 0 2px 2px !important;\
}\
.emacs-mode .ace_text-layer {\
z-index: 4\
}\
.emacs-mode .ace_cursor-layer {\
z-index: 2\
}', 'emacsMode'
);
}
editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
editor.setStyle("emacs-mode");
};
exports.handler.detach = function(editor) {
delete editor.renderer.screenToTextCoordinates;
editor.unsetStyle("emacs-mode");
};
var keys = require("../lib/keys").KEY_MODS;
var eMods = {
C: "ctrl", S: "shift", M: "alt"
};
["S-C-M", "S-C", "S-M", "C-M", "S", "C", "M"].forEach(function(c) {
var hashId = 0;
c.split("-").forEach(function(c){
hashId = hashId | keys[eMods[c]];
});
eMods[hashId] = c.toLowerCase() + "-";
});
exports.handler.bindKey = function(key, command) {
if (!key)
return;
var ckb = this.commmandKeyBinding;
key.split("|").forEach(function(keyPart) {
keyPart = keyPart.toLowerCase();
ckb[keyPart] = command;
keyPart = keyPart.split(" ")[0];
if (!ckb[keyPart])
ckb[keyPart] = "null";
}, this);
};
exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
if (hashId == -1) {
if (data.count) {
var str = Array(data.count + 1).join(key);
data.count = null;
return {command: "insertstring", args: str};
}
}
if (key == "\x00")
return;
var modifier = eMods[hashId];
if (modifier == "c-" || data.universalArgument) {
var count = parseInt(key[key.length - 1]);
if (count) {
data.count = count;
return {command: "null"};
}
}
data.universalArgument = false;
if (modifier)
key = modifier + key;
if (data.keyChain)
key = data.keyChain += " " + key;
var command = this.commmandKeyBinding[key];
data.keyChain = command == "null" ? key : "";
if (!command)
return;
if (command == "null")
return {command: "null"};
if (command == "universalArgument") {
data.universalArgument = true;
return {command: "null"};
}
if (typeof command != "string") {
var args = command.args;
command = command.command;
}
if (typeof command == "string") {
command = this.commands[command] || data.editor.commands.commands[command];
}
if (!command.readonly && !command.isYank)
data.lastCommand = null;
if (data.count) {
var count = data.count;
data.count = 0;
return {
args: args,
command: {
exec: function(editor, args) {
for (var i = 0; i < count; i++)
command.exec(editor, args);
}
}
};
}
return {command: command, args: args};
};
exports.emacsKeys = {
// movement
"Up|C-p" : "golineup",
"Down|C-n" : "golinedown",
"Left|C-b" : "gotoleft",
"Right|C-f" : "gotoright",
"C-Left|M-b" : "gotowordleft",
"C-Right|M-f" : "gotowordright",
"Home|C-a" : "gotolinestart",
"End|C-e" : "gotolineend",
"C-Home|S-M-,": "gotostart",
"C-End|S-M-." : "gotoend",
// selection
"S-Up|S-C-p" : "selectup",
"S-Down|S-C-n" : "selectdown",
"S-Left|S-C-b" : "selectleft",
"S-Right|S-C-f" : "selectright",
"S-C-Left|S-M-b" : "selectwordleft",
"S-C-Right|S-M-f" : "selectwordright",
"S-Home|S-C-a" : "selecttolinestart",
"S-End|S-C-e" : "selecttolineend",
"S-C-Home" : "selecttostart",
"S-C-End" : "selecttoend",
"C-l|M-s" : "centerselection",
"M-g": "gotoline",
"C-x C-p": "selectall",
// todo fix these
"C-Down": "gotopagedown",
"C-Up": "gotopageup",
"PageDown|C-v": "gotopagedown",
"PageUp|M-v": "gotopageup",
"S-C-Down": "selectpagedown",
"S-C-Up": "selectpageup",
"C-s": "findnext",
"C-r": "findprevious",
"M-C-s": "findnext",
"M-C-r": "findprevious",
"S-M-5": "replace",
// basic editing
"Backspace": "backspace",
"Delete|C-d": "del",
"Return|C-m": {command: "insertstring", args: "\n"}, // "newline"
"C-o": "splitline",
"M-d|C-Delete": {command: "killWord", args: "right"},
"C-Backspace|M-Backspace|M-Delete": {command: "killWord", args: "left"},
"C-k": "killLine",
"C-y|S-Delete": "yank",
"M-y": "yankRotate",
"C-g": "keyboardQuit",
"C-w": "killRegion",
"M-w": "killRingSave",
"C-Space": "setMark",
"C-x C-x": "exchangePointAndMark",
"C-t": "transposeletters",
"M-u": "touppercase",
"M-l": "tolowercase",
"M-/": "autocomplete",
"C-u": "universalArgument",
"M-;": "togglecomment",
"C-/|C-x u|S-C--|C-z": "undo",
"S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo?
// vertical editing
"C-x r": "selectRectangularRegion"
// todo
// "M-x" "C-x C-t" "M-t" "M-c" "F11" "C-M- "M-q"
};
exports.handler.bindKeys(exports.emacsKeys);
exports.handler.addCommands({
selectRectangularRegion: function(editor) {
editor.multiSelect.toggleBlockSelection();
},
setMark: function() {
},
exchangePointAndMark: {
exec: function(editor) {
var range = editor.selection.getRange();
editor.selection.setSelectionRange(range, !editor.selection.isBackwards());
},
readonly: true,
multiselectAction: "forEach"
},
killWord: {
exec: function(editor, dir) {
editor.clearSelection();
if (dir == "left")
editor.selection.selectWordLeft();
else
editor.selection.selectWordRight();
var range = editor.getSelectionRange();
var text = editor.session.getTextRange(range);
exports.killRing.add(text);
editor.session.remove(range);
editor.clearSelection();
},
multiselectAction: "forEach"
},
killLine: function(editor) {
editor.selection.selectLine();
var range = editor.getSelectionRange();
var text = editor.session.getTextRange(range);
exports.killRing.add(text);
editor.session.remove(range);
editor.clearSelection();
},
yank: function(editor) {
editor.onPaste(exports.killRing.get());
editor.keyBinding.$data.lastCommand = "yank";
},
yankRotate: function(editor) {
if (editor.keyBinding.$data.lastCommand != "yank")
return;
editor.undo();
editor.onPaste(exports.killRing.rotate());
editor.keyBinding.$data.lastCommand = "yank";
},
killRegion: function(editor) {
exports.killRing.add(editor.getCopyText());
editor.cut();
},
killRingSave: function(editor) {
exports.killRing.add(editor.getCopyText());
}
});
var commands = exports.handler.commands;
commands.yank.isYank = true;
commands.yankRotate.isYank = true;
exports.killRing = {
$data: [],
add: function(str) {
str && this.$data.push(str);
if (this.$data.length > 30)
this.$data.shift();
},
get: function() {
return this.$data[this.$data.length - 1] || "";
},
pop: function() {
if (this.$data.length > 1)
this.$data.pop();
return this.get();
},
rotate: function() {
this.$data.unshift(this.$data.pop());
return this.get();
}
};
});
@@ -1,170 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Skywriter.
*
* The Initial Developer of the Original Code is
* Mozilla.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* Julian Viereck (julian.viereck@gmail.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var keyUtil = require("../lib/keys");
function HashHandler(config, platform) {
this.platform = platform;
this.commands = {};
this.commmandKeyBinding = {};
this.addCommands(config);
};
(function() {
this.addCommand = function(command) {
if (this.commands[command.name])
this.removeCommand(command);
this.commands[command.name] = command;
if (command.bindKey)
this._buildKeyHash(command);
};
this.removeCommand = function(command) {
var name = (typeof command === 'string' ? command : command.name);
command = this.commands[name];
delete this.commands[name];
// exhaustive search is brute force but since removeCommand is
// not a performance critical operation this should be OK
var ckb = this.commmandKeyBinding;
for (var hashId in ckb) {
for (var key in ckb[hashId]) {
if (ckb[hashId][key] == command)
delete ckb[hashId][key];
}
}
};
this.bindKey = function(key, command) {
if(!key)
return;
if (typeof command == "function") {
this.addCommand({exec: command, bindKey: key, name: key});
return;
}
var ckb = this.commmandKeyBinding;
key.split("|").forEach(function(keyPart) {
var binding = this.parseKeys(keyPart, command);
var hashId = binding.hashId;
(ckb[hashId] || (ckb[hashId] = {}))[binding.key] = command;
}, this);
};
this.addCommands = function(commands) {
commands && Object.keys(commands).forEach(function(name) {
var command = commands[name];
if (typeof command === "string")
return this.bindKey(command, name);
if (typeof command === "function")
command = { exec: command };
if (!command.name)
command.name = name;
this.addCommand(command);
}, this);
};
this.removeCommands = function(commands) {
Object.keys(commands).forEach(function(name) {
this.removeCommand(commands[name]);
}, this);
};
this.bindKeys = function(keyList) {
Object.keys(keyList).forEach(function(key) {
this.bindKey(key, keyList[key]);
}, this);
};
this._buildKeyHash = function(command) {
var binding = command.bindKey;
if (!binding)
return;
var key = typeof binding == "string" ? binding: binding[this.platform];
this.bindKey(key, command);
};
this.parseKeys = function(keys) {
var key;
var hashId = 0;
var parts = keys.toLowerCase().trim().split(/\s*\-\s*/);
for (var i = 0, l = parts.length; i < l; i++) {
if (keyUtil.KEY_MODS[parts[i]])
hashId = hashId | keyUtil.KEY_MODS[parts[i]];
else
key = parts[i] || "-"; //when empty, the splitSafe removed a '-'
}
if (parts[0] == "text" && parts.length == 2) {
hashId = -1;
key = parts[1];
}
return {
key: key,
hashId: hashId
};
};
this.findKeyCommand = function findKeyCommand(hashId, keyString) {
var ckbr = this.commmandKeyBinding;
return ckbr[hashId] && ckbr[hashId][keyString.toLowerCase()];
};
this.handleKeyboard = function(data, hashId, keyString, keyCode) {
return {
command: this.findKeyCommand(hashId, keyString)
};
};
}).call(HashHandler.prototype)
exports.HashHandler = HashHandler;
});

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