jekyll-respec 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 390de02b24f08210acec16cd074100bdf7c79455d722a54bc7725d5480079a36
4
+ data.tar.gz: fd189212e56c551b07045a165763c0dccd320e0c804b7cbe89cca9b05250bbb9
5
+ SHA512:
6
+ metadata.gz: b50427170d4f82fdd031b27399c200b649be46c42203f8e3085bdb67b727b7485cf891b641c6b59956106f3457e048427de856a498380212a79d5577bd605cf0
7
+ data.tar.gz: 53e9fcd353a0a70e36cf65f135b54fae1db8dad767ad7c59372f3412b8d8a9d392f78f26a6c762101f5bc309a9dcc1b296fcb4648438726eac4bc95a265112c7
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "jekyll"
data/LICENSE ADDED
File without changes
File without changes
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+ # coding: utf-8
3
+
4
+ lib = File.expand_path("lib", __dir__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require "jekyll-respec/version"
7
+
8
+ Gem::Specification.new do |s|
9
+ s.specification_version = 2 if s.respond_to? :specification_version=
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.rubygems_version = "2.2.2"
12
+ s.required_ruby_version = ">= 2.1.0"
13
+
14
+ s.name = "jekyll-respec"
15
+ s.version = Jekyll::Respec::VERSION
16
+ s.license = "MIT"
17
+
18
+ s.summary = "Convert markdown to HTML respec."
19
+
20
+ s.authors = ["Ludovic Roux"]
21
+ s.email = "ludovic.roux@cosmosoftware.io"
22
+ s.homepage = "https://github.com/jekyll/jekyll-respec"
23
+
24
+ # all_files = `git ls-files -z`.split("\x0")
25
+ s.files = Dir["lib/**/*"]
26
+ s.require_paths = ["lib"]
27
+
28
+ s.rdoc_options = ["--charset=UTF-8"]
29
+ s.extra_rdoc_files = %w(README.md LICENSE Gemfile jekyll-respec.gemspec)
30
+
31
+ s.add_runtime_dependency("kramdown-respec", "~> 0.0")
32
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'jekyll/converters/markdown'
4
+
5
+ module Jekyll
6
+ module Converters
7
+ # Markdown converter.
8
+ # For more info on converters see https://jekyllrb.com/docs/plugins/converters/
9
+ class Markdown < Converter
10
+
11
+ # Rubocop does not allow reader methods to have names starting with `get_`
12
+ # To ensure compatibility, this check has been disabled on this method
13
+ #
14
+ # rubocop:disable Naming/AccessorMethodName
15
+ def get_processor
16
+ case @config["markdown"].downcase
17
+ when "redcarpet" then return RedcarpetParser.new(@config)
18
+ when "kramdown" then return KramdownParser.new(@config)
19
+ when "rdiscount" then return RDiscountParser.new(@config)
20
+ when "kramdown-respec" then KramdownRespecParser.new(@config)
21
+ else
22
+ custom_processor
23
+ end
24
+ end
25
+
26
+ # Public: Provides you with a list of processors, the ones we
27
+ # support internally and the ones that you have provided to us (if you
28
+ # are not in safe mode.)
29
+
30
+ def valid_processors
31
+ %w(rdiscount kramdown kramdown-respec redcarpet) + third_party_processors
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,109 @@
1
+ # Frozen-string-literal: true
2
+
3
+ module Jekyll
4
+ module Converters
5
+ class Markdown
6
+ class KramdownRespecParser < KramdownParser
7
+
8
+ def initialize(config)
9
+ # super
10
+ unless defined?(KramdownRespec)
11
+ Jekyll::External.require_with_graceful_fail "kramdown-respec"
12
+ end
13
+ @main_fallback_highlighter = config["highlighter"] || "rouge"
14
+ @config = config["kramdown-respec"] || {}
15
+ @highlighter = nil
16
+ # setup
17
+ end
18
+
19
+ def convert(content)
20
+ document = Kramdown::Document.new(content, @config)
21
+ html_output = document.to_html
22
+ if @config["show_warnings"]
23
+ document.warnings.each do |warning|
24
+ Jekyll.logger.warn "Kramdown warning:", warning
25
+ end
26
+ end
27
+ html_output
28
+ end
29
+
30
+ private
31
+ # rubocop:disable Performance/HashEachMethods
32
+ def make_accessible(hash = @config)
33
+ hash.keys.each do |key|
34
+ hash[key.to_sym] = hash[key]
35
+ make_accessible(hash[key]) if hash[key].is_a?(Hash)
36
+ end
37
+ end
38
+ # rubocop:enable Performance/HashEachMethods
39
+
40
+ # config[kramdown][syntax_higlighter] >
41
+ # config[kramdown][enable_coderay] >
42
+ # config[highlighter]
43
+ # Where `enable_coderay` is now deprecated because Kramdown
44
+ # supports Rouge now too.
45
+
46
+ private
47
+ def highlighter
48
+ return @highlighter if @highlighter
49
+
50
+ if @config["syntax_highlighter"]
51
+ return @highlighter = @config[
52
+ "syntax_highlighter"
53
+ ]
54
+ end
55
+
56
+ @highlighter = begin
57
+ if @config.key?("enable_coderay") && @config["enable_coderay"]
58
+ Jekyll::Deprecator.deprecation_message(
59
+ "You are using 'enable_coderay', " \
60
+ "use syntax_highlighter: coderay in your configuration file."
61
+ )
62
+
63
+ "coderay"
64
+ else
65
+ @main_fallback_highlighter
66
+ end
67
+ end
68
+ end
69
+
70
+ private
71
+ def strip_coderay_prefix(hash)
72
+ hash.each_with_object({}) do |(key, val), hsh|
73
+ cleaned_key = key.to_s.gsub(%r!\Acoderay_!, "")
74
+
75
+ if key != cleaned_key
76
+ Jekyll::Deprecator.deprecation_message(
77
+ "You are using '#{key}'. Normalizing to #{cleaned_key}."
78
+ )
79
+ end
80
+
81
+ hsh[cleaned_key] = val
82
+ end
83
+ end
84
+
85
+ # If our highlighter is CodeRay we go in to merge the CodeRay defaults
86
+ # with your "coderay" key if it's there, deprecating it in the
87
+ # process of you using it.
88
+
89
+ private
90
+ def modernize_coderay_config
91
+ unless @config["coderay"].empty?
92
+ Jekyll::Deprecator.deprecation_message(
93
+ "You are using 'kramdown.coderay' in your configuration, " \
94
+ "please use 'syntax_highlighter_opts' instead."
95
+ )
96
+
97
+ @config["syntax_highlighter_opts"] = begin
98
+ strip_coderay_prefix(
99
+ @config["syntax_highlighter_opts"] \
100
+ .merge(CODERAY_DEFAULTS) \
101
+ .merge(@config["coderay"])
102
+ )
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'jekyll-respec/version'
4
+ require 'converters/markdown-respec'
5
+ require 'converters/markdown/kramdownrespec-parser'
6
+
7
+ module Respec
8
+ end
@@ -0,0 +1,8 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ module Jekyll
5
+ module Respec
6
+ VERSION = "0.0.0"
7
+ end
8
+ end
@@ -0,0 +1,53 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <% if @converter.root.options[:encoding] %>
5
+ <meta http-equiv="Content-type" content="text/html;charset=<%= @converter.root.options[:encoding] %>">
6
+ <% end %>
7
+ <%
8
+ extend ::Kramdown::Utils::Html
9
+ title = ''
10
+ h = @converter.root.children.find {|c| c.type == :header}
11
+ if h
12
+ collector = lambda {|c| c.children.collect {|cc| cc.type == :text ? escape_html(cc.value, :text) : collector.call(cc)}.join('')}
13
+ title = collector.call(h)
14
+ end
15
+ %>
16
+ <title><%= title %></title>
17
+ <meta name="generator" content="kramdown <%= ::Kramdown::VERSION %>" />
18
+ <script
19
+ src='https://www.w3.org/Tools/respec/respec-w3c'
20
+ class='remove' async></script>
21
+ <script class='remove'>
22
+ var respecConfig = {
23
+ specStatus: "ED",
24
+ editors: [{
25
+ name: "Your Name",
26
+ url: "https://your-site.com",
27
+ }],
28
+ gitHub: "some-org/mySpec",
29
+ shortName: "dahut",
30
+ xref: "web-platform",
31
+ testSuiteURI: "https://example.com/test/suite/",
32
+ };
33
+ </script>
34
+ </head>
35
+ <body>
36
+ <section id='abstract'>
37
+ <p>
38
+ This is required.
39
+ </p>
40
+ </section>
41
+ <section id='sotd'>
42
+ <p>
43
+ This is required.
44
+ </p>
45
+ </section>
46
+ <section id='conformance'>
47
+ <p>
48
+ This is required for specifications that contain normative material.
49
+ </p>
50
+ </section>
51
+ {{ content }}
52
+ </body>
53
+ </html>
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-respec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ludovic Roux
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-08-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: kramdown-respec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.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.0'
27
+ description:
28
+ email: ludovic.roux@cosmosoftware.io
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files:
32
+ - README.md
33
+ - LICENSE
34
+ - Gemfile
35
+ - jekyll-respec.gemspec
36
+ files:
37
+ - Gemfile
38
+ - LICENSE
39
+ - README.md
40
+ - jekyll-respec.gemspec
41
+ - lib/converters/markdown-respec.rb
42
+ - lib/converters/markdown/kramdownrespec-parser.rb
43
+ - lib/jekyll-respec.rb
44
+ - lib/jekyll-respec/version.rb
45
+ - lib/theme_template/_layouts/default.html
46
+ homepage: https://github.com/jekyll/jekyll-respec
47
+ licenses:
48
+ - MIT
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options:
52
+ - "--charset=UTF-8"
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 2.1.0
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubygems_version: 3.1.2
67
+ signing_key:
68
+ specification_version: 2
69
+ summary: Convert markdown to HTML respec.
70
+ test_files: []