Commit Graph
44 Commits
Author SHA1 Message Date
Robert Speicher 730625f022 Merge branch 'patch/fix-markdown-preview-wikis' into 'master'
Wiki preview URL converting problem [via Markdown]

Current implementation when rendering the preview, thinks relative links are for project repository files.

We are creating a new preview route that will define correct context data to render for wikis instead.

Fixes #2380, #1184

See merge request !3461
2016-04-07 00:17:21 +00:00
Gabriel Mazetto 1575a95b65 little refactor and improvements on specs 2016-04-06 20:09:15 -03:00
Yorick Peterse 507cbca339 Fix header link rendering when containing numbers
This fixes the problem where Markdown such as:

    ### 31st

Would get rendered as a link tag pointing to issue number 31 inside a
header tag.

See gitlab-org/gitlab-ce#14936 for more information.
2016-04-06 14:24:30 +02:00
Gabriel Mazetto 61fe0a2397 Fixed WikiPipeline and specs 2016-04-06 03:12:39 -03:00
connorshea b9abf938ed Wrap images in discussions and wikis with a link to the image source using ImageLinkFilter.
Resolves #14411.

See merge request !3464
2016-04-04 19:44:07 -06:00
Gabriel Mazetto 7d56d592cd Fixed Gollum pages link url expansion to render correctly in preview 2016-03-30 15:43:58 -03:00
Douwe Maan ae7b2ef62c Merge branch 'master' into issue_12658
# Conflicts:
#	app/models/issue.rb
#	app/views/projects/_home_panel.html.haml
#	app/views/shared/projects/_project.html.haml
#	db/schema.rb
#	spec/models/project_spec.rb
2016-03-21 23:22:21 +01:00
Douwe Maan 7c51d5efec Fix some specs 2016-03-20 22:55:08 +01:00
Arinde Eniola 367818d293 change the css class has_tooltip to has-tooltip universally 2016-03-20 21:37:22 +01:00
Douwe Maan 0ce7c1e494 Merge branch 'label-tooltip' into 'master'
Add label description in tooltip to labels in issue index and sidebar

The tooltip can get quite big, but it’s so useful to inform people about what these labels mean
new

![Screen_Shot_2016-03-08_at_11.48.28](/uploads/894baaaa1f789c3a2069a924d541e64b/Screen_Shot_2016-03-08_at_11.48.28.png)

![Screen_Shot_2016-03-08_at_11.48.20](/uploads/efe4fa0960054c4071b8f6bf83024403/Screen_Shot_2016-03-08_at_11.48.20.png)

@JobV writes on Slack:
> yeah I think it’s better than not, but I’d have to try it 😃 
> 
> cautious yes, revert if it’s annoying 😉

See merge request !3124
2016-03-19 18:55:12 +00:00
Rémy Coutable 9d15814eb0 Fix specs 2016-03-18 20:26:30 +01:00
Douglas Barbosa Alexandre 43d8bdb4f0 Restrict access to references for confidential issues 2016-03-17 20:55:59 -03:00
Robert Speicher 41de7b345b Be more intelligent about sanitizing links with unsafe protocols
This prevents false matches on relative links like
`[database](database.md)`.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/14220
2016-03-14 18:05:01 -04:00
Douwe Maan 99f08b3f72 Merge branch 'feature/cross-project-labels' into 'master'
Add support for cross project references for labels

## Summary

Support for cross project references for labels.

## Rationale

1.   Cross project label references are currently not supported in GitLab
1.   `to_reference` method signature in `Label` model breaks the abstraction introduced in `Referable`.

      `concerns/referable.rb:  def to_reference(_from_project = nil)`

      Signatures:

      ```
      label.rb:           def to_reference(format = :id)

      commit_range.rb:    def to_reference(from_project = nil)
      commit.rb:          def to_reference(from_project = nil)
      external_issue.rb:  def to_reference(_from_project = nil)
      group.rb:           def to_reference(_from_project = nil)
      issue.rb:           def to_reference(from_project = nil)
      merge_request.rb:   def to_reference(from_project = nil)
      milestone.rb:       def to_reference(from_project = nil)
      project.rb:         def to_reference(_from_project = nil)
      snippet.rb:         def to_reference(from_project = nil)
      user.rb:            def to_reference(_from_project = nil)
      ```

     This MR suggests using `def to_reference(from_project = nil, format: :id)` which makes use of keyword arguments and preserves abstract interface.

1.   We need support for cross project label references when we want to move issue to another project

     It may happen that issue description, system notes or comments contain reference to label and this reference will be invalid after moving issue to another project and will not be displayed correctly unless we have support for cross project references.

     Merge request that needs this feature: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2831


I think that cross project label references may be useful, (example: `Hey, see our issues for CI in GitLab CE! - gitab-org/gitlab-ce~"CI"`).

cc @JobV @DouweM @rspeicher 

See merge request !2966
2016-03-07 09:16:22 +00:00
Robert Speicher 0c7626f3a5 Merge branch 'rs-frontmatter-pre' into 'master'
Properly display YAML front matter in Markdown

See merge request !3072
2016-03-05 00:17:58 +00:00
Robert Speicher 8eaeda0816 Add YamlFrontMatterFilter to the PreProcessPipeline
This filter will detect YAML Front Matter and convert it to an HTML
table for prettier formatting.
2016-03-04 18:05:48 -05:00
Douwe Maan 925da3fdf8 Merge branch 'rs-wiki-pipeline-spec' into 'master'
Add a spec for WikiPipeline

Removes the specs from GollumTagsFilter that were more like integration
tests for the pipeline than unit tests of the filter.

See merge request !3054
2016-03-04 21:19:11 +00:00
Robert Speicher def6446dad Replace [[_TOC_]] tag even if toc result is blank 2016-03-03 12:41:40 -05:00
Grzegorz Bizon 34769efa79 Change content of cross project label 2016-03-03 10:41:11 +01:00
Grzegorz Bizon 62dcdef969 Improve cross project label look and feel 2016-03-03 10:41:11 +01:00
Grzegorz Bizon a472c1bfd0 Add support for cross project references for labels 2016-03-03 10:41:11 +01:00
Grzegorz Bizon 65ba4da925 Add support for keyword arguments in label reference method 2016-03-03 10:41:11 +01:00
Robert Speicher 82bc6c6229 Add a spec for WikiPipeline
Removes the specs from GollumTagsFilter that were more like integration
tests for the pipeline than unit tests of the filter.
2016-03-01 16:59:56 -05:00
Robert Speicher c9b1132217 Add FilterArray class to Banzai 2016-03-01 15:54:35 -05:00
Douwe Maan 3d1de5ba35 Merge branch 'rs-wiki-toc' into 'master'
Replace Gollum `[[_TOC_]]` tag with result of TableOfContentsFilter

Closes #2494

See merge request !2952
2016-03-01 16:06:40 +00:00
Robert Speicher 989946f337 Sanitize vbscript: links
Closes https://dev.gitlab.org/gitlab/gitlabhq/issues/2660
2016-02-23 20:42:03 -05:00
Robert Speicher bc43ad71ef Replace Gollum [[_TOC_]] tag with result of TableOfContentsFilter
Closes #2494
2016-02-23 18:25:40 -05:00
Robert Speicher 4225fd229f Sanitize data: links
Closes #13625
2016-02-21 17:33:35 -05:00
Robert Speicher f993130b13 Fix specs expecting emoji/ in image path 2016-02-13 14:03:07 -05:00
Robert Speicher 47982e50c4 Make Pipelines responsible for defining their custom whitelist
This allows for future pipelines to more easily define a custom
whitelist.
2016-02-03 17:24:08 -05:00
Robert Speicher d97742570f Increase the minimum length for commit SHA matching to 7
This is the git default and will help to prevent false positive matches.

Closes #12706
2016-01-29 19:52:29 -05:00
Benedict Etzel 6435f78a8c Whitelist raw "abbr" elements when parsing Markdown
Closes #12517
2016-01-23 20:38:06 +01:00
Douglas Barbosa Alexandre 765a2c7327 Refactoring Banzai::Filter::GollumTagsFilter 2016-01-14 12:09:31 -02:00
Douglas Barbosa Alexandre a6a5990ee5 Add Banzai::Filter::GollumTagsFilter for parsing Gollum's tags in HTML 2016-01-14 12:09:31 -02:00
Robert Speicher 65308a9c15 Add spec for single-item task lists 2016-01-07 15:25:39 -05:00
Douwe Maan 539b41929b Milestone reference is a Markdown link 2016-01-07 12:26:05 +01:00
Douwe Maan 0b66151632 Remove icon from milestone reference. 2016-01-05 16:45:53 +01:00
Douwe Maan fd91b48f24 Merge branch 'master' into milestone-ref 2016-01-05 16:40:23 +01:00
Douwe Maan a7c424515c Merge branch 'rs-relative-links-to-root' into 'master'
Support a single directory traversal in RelativeLinkFilter

Prior, if we were viewing a blob at
`https://example.com/namespace/project/blob/master/doc/some-file.md` and
it contained a relative link such as `[README](../README.md)`, the
resulting link when viewing the blob would be:
`https://example.com/namespace/project/blob/README.md` which omits the
`master` ref, resulting in a 404.

Fixes https://gitlab.com/gitlab-org/release-tools/issues/3

See merge request !2247
2016-01-05 13:32:25 +00:00
Yorick Peterse 054df415f9 Optimize CSS expressions produced by Nokogiri
Nokogiri produces inefficient XPath expressions when given CSS
expressions such as "a.gfm". Luckily these expressions can be optimized
quite easily while still achieving the same results.

In the two cases where this optimization is applied the run time has
been reduced from around 170 ms to around 15 ms.
2015-12-31 15:46:47 +01:00
Robert Speicher d9d2e8a3e8 Support a single directory traversal in RelativeLinkFilter
Prior, if we were viewing a blob at
`https://example.com/namespace/project/blob/master/doc/some-file.md` and
it contained a relative link such as `[README](../README.md)`, the
resulting link when viewing the blob would be:
`https://example.com/namespace/project/blob/README.md` which omits the
`master` ref, resulting in a 404.
2015-12-30 15:36:59 -05:00
Douwe Maan 672cbbff95 Only allow group/project members to mention @all 2015-12-24 15:33:51 +01:00
Douwe Maan 989131c530 Render milestone links as references 2015-12-24 14:43:07 +01:00
Douwe Maan 7781bda9bd Move Markdown/reference logic from Gitlab::Markdown to Banzai 2015-12-15 15:51:16 +01:00