Commit Graph

127 Commits

Author SHA1 Message Date
Stan Hu 267687993a Add comments and clean up test for !1274 2015-09-10 14:24:10 -07:00
Robert Speicher e3c97ede96 RU-BO-COOOOOOOOP 2015-09-10 16:06:24 -04:00
Robert Speicher 7cbf5e4d18 Prevent result of SyntaxHighlightFilter being sanitized 2015-09-10 15:08:06 -04:00
Stan Hu 9d3344adbb Gracefully handle errors in syntax highlighting by leaving the block unformatted
Closes #2433
2015-09-10 09:16:27 -07:00
Dmitriy Zaporozhets 0b5d627cd4 Merge branch 'master' into ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g 2015-09-09 14:56:02 +02:00
Robert Speicher 8db4628b8a Rescue from `RecordNotFound` in RedactorFilter 2015-09-01 17:59:09 -04:00
Robert Speicher 1ec68ea9c2 Default `user_can_reference?` to true when no attributes match
Now, a reference link with a `.gfm` class but without one of our
`data-*-id` attributes should be shown to the user rather than hidden.
2015-09-01 17:59:08 -04:00
Robert Speicher 7f75300573 Add RedactorFilter 2015-09-01 17:00:29 -04:00
Robert Speicher 454d227b45 Remove all permission checking from Reference filters 2015-09-01 16:58:38 -04:00
Robert Speicher c104f4d590 Remove unnecessary `strip` from `reference_class` method 2015-08-31 16:23:46 -04:00
Robert Speicher 9bb06ae9ef Make sure the main Gitlab::Markdown module gets loaded before filters 2015-08-27 16:02:49 -07:00
Robert Speicher 8e7111f79d Reference filters no longer take a custom class context option 2015-08-27 15:36:26 -07:00
Robert Speicher 4340dd3eeb Decouple Gitlab::Markdown from the GitlabMarkdownHelper
This module is now the sole source of knowledge for *how* we render
Markdown (and GFM).
2015-08-27 14:17:26 -07:00
Douwe Maan 046b283127 Groundwork for merging CI into CE 2015-08-25 18:42:46 -07:00
Robert Speicher 747fe7520b Remove trailing HTML entities from non-Rinku autolinks as well. 2015-08-20 18:25:16 -07:00
Robert Speicher 32e63ba7a1 Add `data-[type]-id` attribute to reference links
This is to let us redact them later in another filter.
2015-08-08 16:43:29 -04:00
Robert Speicher 4e22dcb6a3 Add spec to RelativeLinkFilter for Unicode filenames 2015-07-30 17:25:07 -04:00
Hiroyuki Sato 1cd2860065 Fix the image file that contains non-ascii character is not displayed 2015-07-27 16:18:12 +09:00
Dmitriy Zaporozhets 79aac2c128 Merge branch 'ignore-references' into 'master'
Don't notify users mentioned in code blocks or blockquotes.

cc @rspeicher

See merge request !753
2015-06-02 18:39:18 +00:00
Robert Speicher 9e7a9c63a5 Further limit the limited whitelist for project/group descriptions 2015-06-02 13:41:12 -04:00
Robert Speicher 023dd2907b Add a `pipeline` context option for SanitizationFilter
When this option is `:description`, we use a more restrictive whitelist.
This is used for Project and Group description fields.
2015-06-02 13:04:10 -04:00
Douwe Maan 94919c7ef6 Ignore references in blockquotes. 2015-06-02 13:17:21 +02:00
Robert Speicher 7424d2fa5b Add ExternalLinkFilter to Markdown pipeline
Forces a `rel="nofollow"` attribute on all external links.
2015-05-27 15:39:08 -04:00
Robert Speicher 5a9c5520d9 Make use of to_reference in more specs 2015-05-26 15:49:22 -04:00
Robert Speicher 81a09bc74c Support only double quotes for multi-word label references 2015-05-26 15:49:20 -04:00
Robert Speicher b88da58cb6 Add `reference_pattern` to Referable models 2015-05-26 15:48:32 -04:00
Robert Speicher 9d032cddf5 Correct the ReferenceFilter html/pipeline/filter require 2015-05-26 15:48:31 -04:00
Robert Speicher b263a33c80 Better handle label references that aren't actually references
Fixes #1690
2015-05-25 16:06:34 -04:00
Robert Speicher 212fe14c65 Customize the sanitization whitelist only once
Fixes #1651
2015-05-20 21:16:11 -04:00
Robert Speicher 8ee382087d Subclass TaskList::Filter to fix a bug
Instead of using a fork, we subclass the filter and only apply the
`task-list` class to list items that actually are task lists.

Closes #1645

See https://github.com/github/task_list/pull/60
2015-05-20 12:08:33 -04:00
Robert Speicher 7f2fb72a0a Minor RelativeLinkFilter cleanup 2015-05-13 14:08:37 -04:00
Jakub Jirutka b3276661f7 RelativeLinkFilter: refactor according to suggestions by @tsigo 2015-05-11 20:43:18 +02:00
Jakub Jirutka f7adac87fe Extract handling of relative file links to RelativeLinkFilter 2015-05-11 02:07:26 +02:00
Robert Speicher 70bbf093aa Remove class and id attributes from SanitizationFilter whitelist 2015-05-08 12:31:34 -04:00
Robert Speicher cca28c7920 Update Markdown help docs for latest changes 2015-05-06 21:04:33 -04:00
Robert Speicher 84a7675ea6 Remove title_for_issue helper 2015-04-30 17:27:33 -04:00
Robert Speicher 242bebc134 Remove special handling for the `'` problem
While `escape_once` will create this HTML entity, Nokogiri always
translates it back before it gets to IssueReferenceFilter, so there
should be no danger of erroneous issue links.
2015-04-30 16:35:27 -04:00
Robert Speicher 0027c2ddd7 Add Project#get_issue 2015-04-30 16:35:27 -04:00
Robert Speicher 466bec7caa Rename SCHEME_PATTERN to LINK_PATTERN 2015-04-30 16:35:27 -04:00
Robert Speicher cd3c24a8f3 Autolink short URLs 2015-04-30 16:35:27 -04:00
Robert Speicher 50f707e27a Update Autolink SCHEME_PATTERN 2015-04-30 16:35:26 -04:00
Robert Speicher e46d1cdd8b Add Gitlab::Markdown::SanitizationFilter
This just extends the HTML::Pipeline::SanitizationFilter with our custom
whitelist.
2015-04-30 16:35:25 -04:00
Robert Speicher aa2cc670fe Add Gitlab::Markdown::AutolinkFilter 2015-04-30 16:35:25 -04:00
Robert Speicher 382a0aa6ef Add Gitlab::Markdown::TableOfContentsFilter
Removes header and table of contents processing from Redcarpet renderer.
2015-04-30 16:35:25 -04:00
Robert Speicher a64b5e3c60 Convert UserReferenceFilter#link_to_group to use a guard clause 2015-04-25 21:26:43 -04:00
Robert Speicher 92783eae2b Refactor `UserReferenceFilter#user_link_filter` 2015-04-25 18:07:20 -04:00
Robert Speicher 9d3a1d0054 Fix docs for `push_result`
[ci skip]
2015-04-25 17:44:24 -04:00
Robert Speicher 07a88040a4 Fix NotificationService spec 2015-04-25 16:46:06 -04:00
Robert Speicher 95ca6584d8 Add CommitRange directly to results Hash 2015-04-25 14:46:06 -04:00
Robert Speicher c0a97d70ef Don't allow nil references to get added to results 2015-04-25 14:41:06 -04:00
Robert Speicher 6bac823ad4 Update CommitRangeReferenceFilter to use CommitRange class
Also matches CommitReferenceFilter's new behavior of always using short
SHAs in the link text.
2015-04-25 14:41:06 -04:00
Robert Speicher 2c8bfedb20 Always use short SHAs as commit reference link text
Now when a user pastes a full SHA like
`d7f61affaf845f44b4cc995e34eb1606c47c8eff`, its link text will only show
`d7f61aff` for brevity.
2015-04-25 14:40:40 -04:00
Robert Speicher a6defd1576 Add results to reference filters 2015-04-25 14:39:45 -04:00
Robert Speicher 879be42862 Initialize the references result Hash in ReferenceFilter 2015-04-25 14:39:44 -04:00
Douwe Maan 8ed7ac9d44 Use project.commit convenience method. 2015-04-24 12:29:36 +02:00
Robert Speicher a14d109b9b Provide autoload paths for filters to prevent circular dependency 2015-04-23 12:58:55 -04:00
Robert Speicher fb5116caa2 Use `search_text_nodes` helper in our custom filters
Closes #1477
2015-04-22 13:18:15 -04:00
Robert Speicher 4ced630fed Add Gitlab::Markdown::EmojiFilter 2015-04-21 12:53:42 -04:00
Douwe Maan c52bf4ad3c Tweak single-word label regex to fix pending spec. 2015-04-20 13:01:47 -04:00
Douwe Maan b5802d144b project_from_ref returns nil when reference doesn't exist. 2015-04-20 13:01:47 -04:00
Robert Speicher 2823c058d8 project_from_ref returns nil when reference can't be accessed
Prior it would return the project from the current context, which wasn't
the intended behavior.
2015-04-20 13:01:47 -04:00
Robert Speicher 34f1dbb143 Better commit lookup for CommitRangeReferenceFilter 2015-04-20 13:01:46 -04:00
Robert Speicher 6853465acf Remove extraneous IGNORE_PARENTS from filter 2015-04-20 13:01:46 -04:00
Robert Speicher 621687bfdf Fix `user_can_reference_project?` check 2015-04-20 13:01:46 -04:00
Robert Speicher b905702d4f Escape title attributes in references 2015-04-20 13:01:46 -04:00
Robert Speicher 31172475d2 Better guard against nil projects in ReferenceFilter 2015-04-20 13:01:46 -04:00
Robert Speicher 9eaaa7cdef Minor doc fix
[ci skip]
2015-04-20 13:01:45 -04:00
Robert Speicher 5b6c1a2182 Fix Issue and ExternalIssue reference specs 2015-04-20 13:01:45 -04:00
Robert Speicher b3b8fc6c8a DRY up reference filters using ReferenceFilter base class 2015-04-20 13:01:45 -04:00
Robert Speicher 6189b24fdd Add a ReferenceFilter base class
This will allow for the removal of a lot of duplication from the
reference filters.
2015-04-20 13:01:45 -04:00
Robert Speicher c4eb6a55f1 Fix `user_can_reference_group?` check 2015-04-20 13:01:45 -04:00
Robert Speicher 62282971e0 Rename `user_can_read_group?` to `user_can_reference_group?` 2015-04-20 13:01:44 -04:00
Robert Speicher a803cd51eb Check for project read permissions in cross-references 2015-04-20 13:01:44 -04:00
Robert Speicher 29604ff2c3 Add permission checking to UserReferenceFilter 2015-04-20 13:01:43 -04:00
Robert Speicher 189c5347be Add name-based referencing to LabelReferenceFilter 2015-04-20 13:01:43 -04:00
Robert Speicher 4cb1cc2b64 Make CommitRange and Snippets cross-referable 2015-04-20 13:01:42 -04:00
Robert Speicher 96c2b94048 Reference filters
Commit ranges, commits, external issues, issues, labels, merge requests,
snippets, users.
2015-04-20 13:01:42 -04:00