github-markup 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3873917ff6bcce326f3db9af115b479093b5bd41
4
- data.tar.gz: 390eb33b65634cf8a3821d83c35157bc7940b565
3
+ metadata.gz: a84a52be34f80606a5f1242e796a1b46c385fb87
4
+ data.tar.gz: d36d6d7c3e3148bbdc0cb5bceea4fef4a953fe74
5
5
  SHA512:
6
- metadata.gz: 2428b43fe04c56a03fb6508aa87bec722edb08cd5afaad71c46977892943e9cf6a3c1281bd73750fb90bb27610de38a5fe947f255454004ade830eb083367472
7
- data.tar.gz: fc853cfc772810f6456c9b7933b722461adcafa109fddd78198972c34855e8355e3257e622a92af41b63e3465b325c72340630695f801106a76f49925a5addf4
6
+ metadata.gz: b555eb0a0b7b5483894380a3c25c22747e0e1cc582f3e7161b9f7eca0070047aaae84d91c328a9751e0bf27696a9c9abca0e4fb1d8c102cd2e9838c516cf3885
7
+ data.tar.gz: cc7e932e048021775673258daac64a8406f0d48fdb3951b9ab35578c51f6eb07c14ed367303f2a0c119b21e8114ab8872e15b301d75f330a8b02ecfab2a622b3
data/Gemfile CHANGED
@@ -10,5 +10,5 @@ gem "rdoc", "~>3.6"
10
10
  gem "org-ruby", "= 0.9.9"
11
11
  gem "creole", "~>0.3.6"
12
12
  gem "wikicloth", "=0.8.3"
13
- gem "asciidoctor", "= 1.5.2"
13
+ gem "asciidoctor", "= 1.5.5"
14
14
  gem "rake"
data/HISTORY.md CHANGED
@@ -1,3 +1,28 @@
1
+ ## 1.6.0 - 2017-04-03
2
+
3
+ ### Changed
4
+
5
+ * Added filename argument to all renderers for additional context
6
+ * Removed superfluous `rinku` dependency [#1035](https://github.com/github/markup/pull/1035)
7
+ * Enable source-to-source navigation for `.adoc` AsciiDoc files, plus additional attributes passed through [#1039](https://github.com/github/markup/pull/1039) and [#1041](https://github.com/github/markup/pull/1041)
8
+
9
+ ## 1.5.0 - 2017-03-27
10
+
11
+ ### Added
12
+
13
+ * Re-introduce [#537](https://github.com/github/markup/pull/537) to detect language of markup document
14
+ However `github-linguist` is optional and this gem will fallback to extensions for detection.
15
+
16
+ [Full changelog](https://github.com/github/markup/compare/v1.4.9...v1.5.0)
17
+
18
+ ## 1.4.9 - 2017-03-27
19
+
20
+ ### Changed
21
+
22
+ * Reverted [#537](https://github.com/github/markup/pull/537) to avoid extra dependencies
23
+
24
+ [Full changelog](https://github.com/github/markup/compare/v1.4.8...v1.4.9)
25
+
1
26
  ## 1.3.3 (2015-02-17)
2
27
 
3
28
  * Address a slight typo with `POSIX` [#456](https://github.com/github/markup/pull/456)
@@ -16,7 +16,6 @@ Gem::Specification.new do |s|
16
16
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
17
17
  s.require_paths = %w[lib]
18
18
 
19
- s.add_dependency "rinku"
20
19
  s.add_development_dependency 'rake', '~> 12'
21
20
  s.add_development_dependency 'activesupport', '~> 4.0'
22
21
  s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3'
@@ -1,6 +1,6 @@
1
1
  module GitHub
2
2
  module Markup
3
- VERSION = '1.5.0'
3
+ VERSION = '1.6.0'
4
4
  Version = VERSION
5
5
  end
6
6
  end
@@ -44,7 +44,7 @@ module GitHub
44
44
  content ||= File.read(filename)
45
45
 
46
46
  if impl = renderer(filename, content)
47
- impl.render(content)
47
+ impl.render(filename, content)
48
48
  else
49
49
  content
50
50
  end
@@ -54,7 +54,7 @@ module GitHub
54
54
  if content.nil?
55
55
  raise ArgumentError, 'Can not render a nil.'
56
56
  elsif markups.has_key?(symbol)
57
- markups[symbol].render(content)
57
+ markups[symbol].render(nil, content)
58
58
  else
59
59
  content
60
60
  end
@@ -22,7 +22,7 @@ module GitHub
22
22
  @name = name
23
23
  end
24
24
 
25
- def render(content)
25
+ def render(filename, content)
26
26
  rendered = execute(command, content)
27
27
  rendered = rendered.to_s.empty? ? content : rendered
28
28
  call_block(rendered, content)
@@ -17,9 +17,9 @@ module GitHub
17
17
  @loaded = true
18
18
  end
19
19
 
20
- def render(content)
20
+ def render(filename, content)
21
21
  load
22
- renderer.call(content)
22
+ renderer.call(filename, content)
23
23
  end
24
24
 
25
25
  def name
@@ -16,7 +16,7 @@ module GitHub
16
16
  # no-op by default
17
17
  end
18
18
 
19
- def render(content)
19
+ def render(filename, content)
20
20
  raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render"
21
21
  end
22
22
 
@@ -44,7 +44,7 @@ module GitHub
44
44
  raise LoadError, "no suitable markdown gem found"
45
45
  end
46
46
 
47
- def render(content)
47
+ def render(filename, content)
48
48
  load
49
49
  @renderer.call(content)
50
50
  end
@@ -9,7 +9,7 @@ module GitHub
9
9
  super(/rdoc/, ["RDoc"])
10
10
  end
11
11
 
12
- def render(content)
12
+ def render(filename, content)
13
13
  if ::RDoc::VERSION.to_i >= 4
14
14
  h = ::RDoc::Markup::ToHtml.new(::RDoc::Options.new)
15
15
  else
@@ -4,32 +4,43 @@ require "shellwords"
4
4
 
5
5
  markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new)
6
6
 
7
- markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/, ["Textile"]) do |content|
7
+ markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/, ["Textile"]) do |filename, content|
8
8
  RedCloth.new(content).to_html
9
9
  end
10
10
 
11
11
  markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new)
12
12
 
13
- markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/, ["Org"]) do |content|
13
+ markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/, ["Org"]) do |filename, content|
14
14
  Orgmode::Parser.new(content, {
15
15
  :allow_include_files => false,
16
16
  :skip_syntax_highlight => true
17
17
  }).to_html
18
18
  end
19
19
 
20
- markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/, ["Creole"]) do |content|
20
+ markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/, ["Creole"]) do |filename, content|
21
21
  Creole.creolize(content)
22
22
  end
23
23
 
24
- markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/, ["MediaWiki"]) do |content|
24
+ markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/, ["MediaWiki"]) do |filename, content|
25
25
  wikicloth = WikiCloth::WikiCloth.new(:data => content)
26
26
  WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' unless WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.include?('tt')
27
27
  wikicloth.to_html(:noedit => true)
28
28
  end
29
29
 
30
- markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |content|
30
+ markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |filename, content|
31
+ attributes = {
32
+ 'showtitle' => '@',
33
+ 'idprefix' => '',
34
+ 'idseparator' => '-',
35
+ 'docname' => File.basename(filename, (extname = File.extname(filename))),
36
+ 'docfilesuffix' => extname,
37
+ 'outfilesuffix' => extname,
38
+ 'env' => 'github',
39
+ 'env-github' => '',
40
+ 'source-highlighter' => 'html-pipeline'
41
+ }
31
42
  Asciidoctor::Compliance.unique_id_start_index = 1
32
- Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- env=github env-github source-highlighter=html-pipeline))
43
+ Asciidoctor.convert(content, :safe => :secure, :attributes => attributes)
33
44
  end
34
45
 
35
46
  command(
@@ -7,6 +7,8 @@
7
7
 
8
8
  Refer to <<another-section>> or <<another-section-1>>.
9
9
 
10
+ Navigate from {docname}{outfilesuffix} to <<another-document#,another document>>.
11
+
10
12
  == Another Section
11
13
 
12
14
  NOTE: Here is some source code.
@@ -15,6 +15,9 @@
15
15
  <div>
16
16
  <p>Refer to <a href="#another-section">Another Section</a> or <a href="#another-section-1">Another Section</a>.</p>
17
17
  </div>
18
+ <div>
19
+ <p>Navigate from README.asciidoc to <a href="another-document.asciidoc">another document</a>.</p>
20
+ </div>
18
21
  </div>
19
22
  </div>
20
23
  <div>
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-markup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-27 00:00:00.000000000 Z
11
+ date: 2017-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rinku
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement