jazzy 0.8.0 → 0.8.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +1 -1
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Commandant +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Resources/Info.plist +6 -6
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Resources/Info.plist +6 -6
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Result +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/Resources/Info.plist +5 -5
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/SWXMLHash +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Yams.framework/Versions/A/Resources/Info.plist +7 -7
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Yams.framework/Versions/A/Yams +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftCore.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftCoreGraphics.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftDarwin.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftDispatch.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftFoundation.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftIOKit.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftObjectiveC.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Resources/Info.plist +6 -6
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/SourceKittenFramework +0 -0
- data/lib/jazzy/SourceKitten/bin/sourcekitten +0 -0
- data/lib/jazzy/doc.rb +1 -1
- data/lib/jazzy/doc_builder.rb +2 -2
- data/lib/jazzy/gem_version.rb +1 -1
- data/lib/jazzy/jazzy_markdown.rb +162 -95
- data/lib/jazzy/sourcekitten.rb +9 -26
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a26b03c9b41e98642beb50df0f4dd95c04675d00
|
|
4
|
+
data.tar.gz: ca8d320c44e4697c6e672c1087688b2d20559d70
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 045aeac969e8626b7488561dc366c89ba2449ac0e0c328f08f2a2c2fca26b185c1e898cc4689c1815fee4967ed272c5a424eabdaf5a2b2c2b0e0b476b481f744
|
|
7
|
+
data.tar.gz: 6e9aacf6d1447d50e4a025caeee2fa0879720a8c096ff7faa99c886e8e5be8995ae60d512fe4f3810140a288d6cbd8e37cc1864b5eeeba8d38d733d380d48f07
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 0.8.1
|
|
2
|
+
|
|
3
|
+
##### Breaking
|
|
4
|
+
|
|
5
|
+
* None.
|
|
6
|
+
|
|
7
|
+
##### Enhancements
|
|
8
|
+
|
|
9
|
+
* Allow all markdown in returns and parameter description callouts.
|
|
10
|
+
[John Fairhurst](https://github.com/johnfairh)
|
|
11
|
+
[#476](https://github.com/realm/jazzy/issues/476)
|
|
12
|
+
|
|
13
|
+
##### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* Fix a crash that occurred when a documentation comment ended with an extended
|
|
16
|
+
grapheme cluster.
|
|
17
|
+
[Lukas Stührk](https://github.com/Lukas-Stuehrk)
|
|
18
|
+
[#794](https://github.com/realm/jazzy/issues/794)
|
|
19
|
+
[SourceKitten#350](https://github.com/jpsim/SourceKitten/issues/350)
|
|
20
|
+
|
|
1
21
|
## 0.8.0
|
|
2
22
|
|
|
3
23
|
##### Breaking
|
data/Gemfile.lock
CHANGED
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<plist version="1.0">
|
|
4
4
|
<dict>
|
|
5
5
|
<key>BuildMachineOSBuild</key>
|
|
6
|
-
<string>
|
|
6
|
+
<string>16E195</string>
|
|
7
7
|
<key>CFBundleDevelopmentRegion</key>
|
|
8
8
|
<string>en</string>
|
|
9
9
|
<key>CFBundleExecutable</key>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<key>CFBundlePackageType</key>
|
|
18
18
|
<string>FMWK</string>
|
|
19
19
|
<key>CFBundleShortVersionString</key>
|
|
20
|
-
<string>0.
|
|
20
|
+
<string>0.12.0</string>
|
|
21
21
|
<key>CFBundleSignature</key>
|
|
22
22
|
<string>????</string>
|
|
23
23
|
<key>CFBundleSupportedPlatforms</key>
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
<key>DTCompiler</key>
|
|
30
30
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
|
31
31
|
<key>DTPlatformBuild</key>
|
|
32
|
-
<string>
|
|
32
|
+
<string>8E2002</string>
|
|
33
33
|
<key>DTPlatformVersion</key>
|
|
34
34
|
<string>GM</string>
|
|
35
35
|
<key>DTSDKBuild</key>
|
|
36
|
-
<string>
|
|
36
|
+
<string>16E185</string>
|
|
37
37
|
<key>DTSDKName</key>
|
|
38
38
|
<string>macosx10.12</string>
|
|
39
39
|
<key>DTXcode</key>
|
|
40
|
-
<string>
|
|
40
|
+
<string>0832</string>
|
|
41
41
|
<key>DTXcodeBuild</key>
|
|
42
|
-
<string>
|
|
42
|
+
<string>8E2002</string>
|
|
43
43
|
<key>NSHumanReadableCopyright</key>
|
|
44
44
|
<string>Copyright © 2014 Carthage. All rights reserved.</string>
|
|
45
45
|
</dict>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<plist version="1.0">
|
|
4
4
|
<dict>
|
|
5
5
|
<key>BuildMachineOSBuild</key>
|
|
6
|
-
<string>
|
|
6
|
+
<string>16E195</string>
|
|
7
7
|
<key>CFBundleDevelopmentRegion</key>
|
|
8
8
|
<string>en</string>
|
|
9
9
|
<key>CFBundleExecutable</key>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<key>CFBundlePackageType</key>
|
|
18
18
|
<string>FMWK</string>
|
|
19
19
|
<key>CFBundleShortVersionString</key>
|
|
20
|
-
<string>3.1
|
|
20
|
+
<string>3.2.1</string>
|
|
21
21
|
<key>CFBundleSignature</key>
|
|
22
22
|
<string>????</string>
|
|
23
23
|
<key>CFBundleSupportedPlatforms</key>
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
<key>DTCompiler</key>
|
|
30
30
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
|
31
31
|
<key>DTPlatformBuild</key>
|
|
32
|
-
<string>
|
|
32
|
+
<string>8E2002</string>
|
|
33
33
|
<key>DTPlatformVersion</key>
|
|
34
34
|
<string>GM</string>
|
|
35
35
|
<key>DTSDKBuild</key>
|
|
36
|
-
<string>
|
|
36
|
+
<string>16E185</string>
|
|
37
37
|
<key>DTSDKName</key>
|
|
38
38
|
<string>macosx10.12</string>
|
|
39
39
|
<key>DTXcode</key>
|
|
40
|
-
<string>
|
|
40
|
+
<string>0832</string>
|
|
41
41
|
<key>DTXcodeBuild</key>
|
|
42
|
-
<string>
|
|
42
|
+
<string>8E2002</string>
|
|
43
43
|
<key>NSHumanReadableCopyright</key>
|
|
44
44
|
<string>Copyright © 2015 Rob Rix. All rights reserved.</string>
|
|
45
45
|
</dict>
|
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<plist version="1.0">
|
|
4
4
|
<dict>
|
|
5
5
|
<key>BuildMachineOSBuild</key>
|
|
6
|
-
<string>
|
|
6
|
+
<string>16E195</string>
|
|
7
7
|
<key>CFBundleDevelopmentRegion</key>
|
|
8
8
|
<string>en</string>
|
|
9
9
|
<key>CFBundleExecutable</key>
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
<key>DTCompiler</key>
|
|
30
30
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
|
31
31
|
<key>DTPlatformBuild</key>
|
|
32
|
-
<string>
|
|
32
|
+
<string>8E2002</string>
|
|
33
33
|
<key>DTPlatformVersion</key>
|
|
34
34
|
<string>GM</string>
|
|
35
35
|
<key>DTSDKBuild</key>
|
|
36
|
-
<string>
|
|
36
|
+
<string>16E185</string>
|
|
37
37
|
<key>DTSDKName</key>
|
|
38
38
|
<string>macosx10.12</string>
|
|
39
39
|
<key>DTXcode</key>
|
|
40
|
-
<string>
|
|
40
|
+
<string>0832</string>
|
|
41
41
|
<key>DTXcodeBuild</key>
|
|
42
|
-
<string>
|
|
42
|
+
<string>8E2002</string>
|
|
43
43
|
<key>UIDeviceFamily</key>
|
|
44
44
|
<array>
|
|
45
45
|
<integer>1</integer>
|
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<plist version="1.0">
|
|
4
4
|
<dict>
|
|
5
5
|
<key>BuildMachineOSBuild</key>
|
|
6
|
-
<string>
|
|
6
|
+
<string>16E195</string>
|
|
7
7
|
<key>CFBundleDevelopmentRegion</key>
|
|
8
8
|
<string>en</string>
|
|
9
9
|
<key>CFBundleExecutable</key>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<key>CFBundlePackageType</key>
|
|
18
18
|
<string>FMWK</string>
|
|
19
19
|
<key>CFBundleShortVersionString</key>
|
|
20
|
-
<string>0.1
|
|
20
|
+
<string>0.3.1</string>
|
|
21
21
|
<key>CFBundleSignature</key>
|
|
22
22
|
<string>????</string>
|
|
23
23
|
<key>CFBundleSupportedPlatforms</key>
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
<string>MacOSX</string>
|
|
26
26
|
</array>
|
|
27
27
|
<key>CFBundleVersion</key>
|
|
28
|
-
<string
|
|
28
|
+
<string>1</string>
|
|
29
29
|
<key>DTCompiler</key>
|
|
30
30
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
|
31
31
|
<key>DTPlatformBuild</key>
|
|
32
|
-
<string>
|
|
32
|
+
<string>8E2002</string>
|
|
33
33
|
<key>DTPlatformVersion</key>
|
|
34
34
|
<string>GM</string>
|
|
35
35
|
<key>DTSDKBuild</key>
|
|
36
|
-
<string>
|
|
36
|
+
<string>16E185</string>
|
|
37
37
|
<key>DTSDKName</key>
|
|
38
38
|
<string>macosx10.12</string>
|
|
39
39
|
<key>DTXcode</key>
|
|
40
|
-
<string>
|
|
40
|
+
<string>0832</string>
|
|
41
41
|
<key>DTXcodeBuild</key>
|
|
42
|
-
<string>
|
|
42
|
+
<string>8E2002</string>
|
|
43
43
|
</dict>
|
|
44
44
|
</plist>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<plist version="1.0">
|
|
4
4
|
<dict>
|
|
5
5
|
<key>BuildMachineOSBuild</key>
|
|
6
|
-
<string>
|
|
6
|
+
<string>16E195</string>
|
|
7
7
|
<key>CFBundleDevelopmentRegion</key>
|
|
8
8
|
<string>en</string>
|
|
9
9
|
<key>CFBundleExecutable</key>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<key>CFBundlePackageType</key>
|
|
18
18
|
<string>FMWK</string>
|
|
19
19
|
<key>CFBundleShortVersionString</key>
|
|
20
|
-
<string>0.
|
|
20
|
+
<string>0.17.2</string>
|
|
21
21
|
<key>CFBundleSignature</key>
|
|
22
22
|
<string>????</string>
|
|
23
23
|
<key>CFBundleSupportedPlatforms</key>
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
<key>DTCompiler</key>
|
|
30
30
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
|
31
31
|
<key>DTPlatformBuild</key>
|
|
32
|
-
<string>
|
|
32
|
+
<string>8E2002</string>
|
|
33
33
|
<key>DTPlatformVersion</key>
|
|
34
34
|
<string>GM</string>
|
|
35
35
|
<key>DTSDKBuild</key>
|
|
36
|
-
<string>
|
|
36
|
+
<string>16E185</string>
|
|
37
37
|
<key>DTSDKName</key>
|
|
38
38
|
<string>macosx10.12</string>
|
|
39
39
|
<key>DTXcode</key>
|
|
40
|
-
<string>
|
|
40
|
+
<string>0832</string>
|
|
41
41
|
<key>DTXcodeBuild</key>
|
|
42
|
-
<string>
|
|
42
|
+
<string>8E2002</string>
|
|
43
43
|
<key>NSHumanReadableCopyright</key>
|
|
44
44
|
<string>Copyright © 2015 SourceKitten. All rights reserved.</string>
|
|
45
45
|
</dict>
|
|
Binary file
|
|
Binary file
|
data/lib/jazzy/doc.rb
CHANGED
|
@@ -19,7 +19,7 @@ module Jazzy
|
|
|
19
19
|
"© #{year} [#{config.author_name}](#{config.author_url}). " \
|
|
20
20
|
"All rights reserved. (Last updated: #{date})"
|
|
21
21
|
)
|
|
22
|
-
|
|
22
|
+
Markdown.render_copyright(copyright).chomp
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def jazzy_version
|
data/lib/jazzy/doc_builder.rb
CHANGED
|
@@ -220,7 +220,7 @@ module Jazzy
|
|
|
220
220
|
doc = Doc.new # Mustache model instance
|
|
221
221
|
name = doc_model.name == 'index' ? source_module.name : doc_model.name
|
|
222
222
|
doc[:name] = name
|
|
223
|
-
doc[:overview] =
|
|
223
|
+
doc[:overview] = Markdown.render(doc_model.content(source_module))
|
|
224
224
|
doc[:custom_head] = Config.instance.custom_head
|
|
225
225
|
doc[:disable_search] = Config.instance.disable_search
|
|
226
226
|
doc[:doc_coverage] = source_module.doc_coverage unless
|
|
@@ -366,7 +366,7 @@ module Jazzy
|
|
|
366
366
|
overview = (doc_model.abstract || '') + (doc_model.discussion || '')
|
|
367
367
|
alternative_abstract = doc_model.alternative_abstract
|
|
368
368
|
if alternative_abstract
|
|
369
|
-
overview =
|
|
369
|
+
overview = Markdown.render(alternative_abstract) + overview
|
|
370
370
|
end
|
|
371
371
|
|
|
372
372
|
doc = Doc.new # Mustache model instance
|
data/lib/jazzy/gem_version.rb
CHANGED
data/lib/jazzy/jazzy_markdown.rb
CHANGED
|
@@ -3,99 +3,102 @@ require 'rouge'
|
|
|
3
3
|
require 'rouge/plugins/redcarpet'
|
|
4
4
|
|
|
5
5
|
module Jazzy
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"#{
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
module Markdown
|
|
7
|
+
class JazzyHTML < Redcarpet::Render::HTML
|
|
8
|
+
include Redcarpet::Render::SmartyPants
|
|
9
|
+
include Rouge::Plugins::Redcarpet
|
|
10
|
+
|
|
11
|
+
def header(text, header_level)
|
|
12
|
+
text_slug = text.gsub(/[^\w]+/, '-')
|
|
13
|
+
.downcase
|
|
14
|
+
.sub(/^-/, '')
|
|
15
|
+
.sub(/-$/, '')
|
|
16
|
+
|
|
17
|
+
"<h#{header_level} id='#{text_slug}' class='heading'>" \
|
|
18
|
+
"#{text}" \
|
|
19
|
+
"</h#{header_level}>\n"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# List from
|
|
23
|
+
# https://github.com/apple/swift/blob/master/include/swift/Markup/SimpleFields.def
|
|
24
|
+
UNIQUELY_HANDLED_CALLOUTS = %w(parameters
|
|
25
|
+
parameter
|
|
26
|
+
returns).freeze
|
|
27
|
+
GENERAL_CALLOUTS = %w(attention
|
|
28
|
+
author
|
|
29
|
+
authors
|
|
30
|
+
bug
|
|
31
|
+
complexity
|
|
32
|
+
copyright
|
|
33
|
+
date
|
|
34
|
+
experiment
|
|
35
|
+
important
|
|
36
|
+
invariant
|
|
37
|
+
keyword
|
|
38
|
+
mutatingvariant
|
|
39
|
+
nonmutatingvariant
|
|
40
|
+
note
|
|
41
|
+
postcondition
|
|
42
|
+
precondition
|
|
43
|
+
recommended
|
|
44
|
+
recommendedover
|
|
45
|
+
remark
|
|
46
|
+
remarks
|
|
47
|
+
requires
|
|
48
|
+
see
|
|
49
|
+
seealso
|
|
50
|
+
since
|
|
51
|
+
todo
|
|
52
|
+
throws
|
|
53
|
+
version
|
|
54
|
+
warning).freeze
|
|
55
|
+
SPECIAL_LIST_TYPES = (UNIQUELY_HANDLED_CALLOUTS + GENERAL_CALLOUTS).freeze
|
|
56
|
+
|
|
57
|
+
SPECIAL_LIST_TYPE_REGEX = %r{
|
|
58
|
+
\A\s* # optional leading spaces
|
|
59
|
+
(<p>\s*)? # optional opening p tag
|
|
60
|
+
# any one of our special list types
|
|
61
|
+
(#{SPECIAL_LIST_TYPES.map(&Regexp.method(:escape)).join('|')})
|
|
62
|
+
[\s:] # followed by either a space or a colon
|
|
63
|
+
}ix
|
|
20
64
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
copyright
|
|
32
|
-
date
|
|
33
|
-
experiment
|
|
34
|
-
important
|
|
35
|
-
invariant
|
|
36
|
-
keyword
|
|
37
|
-
mutatingvariant
|
|
38
|
-
nonmutatingvariant
|
|
39
|
-
note
|
|
40
|
-
postcondition
|
|
41
|
-
precondition
|
|
42
|
-
recommended
|
|
43
|
-
recommendedover
|
|
44
|
-
remark
|
|
45
|
-
remarks
|
|
46
|
-
requires
|
|
47
|
-
see
|
|
48
|
-
seealso
|
|
49
|
-
since
|
|
50
|
-
todo
|
|
51
|
-
throws
|
|
52
|
-
version
|
|
53
|
-
warning).freeze
|
|
54
|
-
SPECIAL_LIST_TYPES = (UNIQUELY_HANDLED_CALLOUTS + GENERAL_CALLOUTS).freeze
|
|
55
|
-
|
|
56
|
-
SPECIAL_LIST_TYPE_REGEX = %r{
|
|
57
|
-
\A\s* # optional leading spaces
|
|
58
|
-
(<p>\s*)? # optional opening p tag
|
|
59
|
-
# any one of our special list types
|
|
60
|
-
(#{SPECIAL_LIST_TYPES.map(&Regexp.method(:escape)).join('|')})
|
|
61
|
-
[\s:] # followed by either a space or a colon
|
|
62
|
-
}ix
|
|
63
|
-
|
|
64
|
-
ELIDED_LI_TOKEN = '7wNVzLB0OYPL2eGlPKu8q4vITltqh0Y6DPZf659TPMAeYh49o'.freeze
|
|
65
|
-
|
|
66
|
-
def list_item(text, _list_type)
|
|
67
|
-
if text =~ SPECIAL_LIST_TYPE_REGEX
|
|
68
|
-
type = Regexp.last_match(2)
|
|
69
|
-
if UNIQUELY_HANDLED_CALLOUTS.include? type.downcase
|
|
70
|
-
return ELIDED_LI_TOKEN
|
|
65
|
+
ELIDED_LI_TOKEN =
|
|
66
|
+
'7wNVzLB0OYPL2eGlPKu8q4vITltqh0Y6DPZf659TPMAeYh49o'.freeze
|
|
67
|
+
|
|
68
|
+
def list_item(text, _list_type)
|
|
69
|
+
if text =~ SPECIAL_LIST_TYPE_REGEX
|
|
70
|
+
type = Regexp.last_match(2)
|
|
71
|
+
if UNIQUELY_HANDLED_CALLOUTS.include? type.downcase
|
|
72
|
+
return ELIDED_LI_TOKEN
|
|
73
|
+
end
|
|
74
|
+
return render_aside(type, text.sub(/#{Regexp.escape(type)}:\s+/, ''))
|
|
71
75
|
end
|
|
72
|
-
|
|
76
|
+
str = '<li>'
|
|
77
|
+
str << text.strip
|
|
78
|
+
str << "</li>\n"
|
|
73
79
|
end
|
|
74
|
-
str = '<li>'
|
|
75
|
-
str << text.strip
|
|
76
|
-
str << "</li>\n"
|
|
77
|
-
end
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
def render_aside(type, text)
|
|
82
|
+
<<-HTML
|
|
81
83
|
<div class="aside aside-#{type.underscore.tr('_', '-')}">
|
|
82
84
|
<p class="aside-title">#{type.underscore.humanize}</p>
|
|
83
85
|
#{text}
|
|
84
86
|
</div>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
HTML
|
|
88
|
+
end
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
def list(text, list_type)
|
|
91
|
+
elided = text.gsub!(ELIDED_LI_TOKEN, '')
|
|
92
|
+
return if text =~ /\A\s*\Z/ && elided
|
|
93
|
+
return text if text =~ /class="aside-title"/
|
|
94
|
+
str = "\n"
|
|
95
|
+
str << (list_type == :ordered ? "<ol>\n" : "<ul>\n")
|
|
96
|
+
str << text
|
|
97
|
+
str << (list_type == :ordered ? "</ol>\n" : "</ul>\n")
|
|
98
|
+
end
|
|
96
99
|
end
|
|
97
100
|
|
|
98
|
-
|
|
101
|
+
REDCARPET_OPTIONS = {
|
|
99
102
|
autolink: true,
|
|
100
103
|
fenced_code_blocks: true,
|
|
101
104
|
no_intra_emphasis: true,
|
|
@@ -105,23 +108,87 @@ module Jazzy
|
|
|
105
108
|
tables: true,
|
|
106
109
|
lax_spacing: true,
|
|
107
110
|
}.freeze
|
|
108
|
-
end
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
# Spot and capture returns & param HTML for separate display.
|
|
113
|
+
class JazzyDeclarationHTML < JazzyHTML
|
|
114
|
+
attr_reader :returns, :parameters
|
|
115
|
+
|
|
116
|
+
def reset
|
|
117
|
+
@returns = nil
|
|
118
|
+
@parameters = {}
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
INTRO_PAT = '\A(?<intro>\s*(<p>\s*)?)'.freeze
|
|
122
|
+
OUTRO_PAT = '(?<outro>.*)\z'.freeze
|
|
123
|
+
|
|
124
|
+
RETURNS_REGEX = /#{INTRO_PAT}returns:#{OUTRO_PAT}/im
|
|
125
|
+
|
|
126
|
+
IDENT_PAT = '(?<param>\S+)'.freeze
|
|
127
|
+
|
|
128
|
+
# Param formats: normal swift, objc via sourcekitten, and
|
|
129
|
+
# possibly inside 'Parameters:'
|
|
130
|
+
PARAM_PAT1 = "(parameter +#{IDENT_PAT}\\s*:)".freeze
|
|
131
|
+
PARAM_PAT2 = "(parameter:\\s*#{IDENT_PAT}\\s+)".freeze
|
|
132
|
+
PARAM_PAT3 = "(#{IDENT_PAT}\\s*:)".freeze
|
|
133
|
+
|
|
134
|
+
PARAM_PAT = "(?:#{PARAM_PAT1}|#{PARAM_PAT2}|#{PARAM_PAT3})".freeze
|
|
135
|
+
|
|
136
|
+
PARAM_REGEX = /#{INTRO_PAT}#{PARAM_PAT}#{OUTRO_PAT}/im
|
|
113
137
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
138
|
+
def list_item(text, _list_type)
|
|
139
|
+
if text =~ RETURNS_REGEX
|
|
140
|
+
@returns = render_param_returns(Regexp.last_match)
|
|
141
|
+
elsif text =~ PARAM_REGEX
|
|
142
|
+
@parameters[Regexp.last_match(:param)] =
|
|
143
|
+
render_param_returns(Regexp.last_match)
|
|
144
|
+
end
|
|
145
|
+
super
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def render_param_returns(matches)
|
|
149
|
+
body = matches[:intro].strip + matches[:outro].strip
|
|
150
|
+
body = "<p>#{body}</p>" unless body.start_with?('<p>')
|
|
151
|
+
Redcarpet::Render::SmartyPants.render(body)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def self.renderer
|
|
156
|
+
@renderer ||= JazzyDeclarationHTML.new
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def self.markdown
|
|
160
|
+
@markdown ||= Redcarpet::Markdown.new(renderer, REDCARPET_OPTIONS)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def self.render(markdown_text)
|
|
164
|
+
renderer.reset
|
|
165
|
+
markdown.render(markdown_text)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def self.rendered_returns
|
|
169
|
+
renderer.returns
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def self.rendered_parameters
|
|
173
|
+
renderer.parameters
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
class JazzyCopyright < Redcarpet::Render::HTML
|
|
177
|
+
def link(link, _title, content)
|
|
178
|
+
%(<a class="link" href="#{link}" target="_blank" \
|
|
117
179
|
rel="external">#{content}</a>)
|
|
180
|
+
end
|
|
118
181
|
end
|
|
119
|
-
end
|
|
120
182
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
183
|
+
def self.copyright_markdown
|
|
184
|
+
@copyright_markdown ||= Redcarpet::Markdown.new(
|
|
185
|
+
JazzyCopyright,
|
|
186
|
+
REDCARPET_OPTIONS,
|
|
187
|
+
)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def self.render_copyright(markdown_text)
|
|
191
|
+
copyright_markdown.render(markdown_text)
|
|
192
|
+
end
|
|
126
193
|
end
|
|
127
194
|
end
|
data/lib/jazzy/sourcekitten.rb
CHANGED
|
@@ -48,7 +48,7 @@ module Jazzy
|
|
|
48
48
|
module SourceKitten
|
|
49
49
|
@documented_count = 0
|
|
50
50
|
@undocumented_decls = []
|
|
51
|
-
@default_abstract =
|
|
51
|
+
@default_abstract = Markdown.render('Undocumented').freeze
|
|
52
52
|
|
|
53
53
|
# Group root-level docs by custom categories (if any) and type
|
|
54
54
|
def self.group_docs(docs)
|
|
@@ -94,7 +94,7 @@ module Jazzy
|
|
|
94
94
|
SourceDeclaration.new.tap do |sd|
|
|
95
95
|
sd.type = SourceDeclaration::Type.overview
|
|
96
96
|
sd.name = name
|
|
97
|
-
sd.abstract =
|
|
97
|
+
sd.abstract = Markdown.render(abstract)
|
|
98
98
|
sd.children = group
|
|
99
99
|
end
|
|
100
100
|
end
|
|
@@ -284,28 +284,12 @@ module Jazzy
|
|
|
284
284
|
make_default_doc_info(declaration)
|
|
285
285
|
end
|
|
286
286
|
|
|
287
|
-
def self.
|
|
288
|
-
return nil unless doc[key]
|
|
289
|
-
doc[key].map do |p|
|
|
290
|
-
if para = p['Para']
|
|
291
|
-
Jazzy.markdown.render(para)
|
|
292
|
-
elsif code = p['Verbatim'] || p['CodeListing']
|
|
293
|
-
Jazzy.markdown.render("```\n#{code}```\n")
|
|
294
|
-
else
|
|
295
|
-
warn "Jazzy could not recognize the `#{p.keys.first}` tag. " \
|
|
296
|
-
'Please report this by filing an issue at ' \
|
|
297
|
-
'https://github.com/realm/jazzy/issues along with the comment ' \
|
|
298
|
-
'including this tag.'
|
|
299
|
-
Jazzy.markdown.render(p.values.first)
|
|
300
|
-
end
|
|
301
|
-
end.join
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
def self.parameters(doc)
|
|
287
|
+
def self.parameters(doc, discovered)
|
|
305
288
|
(doc['key.doc.parameters'] || []).map do |p|
|
|
289
|
+
name = p['name']
|
|
306
290
|
{
|
|
307
|
-
name:
|
|
308
|
-
discussion:
|
|
291
|
+
name: name,
|
|
292
|
+
discussion: discovered[name],
|
|
309
293
|
}
|
|
310
294
|
end
|
|
311
295
|
end
|
|
@@ -329,11 +313,10 @@ module Jazzy
|
|
|
329
313
|
)
|
|
330
314
|
end
|
|
331
315
|
|
|
332
|
-
declaration.abstract =
|
|
316
|
+
declaration.abstract = Markdown.render(doc['key.doc.comment'] || '')
|
|
333
317
|
declaration.discussion = ''
|
|
334
|
-
declaration.return =
|
|
335
|
-
|
|
336
|
-
declaration.parameters = parameters(doc)
|
|
318
|
+
declaration.return = Markdown.rendered_returns
|
|
319
|
+
declaration.parameters = parameters(doc, Markdown.rendered_parameters)
|
|
337
320
|
|
|
338
321
|
@documented_count += 1
|
|
339
322
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jazzy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- JP Simard
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2017-
|
|
13
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: cocoapods
|