Rename MarkdownHelper to MarkupHelper
This commit is contained in:
parent
b61a44fe1a
commit
daa0925016
|
@ -233,15 +233,15 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def markup?(filename)
|
||||
Gitlab::MarkdownHelper.markup?(filename)
|
||||
Gitlab::MarkupHelper.markup?(filename)
|
||||
end
|
||||
|
||||
def gitlab_markdown?(filename)
|
||||
Gitlab::MarkdownHelper.gitlab_markdown?(filename)
|
||||
Gitlab::MarkupHelper.gitlab_markdown?(filename)
|
||||
end
|
||||
|
||||
def asciidoc?(filename)
|
||||
Gitlab::MarkdownHelper.asciidoc?(filename)
|
||||
Gitlab::MarkupHelper.asciidoc?(filename)
|
||||
end
|
||||
|
||||
# Overrides ActionView::Helpers::UrlHelper#link_to to add `rel="nofollow"` to
|
||||
|
|
|
@ -55,7 +55,7 @@ module BlobHelper
|
|||
end
|
||||
|
||||
def editing_preview_title(filename)
|
||||
if Gitlab::MarkdownHelper.previewable?(filename)
|
||||
if Gitlab::MarkupHelper.previewable?(filename)
|
||||
'Preview'
|
||||
else
|
||||
'Preview changes'
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
class Tree
|
||||
include Gitlab::MarkdownHelper
|
||||
include Gitlab::MarkupHelper
|
||||
|
||||
attr_accessor :repository, :sha, :path, :entries
|
||||
|
||||
def initialize(repository, sha, path = '/')
|
||||
path = '/' if path.blank?
|
||||
|
||||
|
||||
@repository = repository
|
||||
@sha = sha
|
||||
@path = path
|
||||
|
@ -20,7 +20,7 @@ class Tree
|
|||
available_readmes = blobs.select(&:readme?)
|
||||
|
||||
if available_readmes.count == 0
|
||||
return @readme = nil
|
||||
return @readme = nil
|
||||
end
|
||||
|
||||
# Take the first previewable readme, or the first available readme, if we
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module Gitlab
|
||||
module MarkdownHelper
|
||||
module MarkupHelper
|
||||
module_function
|
||||
|
||||
# Public: Determines if a given filename is compatible with GitHub::Markup.
|
|
@ -1,40 +1,40 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Gitlab::MarkdownHelper do
|
||||
describe Gitlab::MarkupHelper do
|
||||
describe '#markup?' do
|
||||
%w(textile rdoc org creole wiki
|
||||
mediawiki rst adoc ad asciidoc).each do |type|
|
||||
it "returns true for #{type} files" do
|
||||
expect(Gitlab::MarkdownHelper.markup?("README.#{type}")).to be_truthy
|
||||
expect(Gitlab::MarkupHelper.markup?("README.#{type}")).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns false when given a non-markup filename' do
|
||||
expect(Gitlab::MarkdownHelper.markup?('README.rb')).not_to be_truthy
|
||||
expect(Gitlab::MarkupHelper.markup?('README.rb')).not_to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
describe '#gitlab_markdown?' do
|
||||
%w(mdown md markdown).each do |type|
|
||||
it "returns true for #{type} files" do
|
||||
expect(Gitlab::MarkdownHelper.gitlab_markdown?("README.#{type}")).to be_truthy
|
||||
expect(Gitlab::MarkupHelper.gitlab_markdown?("README.#{type}")).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns false when given a non-markdown filename' do
|
||||
expect(Gitlab::MarkdownHelper.gitlab_markdown?('README.rb')).not_to be_truthy
|
||||
expect(Gitlab::MarkupHelper.gitlab_markdown?('README.rb')).not_to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
describe '#asciidoc?' do
|
||||
%w(adoc ad asciidoc ADOC).each do |type|
|
||||
it "returns true for #{type} files" do
|
||||
expect(Gitlab::MarkdownHelper.asciidoc?("README.#{type}")).to be_truthy
|
||||
expect(Gitlab::MarkupHelper.asciidoc?("README.#{type}")).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns false when given a non-asciidoc filename' do
|
||||
expect(Gitlab::MarkdownHelper.asciidoc?('README.rb')).not_to be_truthy
|
||||
expect(Gitlab::MarkupHelper.asciidoc?('README.rb')).not_to be_truthy
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue