forked from github/markup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linguist optional; fallback to filenames
- Loading branch information
Yuki Izumi
committed
Mar 27, 2017
1 parent
a970742
commit 665ab4d
Showing
9 changed files
with
52 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
require "github/markup/markdown" | ||
require "github/markup/rdoc" | ||
require "shellwords" | ||
require "linguist" | ||
|
||
markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new) | ||
|
||
markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, [Linguist::Language["Textile"]]) do |content| | ||
markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/, ["Textile"]) do |content| | ||
RedCloth.new(content).to_html | ||
end | ||
|
||
markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new) | ||
|
||
markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', [Linguist::Language["Org"]]) do |content| | ||
markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/, ["Org"]) do |content| | ||
Orgmode::Parser.new(content, { | ||
:allow_include_files => false, | ||
:skip_syntax_highlight => true | ||
}).to_html | ||
end | ||
|
||
markup(::GitHub::Markups::MARKUP_CREOLE, :creole, [Linguist::Language["Creole"]]) do |content| | ||
markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/, ["Creole"]) do |content| | ||
Creole.creolize(content) | ||
end | ||
|
||
markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, [Linguist::Language["MediaWiki"]]) do |content| | ||
markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/, ["MediaWiki"]) do |content| | ||
wikicloth = WikiCloth::WikiCloth.new(:data => content) | ||
WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' unless WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.include?('tt') | ||
wikicloth.to_html(:noedit => true) | ||
end | ||
|
||
markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, [Linguist::Language["AsciiDoc"]]) do |content| | ||
markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |content| | ||
Asciidoctor::Compliance.unique_id_start_index = 1 | ||
Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) | ||
end | ||
|
||
command( | ||
::GitHub::Markups::MARKUP_RST, | ||
"python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", | ||
[Linguist::Language["reStructuredText"]], | ||
/re?st(\.txt)?/, | ||
["reStructuredText"], | ||
"restructuredtext" | ||
) | ||
|
||
command(::GitHub::Markups::MARKUP_POD, :pod2html, [Linguist::Language["Pod"]], "pod") | ||
command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, ["Pod"], "pod") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters