jazzy 0.13.5 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/Tests.yml +52 -0
- data/.rubocop.yml +139 -24
- data/CHANGELOG.md +105 -0
- data/CONTRIBUTING.md +5 -5
- data/Dangerfile +11 -8
- data/Gemfile +3 -1
- data/Gemfile.lock +101 -77
- data/README.md +81 -13
- data/Rakefile +13 -12
- data/bin/jazzy +3 -2
- data/bin/sourcekitten +0 -0
- data/jazzy.gemspec +8 -6
- data/js/package-lock.json +30 -25
- data/js/package.json +3 -3
- data/lib/jazzy/config.rb +125 -72
- data/lib/jazzy/doc.rb +3 -1
- data/lib/jazzy/doc_builder.rb +79 -84
- data/lib/jazzy/docset_builder.rb +3 -1
- data/lib/jazzy/documentation_generator.rb +6 -2
- data/lib/jazzy/executable.rb +3 -0
- data/lib/jazzy/extensions/bitbucket/img/bitbucket.svg +11 -0
- data/lib/jazzy/{themes/apple/assets → extensions/github}/img/gh.png +0 -0
- data/lib/jazzy/extensions/gitlab/img/gitlab.svg +23 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_AMS-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_AMS-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Bold.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Bold.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Bold.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Italic.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Italic.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Italic.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Main-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-Italic.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-Italic.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Math-Italic.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Script-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Script-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Script-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size1-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size1-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size2-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size2-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size3-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size3-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size4-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size4-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- data/lib/jazzy/extensions/katex/css/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- data/lib/jazzy/extensions/katex/css/katex.min.css +1 -1
- data/lib/jazzy/extensions/katex/js/katex.min.js +1 -1
- data/lib/jazzy/gem_version.rb +3 -1
- data/lib/jazzy/highlighter.rb +17 -3
- data/lib/jazzy/jazzy_markdown.rb +112 -31
- data/lib/jazzy/podspec_documenter.rb +14 -16
- data/lib/jazzy/search_builder.rb +4 -3
- data/lib/jazzy/source_declaration/access_control_level.rb +7 -5
- data/lib/jazzy/source_declaration/type.rb +29 -3
- data/lib/jazzy/source_declaration.rb +18 -3
- data/lib/jazzy/source_document.rb +8 -5
- data/lib/jazzy/source_host.rb +111 -0
- data/lib/jazzy/source_mark.rb +8 -6
- data/lib/jazzy/source_module.rb +6 -6
- data/lib/jazzy/sourcekitten.rb +157 -86
- data/lib/jazzy/stats.rb +14 -3
- data/lib/jazzy/symbol_graph/constraint.rb +98 -0
- data/lib/jazzy/symbol_graph/ext_node.rb +116 -0
- data/lib/jazzy/symbol_graph/graph.rb +200 -0
- data/lib/jazzy/symbol_graph/relationship.rb +48 -0
- data/lib/jazzy/symbol_graph/sym_node.rb +176 -0
- data/lib/jazzy/symbol_graph/symbol.rb +248 -0
- data/lib/jazzy/symbol_graph.rb +95 -0
- data/lib/jazzy/themes/apple/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/apple/assets/css/jazzy.css.scss +26 -2
- data/lib/jazzy/themes/apple/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/apple/assets/js/jazzy.search.js +4 -0
- data/lib/jazzy/themes/apple/assets/js/jquery.min.js +2 -2
- data/lib/jazzy/themes/apple/assets/js/lunr.min.js +3 -3
- data/lib/jazzy/themes/apple/templates/doc.mustache +4 -5
- data/lib/jazzy/themes/apple/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/apple/templates/header.mustache +6 -6
- data/lib/jazzy/themes/apple/templates/task.mustache +6 -11
- data/lib/jazzy/themes/fullwidth/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/fullwidth/assets/css/jazzy.css.scss +11 -2
- data/lib/jazzy/themes/fullwidth/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/fullwidth/assets/js/jazzy.search.js +4 -0
- data/lib/jazzy/themes/fullwidth/assets/js/jquery.min.js +2 -2
- data/lib/jazzy/themes/fullwidth/assets/js/lunr.min.js +3 -3
- data/lib/jazzy/themes/fullwidth/templates/doc.mustache +4 -5
- data/lib/jazzy/themes/fullwidth/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/fullwidth/templates/header.mustache +8 -8
- data/lib/jazzy/themes/fullwidth/templates/task.mustache +6 -11
- data/lib/jazzy/themes/jony/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/jony/assets/css/jazzy.css.scss +26 -2
- data/lib/jazzy/themes/jony/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/jony/assets/js/jquery.min.js +2 -2
- data/lib/jazzy/themes/jony/templates/doc.mustache +4 -5
- data/lib/jazzy/themes/jony/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/jony/templates/header.mustache +6 -6
- data/lib/jazzy/themes/jony/templates/task.mustache +6 -11
- data/lib/jazzy.rb +2 -0
- data/spec/integration_spec.rb +59 -45
- data/spec/spec_helper/pre_flight.rb +2 -0
- data/spec/spec_helper.rb +3 -1
- metadata +39 -19
- data/.circleci/config.yml +0 -83
- data/lib/jazzy/themes/fullwidth/assets/img/gh.png +0 -0
- data/lib/jazzy/themes/jony/assets/img/gh.png +0 -0
- data/spec/sourcekitten_spec.rb +0 -6
data/lib/jazzy/doc_builder.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fileutils'
|
2
4
|
require 'mustache'
|
3
5
|
require 'pathname'
|
@@ -14,6 +16,7 @@ require 'jazzy/source_declaration'
|
|
14
16
|
require 'jazzy/source_document'
|
15
17
|
require 'jazzy/source_module'
|
16
18
|
require 'jazzy/sourcekitten'
|
19
|
+
require 'jazzy/symbol_graph'
|
17
20
|
|
18
21
|
module Jazzy
|
19
22
|
# This module handles HTML generation, file writing, asset copying,
|
@@ -50,8 +53,8 @@ module Jazzy
|
|
50
53
|
|
51
54
|
def self.children_for_doc(doc)
|
52
55
|
doc.children
|
53
|
-
|
54
|
-
|
56
|
+
.sort_by { |c| [c.nav_order, c.name, c.usr || ''] }
|
57
|
+
.flat_map do |child|
|
55
58
|
# FIXME: include arbitrarily nested extensible types
|
56
59
|
[{ name: child.name, url: child.url }] +
|
57
60
|
Array(child.children.select do |sub_child|
|
@@ -67,11 +70,12 @@ module Jazzy
|
|
67
70
|
# @return [SourceModule] the documented source module
|
68
71
|
def self.build(options)
|
69
72
|
if options.sourcekitten_sourcefile_configured
|
70
|
-
stdout =
|
71
|
-
.join(',') + ']'
|
73
|
+
stdout = "[#{options.sourcekitten_sourcefile.map(&:read).join(',')}]"
|
72
74
|
elsif options.podspec_configured
|
73
75
|
pod_documenter = PodspecDocumenter.new(options.podspec)
|
74
76
|
stdout = pod_documenter.sourcekitten_output(options)
|
77
|
+
elsif options.swift_build_tool == :symbolgraph
|
78
|
+
stdout = SymbolGraph.build(options)
|
75
79
|
else
|
76
80
|
stdout = Dir.chdir(options.source_directory) do
|
77
81
|
arguments = SourceKitten.arguments_from_options(options)
|
@@ -101,6 +105,7 @@ module Jazzy
|
|
101
105
|
def self.each_doc(output_dir, docs, &block)
|
102
106
|
docs.each do |doc|
|
103
107
|
next unless doc.render_as_page?
|
108
|
+
|
104
109
|
# Filepath is relative to documentation root:
|
105
110
|
path = output_dir + doc.filepath
|
106
111
|
block.call(doc, path)
|
@@ -129,8 +134,8 @@ module Jazzy
|
|
129
134
|
SearchBuilder.build(source_module, output_dir)
|
130
135
|
end
|
131
136
|
|
132
|
-
|
133
|
-
|
137
|
+
copy_extensions(source_module, output_dir)
|
138
|
+
copy_theme_assets(output_dir)
|
134
139
|
|
135
140
|
DocsetBuilder.new(output_dir, source_module).build!
|
136
141
|
|
@@ -167,7 +172,7 @@ module Jazzy
|
|
167
172
|
|
168
173
|
def self.relative_path_if_inside(path, base_path)
|
169
174
|
relative = path.relative_path_from(base_path)
|
170
|
-
if relative.to_path =~ %r{/^..(
|
175
|
+
if relative.to_path =~ %r{/^..(/|$)/}
|
171
176
|
path
|
172
177
|
else
|
173
178
|
relative
|
@@ -178,7 +183,7 @@ module Jazzy
|
|
178
183
|
decls.map do |decl|
|
179
184
|
{
|
180
185
|
file: decl.file,
|
181
|
-
line: decl.
|
186
|
+
line: decl.start_line || decl.line,
|
182
187
|
symbol: decl.fully_qualified_name,
|
183
188
|
symbol_kind: decl.type.kind,
|
184
189
|
warning: 'undocumented',
|
@@ -192,7 +197,10 @@ module Jazzy
|
|
192
197
|
|
193
198
|
lint_report = {
|
194
199
|
warnings: warnings.sort_by do |w|
|
195
|
-
[w[:file]
|
200
|
+
[w[:file] || Pathname(''),
|
201
|
+
w[:line] || 0,
|
202
|
+
w[:symbol],
|
203
|
+
w[:symbol_kind]]
|
196
204
|
end,
|
197
205
|
source_directory: options.source_directory,
|
198
206
|
}
|
@@ -200,7 +208,7 @@ module Jazzy
|
|
200
208
|
end
|
201
209
|
end
|
202
210
|
|
203
|
-
def self.
|
211
|
+
def self.copy_theme_assets(destination)
|
204
212
|
assets_directory = Config.instance.theme_directory + 'assets'
|
205
213
|
FileUtils.cp_r(assets_directory.children, destination)
|
206
214
|
Pathname.glob(destination + 'css/**/*.scss').each do |scss|
|
@@ -211,12 +219,15 @@ module Jazzy
|
|
211
219
|
end
|
212
220
|
end
|
213
221
|
|
214
|
-
def self.copy_extensions(destination)
|
222
|
+
def self.copy_extensions(source_module, destination)
|
223
|
+
if source_host = source_module.host&.extension
|
224
|
+
copy_extension(source_host, destination)
|
225
|
+
end
|
215
226
|
copy_extension('katex', destination) if Markdown.has_math
|
216
227
|
end
|
217
228
|
|
218
229
|
def self.copy_extension(name, destination)
|
219
|
-
ext_directory = Pathname(
|
230
|
+
ext_directory = Pathname(__dir__) / 'extensions' / name
|
220
231
|
FileUtils.cp_r(ext_directory.children, destination)
|
221
232
|
end
|
222
233
|
|
@@ -225,26 +236,42 @@ module Jazzy
|
|
225
236
|
SourceKitten.autolink_document(html, doc_model)
|
226
237
|
end
|
227
238
|
|
239
|
+
def self.render_inline(doc_model, markdown)
|
240
|
+
html = Markdown.render_inline(markdown)
|
241
|
+
SourceKitten.autolink_document(html, doc_model)
|
242
|
+
end
|
243
|
+
|
244
|
+
# Build Mustache document - common fields between page types
|
245
|
+
def self.new_document(source_module, doc_model)
|
246
|
+
Doc.new.tap do |doc|
|
247
|
+
doc[:custom_head] = Config.instance.custom_head
|
248
|
+
doc[:disable_search] = Config.instance.disable_search
|
249
|
+
doc[:doc_coverage] = source_module.doc_coverage unless
|
250
|
+
Config.instance.hide_documentation_coverage
|
251
|
+
doc[:structure] = source_module.doc_structure
|
252
|
+
doc[:module_name] = source_module.name
|
253
|
+
doc[:author_name] = source_module.author_name
|
254
|
+
if source_host = source_module.host
|
255
|
+
doc[:source_host_name] = source_host.name
|
256
|
+
doc[:source_host_url] = source_host.url
|
257
|
+
doc[:source_host_image] = source_host.image
|
258
|
+
doc[:source_host_item_url] = source_host.item_url(doc_model)
|
259
|
+
doc[:github_url] = doc[:source_host_url]
|
260
|
+
doc[:github_token_url] = doc[:source_host_item_url]
|
261
|
+
end
|
262
|
+
doc[:dash_url] = source_module.dash_url
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
228
266
|
# Build Mustache document from a markdown source file
|
229
|
-
# @param [
|
267
|
+
# @param [SourceModule] module-wide settings
|
230
268
|
# @param [Hash] doc_model Parsed doc. @see SourceKitten.parse
|
231
269
|
# @param [String] path_to_root
|
232
|
-
# @param [Array] doc_structure doc structure comprised of section names and
|
233
|
-
# child names and URLs. @see doc_structure_for_docs
|
234
270
|
def self.document_markdown(source_module, doc_model, path_to_root)
|
235
|
-
doc =
|
271
|
+
doc = new_document(source_module, doc_model)
|
236
272
|
name = doc_model.name == 'index' ? source_module.name : doc_model.name
|
237
273
|
doc[:name] = name
|
238
274
|
doc[:overview] = render(doc_model, doc_model.content(source_module))
|
239
|
-
doc[:custom_head] = Config.instance.custom_head
|
240
|
-
doc[:disable_search] = Config.instance.disable_search
|
241
|
-
doc[:doc_coverage] = source_module.doc_coverage unless
|
242
|
-
Config.instance.hide_documentation_coverage
|
243
|
-
doc[:structure] = source_module.doc_structure
|
244
|
-
doc[:module_name] = source_module.name
|
245
|
-
doc[:author_name] = source_module.author_name
|
246
|
-
doc[:github_url] = source_module.github_url
|
247
|
-
doc[:dash_url] = source_module.dash_url
|
248
275
|
doc[:path_to_root] = path_to_root
|
249
276
|
doc[:hide_name] = true
|
250
277
|
doc.render.gsub(ELIDED_AUTOLINK_TOKEN, path_to_root)
|
@@ -318,30 +345,6 @@ module Jazzy
|
|
318
345
|
end
|
319
346
|
# rubocop:enable Metrics/MethodLength
|
320
347
|
|
321
|
-
def self.should_link_to_github(file)
|
322
|
-
return unless file
|
323
|
-
file = file.realpath.to_path
|
324
|
-
source_directory = Config.instance.source_directory.to_path
|
325
|
-
file.start_with?(source_directory)
|
326
|
-
end
|
327
|
-
|
328
|
-
# Construct Github token URL
|
329
|
-
# @param [Hash] item Parsed doc child item
|
330
|
-
# @param [Config] options Build options
|
331
|
-
def self.gh_token_url(item, source_module)
|
332
|
-
return unless github_prefix = source_module.github_file_prefix
|
333
|
-
return unless should_link_to_github(item.file)
|
334
|
-
gh_line = if item.start_line && (item.start_line != item.end_line)
|
335
|
-
"#L#{item.start_line}-L#{item.end_line}"
|
336
|
-
else
|
337
|
-
"#L#{item.line}"
|
338
|
-
end
|
339
|
-
relative_file_path = item.file.realpath.relative_path_from(
|
340
|
-
source_module.root_path,
|
341
|
-
)
|
342
|
-
"#{github_prefix}/#{relative_file_path}#{gh_line}"
|
343
|
-
end
|
344
|
-
|
345
348
|
# Build mustache item for a top-level doc
|
346
349
|
# @param [Hash] item Parsed doc child item
|
347
350
|
# @param [Config] options Build options
|
@@ -349,27 +352,31 @@ module Jazzy
|
|
349
352
|
def self.render_item(item, source_module)
|
350
353
|
# Combine abstract and discussion into abstract
|
351
354
|
abstract = (item.abstract || '') + (item.discussion || '')
|
355
|
+
source_host_item_url = source_module.host&.item_url(item)
|
352
356
|
{
|
353
|
-
name:
|
354
|
-
name_html:
|
355
|
-
abstract:
|
356
|
-
declaration:
|
357
|
-
language:
|
357
|
+
name: item.name,
|
358
|
+
name_html: item.name.gsub(':', ':<wbr>'),
|
359
|
+
abstract: abstract,
|
360
|
+
declaration: item.display_declaration,
|
361
|
+
language: item.display_language,
|
358
362
|
other_language_declaration: item.display_other_language_declaration,
|
359
|
-
usr:
|
360
|
-
dash_type:
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
363
|
+
usr: item.usr,
|
364
|
+
dash_type: item.type.dash_type,
|
365
|
+
source_host_item_url: source_host_item_url,
|
366
|
+
github_token_url: source_host_item_url,
|
367
|
+
default_impl_abstract: item.default_impl_abstract,
|
368
|
+
from_protocol_extension: item.from_protocol_extension,
|
369
|
+
return: item.return,
|
370
|
+
parameters: (item.parameters if item.parameters.any?),
|
371
|
+
url: (item.url if item.render_as_page?),
|
372
|
+
start_line: item.start_line,
|
373
|
+
end_line: item.end_line,
|
374
|
+
direct_link: item.omit_content_from_parent?,
|
375
|
+
deprecation_message: item.deprecation_message,
|
376
|
+
unavailable_message: item.unavailable_message,
|
377
|
+
usage_discouraged: item.usage_discouraged?,
|
378
|
+
async: item.async,
|
379
|
+
declaration_note: item.declaration_note,
|
373
380
|
}
|
374
381
|
end
|
375
382
|
# rubocop:enable Metrics/MethodLength
|
@@ -377,7 +384,7 @@ module Jazzy
|
|
377
384
|
def self.make_task(mark, uid, items, doc_model)
|
378
385
|
{
|
379
386
|
name: mark.name,
|
380
|
-
name_html: (
|
387
|
+
name_html: (render_inline(doc_model, mark.name) if mark.name),
|
381
388
|
uid: ERB::Util.url_encode(uid),
|
382
389
|
items: items,
|
383
390
|
pre_separator: mark.has_start_dash,
|
@@ -406,12 +413,10 @@ module Jazzy
|
|
406
413
|
end
|
407
414
|
|
408
415
|
# rubocop:disable Metrics/MethodLength
|
409
|
-
# Build Mustache document from single parsed
|
410
|
-
# @param [
|
416
|
+
# Build Mustache document from single parsed decl
|
417
|
+
# @param [SourceModule] module-wide settings
|
411
418
|
# @param [Hash] doc_model Parsed doc. @see SourceKitten.parse
|
412
419
|
# @param [String] path_to_root
|
413
|
-
# @param [Array] doc_structure doc structure comprised of section names and
|
414
|
-
# child names and URLs. @see doc_structure_for_docs
|
415
420
|
def self.document(source_module, doc_model, path_to_root)
|
416
421
|
if doc_model.type.markdown?
|
417
422
|
return document_markdown(source_module, doc_model, path_to_root)
|
@@ -423,11 +428,7 @@ module Jazzy
|
|
423
428
|
overview = render(doc_model, alternative_abstract) + overview
|
424
429
|
end
|
425
430
|
|
426
|
-
doc =
|
427
|
-
doc[:custom_head] = Config.instance.custom_head
|
428
|
-
doc[:disable_search] = Config.instance.disable_search
|
429
|
-
doc[:doc_coverage] = source_module.doc_coverage unless
|
430
|
-
Config.instance.hide_documentation_coverage
|
431
|
+
doc = new_document(source_module, doc_model)
|
431
432
|
doc[:name] = doc_model.name
|
432
433
|
doc[:kind] = doc_model.type.name
|
433
434
|
doc[:dash_type] = doc_model.type.dash_type
|
@@ -438,13 +439,7 @@ module Jazzy
|
|
438
439
|
doc[:overview] = overview
|
439
440
|
doc[:parameters] = doc_model.parameters
|
440
441
|
doc[:return] = doc_model.return
|
441
|
-
doc[:structure] = source_module.doc_structure
|
442
442
|
doc[:tasks] = render_tasks(source_module, doc_model.children)
|
443
|
-
doc[:module_name] = source_module.name
|
444
|
-
doc[:author_name] = source_module.author_name
|
445
|
-
doc[:github_url] = source_module.github_url
|
446
|
-
doc[:github_token_url] = gh_token_url(doc_model, source_module)
|
447
|
-
doc[:dash_url] = source_module.dash_url
|
448
443
|
doc[:path_to_root] = path_to_root
|
449
444
|
doc[:deprecation_message] = doc_model.deprecation_message
|
450
445
|
doc[:unavailable_message] = doc_model.unavailable_message
|
data/lib/jazzy/docset_builder.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'mustache'
|
2
4
|
require 'sqlite3'
|
3
5
|
|
@@ -89,7 +91,7 @@ module Jazzy
|
|
89
91
|
(output_dir + "#{source_module.name}.xml").open('w') do |xml|
|
90
92
|
url = URI.join(config.root_url, "docsets/#{source_module.name}.tgz")
|
91
93
|
xml << "<entry><version>#{config.version}</version><url>#{url}" \
|
92
|
-
|
94
|
+
"</url></entry>\n"
|
93
95
|
end
|
94
96
|
end
|
95
97
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pathname'
|
2
4
|
|
3
5
|
require 'jazzy/jazzy_markdown'
|
@@ -12,19 +14,21 @@ module Jazzy
|
|
12
14
|
SourceDocument.new.tap do |sd|
|
13
15
|
sd.name = File.basename(file_path, '.md')
|
14
16
|
sd.overview = overview Pathname(file_path)
|
15
|
-
sd.usr =
|
17
|
+
sd.usr = "documentation.#{sd.name}"
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.overview(file_path)
|
21
|
-
return '' unless file_path
|
23
|
+
return '' unless file_path&.exist?
|
24
|
+
|
22
25
|
file_path.read
|
23
26
|
end
|
24
27
|
|
25
28
|
def self.documentation_entries
|
26
29
|
return [] unless
|
27
30
|
config.documentation_glob_configured && config.documentation_glob
|
31
|
+
|
28
32
|
config.documentation_glob.select { |e| File.file? e }
|
29
33
|
end
|
30
34
|
end
|
data/lib/jazzy/executable.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<svg fill="none" version="1.1" viewBox="0 0 24 21.58" xmlns="http://www.w3.org/2000/svg">
|
3
|
+
<path d="m22.95 7.2332h-7.1932l-1.1989 7.0734h-4.9953l-5.8745 6.9934s0.27972 0.2398 0.67935 0.2398h15.665c0.3597 0 0.6794-0.2797 0.7593-0.6394z" fill="url(#paint0_linear)"/>
|
4
|
+
<path d="m0.77041 0c-0.47956 0-0.83918 0.43959-0.75926 0.87918l3.237 19.822c0.03996 0.2398 0.15986 0.4796 0.35968 0.6394 0 0 0.27972 0.2398 0.67935 0.2398l6.0743-7.2732h-0.8392l-1.3188-7.0734h14.746l1.039-6.3541c0.08-0.47955-0.2797-0.87918-0.7593-0.87918z" fill="#fff"/>
|
5
|
+
<defs>
|
6
|
+
<linearGradient id="paint0_linear" x1="27.898" x2="16.618" y1="15.387" y2="23.023" gradientTransform="translate(-4 -5)" gradientUnits="userSpaceOnUse">
|
7
|
+
<stop stop-color="#fff" stop-opacity=".4" offset=".071833"/>
|
8
|
+
<stop stop-color="#fff" offset="1"/>
|
9
|
+
</linearGradient>
|
10
|
+
</defs>
|
11
|
+
</svg>
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<svg
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
3
|
+
height="313.44601"
|
4
|
+
width="338.96616"
|
5
|
+
xml:space="preserve"
|
6
|
+
viewBox="0 0 338.96616 313.44601"
|
7
|
+
y="0px"
|
8
|
+
x="0px"
|
9
|
+
version="1.1">
|
10
|
+
<style
|
11
|
+
id="style10"
|
12
|
+
type="text/css">
|
13
|
+
.st2{fill:#FFFFFF;}
|
14
|
+
</style>
|
15
|
+
<g
|
16
|
+
transform="translate(-123.54995,-122.776)"
|
17
|
+
id="logo_art">
|
18
|
+
<path
|
19
|
+
id="path12"
|
20
|
+
d="m 461.514,298.355 -18.049,-55.587 c 0.008,0.025 0.011,0.051 0.019,0.076 -0.009,-0.029 -0.014,-0.058 -0.022,-0.087 -10e-4,-0.002 -10e-4,-0.003 -10e-4,-0.005 0,-0.001 0,-0.002 0,-0.002 l -35.83,-110.31 c -1.96,-5.811 -7.353,-9.711 -13.536,-9.663 -6.201,0.032 -11.446,3.857 -13.364,9.748 L 346.721,237.23 H 239.408 L 205.334,132.518 c -1.916,-5.886 -7.162,-9.71 -13.362,-9.742 -0.025,0 -0.049,0 -0.075,0 -6.105,0 -11.509,3.876 -13.49,9.752 l -35.732,110.211 -0.005,0.014 c 0,0.001 0,0.002 0,0.003 -0.009,0.028 -0.013,0.056 -0.022,0.084 0.008,-0.025 0.011,-0.051 0.019,-0.076 l -18.115,55.591 c -2.725,8.392 0.232,17.512 7.36,22.697 L 288.328,434.7 c 0.023,0.017 0.049,0.027 0.072,0.044 0.067,0.048 0.132,0.097 0.2,0.142 -0.064,-0.043 -0.124,-0.09 -0.187,-0.134 0,0 0,-0.001 -0.001,-0.001 0.01,0.008 0.022,0.013 0.033,0.02 0.009,0.006 0.018,0.01 0.027,0.016 0.001,0.001 0.002,0.002 0.004,0.003 0.242,0.168 0.493,0.322 0.753,0.463 0.036,0.02 0.068,0.045 0.104,0.064 10e-4,0 10e-4,10e-4 0.002,10e-4 0.022,0.011 0.042,0.025 0.064,0.036 0.017,0.008 0.035,0.013 0.051,0.021 0.012,0.006 0.025,0.01 0.037,0.015 0.029,0.014 0.061,0.023 0.09,0.038 0.136,0.065 0.279,0.118 0.419,0.175 0.131,0.054 0.258,0.117 0.392,0.164 0.006,0.002 0.011,0.005 0.017,0.007 0.022,0.008 0.042,0.019 0.065,0.027 0.028,0.01 0.055,0.021 0.083,0.03 0.011,0.003 0.022,0.005 0.033,0.008 0.035,0.011 0.073,0.016 0.108,0.026 0.013,0.004 0.028,0.006 0.042,0.01 0.188,0.057 0.383,0.098 0.577,0.141 0.076,0.017 0.149,0.041 0.226,0.055 0.011,0.002 0.021,0.006 0.033,0.008 0.025,0.005 0.048,0.014 0.074,0.018 0.041,0.007 0.081,0.02 0.123,0.026 0.033,0.005 0.067,0.003 0.1,0.008 0.006,0.001 0.011,0 0.017,0.001 0.002,0 0.003,0 0.005,0 0.369,0.053 0.743,0.09 1.124,0.09 0.002,0 0.004,0 0.007,0 v 0 c 0.001,0 0.002,0 0.002,0 0,0 10e-4,0 10e-4,0 0.001,0 0.002,0 0.003,0 0.382,0 0.756,-0.037 1.126,-0.09 10e-4,0 0.003,0 0.004,0 0.006,-0.001 0.012,0 0.018,-0.001 0.033,-0.005 0.068,-0.003 0.101,-0.008 0.042,-0.007 0.082,-0.019 0.124,-0.026 0.025,-0.004 0.048,-0.013 0.073,-0.018 0.011,-0.002 0.021,-0.006 0.032,-0.008 0.078,-0.015 0.153,-0.039 0.231,-0.056 0.191,-0.042 0.383,-0.083 0.57,-0.139 0.013,-0.004 0.026,-0.005 0.039,-0.009 0.037,-0.011 0.075,-0.016 0.112,-0.027 0.011,-0.004 0.023,-0.005 0.034,-0.008 0.029,-0.009 0.057,-0.021 0.085,-0.031 0.022,-0.008 0.042,-0.019 0.064,-0.027 0.006,-0.002 0.011,-0.005 0.017,-0.007 0.142,-0.05 0.276,-0.116 0.415,-0.173 0.129,-0.054 0.261,-0.102 0.387,-0.162 0.031,-0.015 0.064,-0.024 0.094,-0.039 0.012,-0.006 0.026,-0.01 0.038,-0.016 0.017,-0.008 0.035,-0.013 0.052,-0.022 0.023,-0.012 0.045,-0.026 0.067,-0.037 0,0 10e-4,0 10e-4,-10e-4 0.037,-0.019 0.07,-0.046 0.107,-0.066 0.258,-0.14 0.508,-0.293 0.749,-0.46 0.019,-0.013 0.041,-0.023 0.061,-0.037 0.005,-0.004 0.011,-0.006 0.016,-0.01 0.023,-0.017 0.05,-0.028 0.073,-0.045 l 156.44,-113.65 c 7.124,-5.182 10.081,-14.302 7.356,-22.694 z m -67.32,-155.581 30.68,94.456 h -61.36 z m 25.307,110.428 -12.519,16.041 -92.334,118.307 43.677,-134.348 z M 285.428,430.707 c 0,0 0,0 0,0 0.008,0.024 0.021,0.046 0.029,0.071 -0.008,-0.025 -0.021,-0.047 -0.029,-0.071 z M 271.42,387.558 166.624,253.202 v 0 h 61.18 z m -79.545,-244.785 30.737,94.457 h -61.36 z m -50.571,165.36 c -1.516,-1.103 -2.144,-3.05 -1.563,-4.838 l 13.466,-41.325 98.67,126.502 z m 146.749,126.356 c -0.031,-0.025 -0.061,-0.052 -0.091,-0.078 -0.006,-0.005 -0.012,-0.012 -0.019,-0.017 -0.06,-0.05 -0.119,-0.101 -0.177,-0.153 -0.114,-0.099 -0.226,-0.2 -0.333,-0.306 0.009,0.008 0.019,0.015 0.028,0.023 0.012,0.011 0.025,0.02 0.037,0.031 0.229,0.219 0.47,0.425 0.722,0.615 0.003,0.002 0.005,0.005 0.008,0.007 0.012,0.009 0.022,0.02 0.034,0.03 -0.069,-0.05 -0.141,-0.098 -0.209,-0.152 z m 4.975,-32.097 -25.665,-79.059 -22.766,-70.131 h 96.933 z m 5.253,31.849 c -0.06,0.052 -0.118,0.104 -0.179,0.154 -0.007,0.006 -0.014,0.013 -0.021,0.019 -0.031,0.025 -0.06,0.052 -0.09,0.077 -0.066,0.053 -0.138,0.101 -0.207,0.152 0.012,-0.009 0.022,-0.021 0.035,-0.029 0.002,-0.002 0.004,-0.004 0.006,-0.006 0.252,-0.19 0.492,-0.394 0.719,-0.613 0.009,-0.009 0.02,-0.016 0.029,-0.024 0.012,-0.011 0.025,-0.02 0.036,-0.031 -0.106,0.103 -0.217,0.203 -0.328,0.301 z M 444.766,308.13 334.209,388.447 432.912,261.98 l 13.412,41.307 c 0.582,1.796 -0.045,3.743 -1.558,4.843 z"
|
21
|
+
class="st2" />
|
22
|
+
</g>
|
23
|
+
</svg>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|