jazzy 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +59 -0
  3. data/CONTRIBUTING.md +61 -0
  4. data/Gemfile.lock +1 -1
  5. data/README.md +60 -39
  6. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/SourceKittenFramework +0 -0
  7. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Commandant +0 -0
  8. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Commandant +0 -0
  9. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Resources/Info.plist +3 -3
  10. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Result +0 -0
  11. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Resources/Info.plist +3 -3
  12. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Result +0 -0
  13. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/Resources/Info.plist +3 -3
  14. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SwiftXPC.framework/Versions/A/Resources/Info.plist +3 -3
  15. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Resources/Info.plist +4 -4
  16. data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/SourceKittenFramework +0 -0
  17. data/lib/jazzy/SourceKitten/bin/sourcekitten +0 -0
  18. data/lib/jazzy/assets/css/highlight.css.scss +2 -2
  19. data/lib/jazzy/assets/css/jazzy.css.scss +24 -5
  20. data/lib/jazzy/assets/js/jazzy.js +10 -1
  21. data/lib/jazzy/config.rb +24 -27
  22. data/lib/jazzy/doc_builder.rb +2 -1
  23. data/lib/jazzy/gem_version.rb +1 -1
  24. data/lib/jazzy/readme_generator.rb +1 -1
  25. data/lib/jazzy/source_declaration.rb +34 -1
  26. data/lib/jazzy/source_declaration/type.rb +12 -0
  27. data/lib/jazzy/source_module.rb +2 -0
  28. data/lib/jazzy/sourcekitten.rb +85 -40
  29. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4344d4e194eb9396ad55aa2a2050eed88aa2c30f
4
- data.tar.gz: 4a6c9ee2d83e5870ac85bd9e49a19a31e0c7a544
3
+ metadata.gz: b5219afff012deb0c2b04b838d43e40d5a4c9d9a
4
+ data.tar.gz: 78e198b143d5143e0d9b472954d11281a80979b1
5
5
  SHA512:
6
- metadata.gz: 99eaf5f9ea98dcddd743ab0714fbe8baef5bdc82021b8a175a9e483790b58bc5469131e1dadd12df05d4b36728b2f8ea1580088246a57e0709b44e5bc706d736
7
- data.tar.gz: 654f71a20888a547d17a5aa6614d07de567bce7ff2f28addb84a403fd4822f58f1636fbd4573861c5c692589b1b1fa33995fa2ecd2963649999aa9a529def9ae
6
+ metadata.gz: a406f1e5e0a36b588128aa509af94f85e43e7c5fbc5f2d1d5eb4014fbc2091fecd20cde0c14f56f9c89a61b0a9df400c24d49f5c882bc67a4c1713b7a9c6042f
7
+ data.tar.gz: 04e94c12df882ff15e43ae1cc154af5bc685646a91d6a8752f626a18a1c7816f897052dd75d96f1faf5c9518bdb7755622a521c269d44b8bbc60b209fd4d2f21
data/CHANGELOG.md CHANGED
@@ -1,3 +1,62 @@
1
+ ## 0.4.1
2
+
3
+ *Note: this is the last official release of jazzy supporting Swift 1.x.*
4
+
5
+ ##### Breaking
6
+
7
+ * None.
8
+
9
+ ##### Enhancements
10
+
11
+ * Support "wall of asterisk" documentation comments.
12
+ [Jeff Verkoeyen](https://github.com/jverkoey)
13
+ [#347](https://github.com/realm/jazzy/issues/347)
14
+
15
+ * Expanding a token no longer causes the document to 'jump' to the hash.
16
+ [Jeff Verkoeyen](https://github.com/jverkoey)
17
+ [#352](https://github.com/realm/jazzy/issues/352)
18
+
19
+ * Autolinking improvements:
20
+ - Autolinks only match `` `ThingsInBackticks` ``, and must match the entire
21
+ string. This prevents spurious matching in prose and sample code.
22
+ - Autolinks supports siblings, ancestors, top-level elements, and
23
+ dot-separated chains starting with any of the above: `someProperty`,
24
+ `SomeType.NestedType.someMethod(_:)`.
25
+ - New `...` wildcard prevents you from having to list all method parameters:
26
+ `someMethod(...)`
27
+
28
+ [pcantrell](https://github.com/pcantrell)
29
+ [#327](https://github.com/realm/jazzy/issues/327)
30
+ [#329](https://github.com/realm/jazzy/issues/329)
31
+ [#359](https://github.com/realm/jazzy/issues/359)
32
+
33
+ * Miscellaneous minor font size, weight, and color adjustments.
34
+ [Jeff Verkoeyen](https://github.com/jverkoey)
35
+
36
+ * In-page anchors now appear below the header.
37
+ [Jeff Verkoeyen](https://github.com/jverkoey)
38
+
39
+ ##### Bug Fixes
40
+
41
+ * Fix an out-of-bounds exception when generating pragma marks.
42
+ [JP Simard](https://github.com/jpsim)
43
+ [#370](https://github.com/realm/jazzy/issues/370)
44
+
45
+ * Add support for C/C++ struct, field & ivar types.
46
+ [JP Simard](https://github.com/jpsim)
47
+ [#374](https://github.com/realm/jazzy/issues/374)
48
+ [#387](https://github.com/realm/jazzy/issues/387)
49
+
50
+ * Links to source files on GitHub are no longer broken when `source_directory`
51
+ does not point to the current working directory.
52
+ [pcantrell](https://github.com/pcantrell)
53
+
54
+ * When `excluded_files` is specified in a config file, it is now resolved
55
+ relative to the file (like other options) instead of relative to the working
56
+ directory.
57
+ [pcantrell](https://github.com/pcantrell)
58
+
59
+
1
60
  ## 0.4.0
2
61
 
3
62
  ##### Breaking
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,61 @@
1
+ ## Tracking changes
2
+
3
+ All changes should be made via pull requests on GitHub.
4
+
5
+ When issuing a pull request, please add a summary of your changes to
6
+ the `CHANGELOG.md` file.
7
+
8
+ We follow the same syntax as CocoaPods' CHANGELOG.md:
9
+
10
+ 1. One Markdown unnumbered list item desribing the change.
11
+ 2. 2 trailing spaces on the last line describing the change.
12
+ 3. A list of Markdown hyperlinks to the contributors to the change. One entry
13
+ per line. Usually just one.
14
+ 4. A list of Markdown hyperlinks to the issues the change addresses. One entry
15
+ per line. Usually just one. Don't link to PRs here.
16
+ 5. All CHANGELOG.md content is hard-wrapped at 80 characters.
17
+
18
+ ## Updating the integration specs
19
+
20
+ Jazzy heavily relies on integration tests, but since they're considerably large
21
+ and noisy, we keep them in a separate repo
22
+ ([realm/jazzy-integration-specs](https://github.com/realm/jazzy-integration-specs)).
23
+
24
+ If you're making a PR towards jazzy that affects the generated docs, please
25
+ update the integration specs using the following process:
26
+
27
+ ```shell
28
+ git checkout master
29
+ git pull
30
+ git checkout -
31
+ git rebase master
32
+ bundle install
33
+ bundle exec rake rebuild_integration_fixtures
34
+ cd spec/integration_specs
35
+ git checkout -b $jazzy_branch_name
36
+ git commit -a -m "update for $jazzy_branch_name"
37
+ git push
38
+ cd ../../
39
+ git commit -a -m "update integration specs"
40
+ git push
41
+ ```
42
+
43
+ You'll need push access to the integration specs repo to do this. You can
44
+ request access from one of the maintainers when filing your PR.
45
+
46
+ ## Making changes to SourceKitten
47
+
48
+ When changes are landed in the https://github.com/jpsim/SourceKitten repo the
49
+ SourceKitten framework located in jazzy must be updated.
50
+
51
+ The following may be executed from your `jazzy/` directory.
52
+
53
+ ```
54
+ cd SourceKitten
55
+ git checkout master
56
+ git pull
57
+ cd ..
58
+ rake sourcekitten
59
+ git add .
60
+ git commit -m "..."
61
+ ```
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jazzy (0.4.0)
4
+ jazzy (0.4.1)
5
5
  cocoapods (~> 0.38)
6
6
  mustache (~> 0.99)
7
7
  open4
data/README.md CHANGED
@@ -4,45 +4,55 @@
4
4
 
5
5
  ![Test Status](https://travis-ci.org/realm/jazzy.svg?branch=master)
6
6
 
7
- jazzy is a command-line utility that generates documentation for your Swift or
8
- Objective-C projects.
7
+ *jazzy is a command-line utility that generates documentation for Swift or Objective-C*
9
8
 
10
- Both Swift & Objective-C projects are supported.
9
+ ## About
10
+
11
+ Both Swift and Objective-C projects are supported.
11
12
 
12
13
  *Objective-C support was recently added, so please report any issues you find.*
13
14
 
14
- Instead of parsing your source files, jazzy hooks into [Clang][clang] and
15
+ Instead of parsing your source files, `jazzy` hooks into [Clang][clang] and
15
16
  [SourceKit][sourcekit] to use the [AST][ast] representation of your code and
16
- its comments for more accurate results.
17
-
18
- jazzy’s output matches the look & feel of Apple’s official reference
19
- documentation, post WWDC 2014.
17
+ its comments for more accurate results. The output matches the look and feel
18
+ of Apple’s official reference documentation, post WWDC 2014.
20
19
 
21
20
  ![Screenshot](screenshot.jpg)
22
21
 
23
- ### Requirements
22
+ ## Requirements
24
23
 
25
- * A version of [Xcode][xcode] (6.x or 7.x) capable of building the Swift project
26
- you wish to document, installed in a location indexed by Spotlight.
24
+ * A version of [Xcode][xcode] (6.x or 7.x) capable of building the project
25
+ you wish to document. It must be installed in a location indexed by Spotlight.
27
26
 
28
- ### Installing
27
+ ## Installation
29
28
 
30
- To install jazzy, run `[sudo] gem install jazzy` from your command line.
29
+ ```shell
30
+ [sudo] gem install jazzy
31
+ ```
31
32
 
32
- ### Usage
33
+ ## Usage
33
34
 
34
- Run `jazzy` from your command line. Run `jazzy -h` for a list of additional
35
- options.
35
+ Run `jazzy` from your command line. Run `jazzy -h` for a list of additional options.
36
36
 
37
37
  You can set options for your project’s documentation in a configuration file,
38
38
  `.jazzy.yaml` by default. For a detailed explanation and an exhaustive list of
39
39
  all available options, run `jazzy --help config`.
40
40
 
41
- #### Swift
41
+ ### Supported keywords
42
+
43
+ Swift header documentation is written in markdown and supports a number of special keywords.
44
+ For a complete list and examples, see Erica Sadun's post on [*Swift header documentation in Xcode 7*](http://ericasadun.com/2015/06/14/swift-header-documentation-in-xcode-7/).
45
+
46
+ For Objective-C documentation the same keywords are supported, but note that the format
47
+ is slightly different. In Swift you would write `- returns:`, but in Objective-C you write `@return`. See Apple's [*HeaderDoc User Guide*](https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/HeaderDoc/tags/tags.html) for more details. **Note: `jazzy` currently does not support _all_ Objective-C keywords listed in this document.**
48
+
49
+ ### Swift
42
50
 
43
51
  Swift documentation is generated by default.
44
52
 
45
- As an example, this is how Realm Swift docs are generated:
53
+ ##### Example
54
+
55
+ This is how Realm Swift docs are generated:
46
56
 
47
57
  ```shell
48
58
  jazzy \
@@ -59,12 +69,17 @@ jazzy \
59
69
  --template-directory docs/templates
60
70
  ```
61
71
 
62
- #### Objective-C
72
+ ### Objective-C
73
+
74
+ To generate documentation for Objective-C headers,
75
+ you must pass the following parameters to jazzy:
76
+ * `--objc`
77
+ * `--umbrella-header ...`
78
+ * `-framework-root ...`
63
79
 
64
- To generate documentation for Objective-C headers, you should pass `--objc`,
65
- `--umbrella-header ...` and `-framework-root ...` as parameters to jazzy.
80
+ ##### Example
66
81
 
67
- As an example, this is how Realm Objective-C docs are generated:
82
+ This is how Realm Objective-C docs are generated:
68
83
 
69
84
  ```shell
70
85
  jazzy \
@@ -83,7 +98,7 @@ jazzy \
83
98
  --template-directory docs/templates
84
99
  ```
85
100
 
86
- or AFNetworking:
101
+ This is how the AFNetworking docs are generated:
87
102
 
88
103
  ```shell
89
104
  jazzy \
@@ -98,40 +113,46 @@ jazzy \
98
113
  --module AFNetworking
99
114
  ```
100
115
 
101
- ### Troubleshooting
116
+ ## Troubleshooting
117
+
118
+ #### Swift
102
119
 
103
- #### Swift: Only extensions are listed in the documentation.
120
+ **Only extensions are listed in the documentation?**
104
121
 
105
- By default, jazzy only documents public declarations. To generate documentation
106
- for declarations with a lower accessibility level (internal or private), please
122
+ By default, `jazzy` only documents public declarations. To generate documentation
123
+ for declarations with a lower accessibility level (`internal` or `private`), please
107
124
  set the `--min-acl` flag to `internal` or `private`.
108
125
 
109
- ### Development
126
+ ## Development
110
127
 
111
- jazzy is composed of two parts: the parser ([SourceKitten][SourceKitten],
112
- written in Swift) and the site generator (written in ruby).
128
+ Please review jazzy's [contributing guidelines](https://github.com/realm/jazzy/blob/master/CONTRIBUTING.md) when submitting pull requests.
113
129
 
114
- To build and run jazzy from source, you'll first need [bundler][bundler]. Once
115
- bundler is installed, run `bundle install` from the root of this repo. At this
116
- point, run jazzy from source by running `bin/jazzy`.
130
+ jazzy is composed of two parts:
131
+
132
+ 1. The parser, [SourceKitten][SourceKitten] (written in Swift)
133
+ 2. The site generator (written in ruby)
134
+
135
+ To build and run jazzy from source:
136
+
137
+ 1. Install [bundler][bundler].
138
+ 2. Run `bundle install` from the root of this repo.
139
+ 3. Run jazzy from source by running `bin/jazzy`.
117
140
 
118
141
  Instructions to build SourceKitten from source can be found at
119
142
  [SourceKitten's GitHub repository][SourceKitten].
120
143
 
121
- ### Design Goals
122
-
123
- jazzy's main design goals are:
144
+ ## Design Goals
124
145
 
125
146
  - Generate source code docs matching Apple's official reference documentation
126
147
  - Support for standard Objective-C and Swift documentation comment syntax
127
148
  - Leverage modern HTML templating ([Mustache][mustache])
128
149
  - Leverage the power and accuracy of the [Clang AST][ast] and [SourceKit][sourcekit]
129
150
  - Support for Dash docsets
130
- - Support Swift & Objective-C (*mixed projects are a work in progress*)
151
+ - Support Swift and Objective-C (*mixed projects are a work in progress*)
131
152
 
132
- ### License
153
+ ## License
133
154
 
134
- This project is under the MIT license.
155
+ This project is released under the [MIT license](https://github.com/realm/jazzy/blob/master/LICENSE).
135
156
 
136
157
  [clang]: http://clang.llvm.org "Clang"
137
158
  [sourcekit]: http://www.jpsim.com/uncovering-sourcekit "Uncovering SourceKit"
@@ -29,7 +29,7 @@
29
29
  <key>DTCompiler</key>
30
30
  <string>com.apple.compilers.llvm.clang.1_0</string>
31
31
  <key>DTPlatformBuild</key>
32
- <string>7B91b</string>
32
+ <string>7B1005</string>
33
33
  <key>DTPlatformVersion</key>
34
34
  <string>GM</string>
35
35
  <key>DTSDKBuild</key>
@@ -37,9 +37,9 @@
37
37
  <key>DTSDKName</key>
38
38
  <string>macosx10.11</string>
39
39
  <key>DTXcode</key>
40
- <string>0710</string>
40
+ <string>0711</string>
41
41
  <key>DTXcodeBuild</key>
42
- <string>7B91b</string>
42
+ <string>7B1005</string>
43
43
  <key>NSHumanReadableCopyright</key>
44
44
  <string>Copyright © 2014 Carthage. All rights reserved.</string>
45
45
  </dict>
@@ -29,7 +29,7 @@
29
29
  <key>DTCompiler</key>
30
30
  <string>com.apple.compilers.llvm.clang.1_0</string>
31
31
  <key>DTPlatformBuild</key>
32
- <string>7B91b</string>
32
+ <string>7B1005</string>
33
33
  <key>DTPlatformVersion</key>
34
34
  <string>GM</string>
35
35
  <key>DTSDKBuild</key>
@@ -37,9 +37,9 @@
37
37
  <key>DTSDKName</key>
38
38
  <string>macosx10.11</string>
39
39
  <key>DTXcode</key>
40
- <string>0710</string>
40
+ <string>0711</string>
41
41
  <key>DTXcodeBuild</key>
42
- <string>7B91b</string>
42
+ <string>7B1005</string>
43
43
  <key>NSHumanReadableCopyright</key>
44
44
  <string>Copyright © 2015 Rob Rix. All rights reserved.</string>
45
45
  </dict>
@@ -29,7 +29,7 @@
29
29
  <key>DTCompiler</key>
30
30
  <string>com.apple.compilers.llvm.clang.1_0</string>
31
31
  <key>DTPlatformBuild</key>
32
- <string>7B91b</string>
32
+ <string>7B1005</string>
33
33
  <key>DTPlatformVersion</key>
34
34
  <string>GM</string>
35
35
  <key>DTSDKBuild</key>
@@ -37,9 +37,9 @@
37
37
  <key>DTSDKName</key>
38
38
  <string>macosx10.11</string>
39
39
  <key>DTXcode</key>
40
- <string>0710</string>
40
+ <string>0711</string>
41
41
  <key>DTXcodeBuild</key>
42
- <string>7B91b</string>
42
+ <string>7B1005</string>
43
43
  <key>UIDeviceFamily</key>
44
44
  <array>
45
45
  <integer>1</integer>
@@ -29,7 +29,7 @@
29
29
  <key>DTCompiler</key>
30
30
  <string>com.apple.compilers.llvm.clang.1_0</string>
31
31
  <key>DTPlatformBuild</key>
32
- <string>7B91b</string>
32
+ <string>7B1005</string>
33
33
  <key>DTPlatformVersion</key>
34
34
  <string>GM</string>
35
35
  <key>DTSDKBuild</key>
@@ -37,9 +37,9 @@
37
37
  <key>DTSDKName</key>
38
38
  <string>macosx10.11</string>
39
39
  <key>DTXcode</key>
40
- <string>0710</string>
40
+ <string>0711</string>
41
41
  <key>DTXcodeBuild</key>
42
- <string>7B91b</string>
42
+ <string>7B1005</string>
43
43
  <key>NSHumanReadableCopyright</key>
44
44
  <string>Copyright © 2014 JP Simard. All rights reserved.</string>
45
45
  </dict>
@@ -17,7 +17,7 @@
17
17
  <key>CFBundlePackageType</key>
18
18
  <string>FMWK</string>
19
19
  <key>CFBundleShortVersionString</key>
20
- <string>0.6.0</string>
20
+ <string>0.6.2</string>
21
21
  <key>CFBundleSignature</key>
22
22
  <string>????</string>
23
23
  <key>CFBundleSupportedPlatforms</key>
@@ -29,7 +29,7 @@
29
29
  <key>DTCompiler</key>
30
30
  <string>com.apple.compilers.llvm.clang.1_0</string>
31
31
  <key>DTPlatformBuild</key>
32
- <string>7B91b</string>
32
+ <string>7B1005</string>
33
33
  <key>DTPlatformVersion</key>
34
34
  <string>GM</string>
35
35
  <key>DTSDKBuild</key>
@@ -37,9 +37,9 @@
37
37
  <key>DTSDKName</key>
38
38
  <string>macosx10.11</string>
39
39
  <key>DTXcode</key>
40
- <string>0710</string>
40
+ <string>0711</string>
41
41
  <key>DTXcodeBuild</key>
42
- <string>7B91b</string>
42
+ <string>7B1005</string>
43
43
  <key>NSHumanReadableCopyright</key>
44
44
  <string>Copyright © 2015 SourceKitten. All rights reserved.</string>
45
45
  </dict>
@@ -25,7 +25,7 @@
25
25
  .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
26
26
  .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
27
27
  .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
28
- .kt { color: #445588; font-weight: bold } /* Keyword.Type */
28
+ .kt { color: #445588; } /* Keyword.Type */
29
29
  .m { color: #009999 } /* Literal.Number */
30
30
  .s { color: #d14 } /* Literal.String */
31
31
  .na { color: #008080 } /* Name.Attribute */
@@ -34,7 +34,7 @@
34
34
  .no { color: #008080 } /* Name.Constant */
35
35
  .ni { color: #800080 } /* Name.Entity */
36
36
  .ne { color: #990000; font-weight: bold } /* Name.Exception */
37
- .nf { color: #990000; font-weight: bold } /* Name.Function */
37
+ .nf { color: #990000; } /* Name.Function */
38
38
  .nn { color: #555555 } /* Name.Namespace */
39
39
  .nt { color: #000080 } /* Name.Tag */
40
40
  .nv { color: #008080 } /* Name.Variable */
@@ -58,7 +58,7 @@ body {
58
58
 
59
59
  // Headers
60
60
 
61
- h1, h2, h3, h4, h5, h6 {
61
+ h1, h2, h3 {
62
62
  margin-top: 0.8em;
63
63
  margin-bottom: 0.3em;
64
64
  font-weight: 100;
@@ -71,11 +71,10 @@ h2 {
71
71
  font-size: 2em;
72
72
  border-bottom: $gray_border;
73
73
  }
74
- h3 {
75
- font-size: 1.5em;
76
- }
77
74
  h4 {
78
- font-size: 1.25em;
75
+ font-size: 13px;
76
+ line-height: 1.5;
77
+ margin-top: 21px;
79
78
  }
80
79
  h5 {
81
80
  font-size: 1.1em;
@@ -84,6 +83,14 @@ h6 {
84
83
  font-size: 1.1em;
85
84
  color: $code_color;
86
85
  }
86
+ .section-name {
87
+ color: rgba(128,128,128,1);
88
+ display: block;
89
+ font-family: Helvetica;
90
+ font-size: 22px;
91
+ font-weight: 100;
92
+ margin-bottom: 15px;
93
+ }
87
94
 
88
95
  // Code
89
96
 
@@ -291,6 +298,17 @@ header {
291
298
  padding-top: 0px;
292
299
  }
293
300
 
301
+ .task-name-container {
302
+ a[name] {
303
+ &:before {
304
+ content: "";
305
+ display: block;
306
+ padding-top: $content_top_offset;
307
+ margin: -$content_top_offset 0 0;
308
+ }
309
+ }
310
+ }
311
+
294
312
  .item {
295
313
  padding-top: 8px;
296
314
  width: 100%;
@@ -310,6 +328,7 @@ header {
310
328
  .token {
311
329
  padding-left: 3px;
312
330
  margin-left: 15px;
331
+ font-size: 11.9px;
313
332
  }
314
333
  .declaration-note {
315
334
  font-size: .85em;
@@ -17,7 +17,7 @@ $(document).ready(function() {
17
17
  });
18
18
 
19
19
  // On token click, toggle its discussion and animate token.marginLeft
20
- $(".token").click(function() {
20
+ $(".token").click(function(event) {
21
21
  if (window.jazzy.docset) {
22
22
  return;
23
23
  }
@@ -28,4 +28,13 @@ $(".token").click(function() {
28
28
  link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
29
29
  $content = link.parent().parent().next();
30
30
  $content.slideToggle(animationDuration);
31
+
32
+ // Keeps the document from jumping to the hash.
33
+ var href = $(this).attr('href');
34
+ if (history.pushState) {
35
+ history.pushState({}, '', href);
36
+ } else {
37
+ location.hash = href;
38
+ }
39
+ event.preventDefault();
31
40
  });
data/lib/jazzy/config.rb CHANGED
@@ -31,7 +31,7 @@ module Jazzy
31
31
  end
32
32
 
33
33
  def set(config, val, mark_configured: true)
34
- set_raw(config, parse.call(val))
34
+ set_raw(config, config.instance_exec(val, &parse))
35
35
  config.method("#{name}_configured=").call(true) if mark_configured
36
36
  end
37
37
 
@@ -67,6 +67,12 @@ module Jazzy
67
67
  attr_reader :all_config_attrs
68
68
  end
69
69
 
70
+ attr_accessor :base_path
71
+
72
+ def expand_path(path)
73
+ Pathname(path).expand_path(base_path) # nil means Pathname.pwd
74
+ end
75
+
70
76
  # ──────── Build ────────
71
77
 
72
78
  # rubocop:disable Style/AlignParameters
@@ -75,7 +81,7 @@ module Jazzy
75
81
  description: 'Folder to output the HTML docs to',
76
82
  command_line: ['-o', '--output FOLDER'],
77
83
  default: 'docs',
78
- parse: ->(o) { Pathname(o) }
84
+ parse: ->(o) { expand_path(o) }
79
85
 
80
86
  config_attr :clean,
81
87
  command_line: ['-c', '--[no-]clean'],
@@ -92,18 +98,18 @@ module Jazzy
92
98
  config_attr :umbrella_header,
93
99
  command_line: '--umbrella-header PATH',
94
100
  description: 'Umbrella header for your Objective-C framework.',
95
- parse: ->(uh) { Pathname(uh) }
101
+ parse: ->(uh) { expand_path(uh) }
96
102
 
97
103
  config_attr :framework_root,
98
104
  command_line: '--framework-root PATH',
99
105
  description: 'The root path to your Objective-C framework.',
100
- parse: ->(fr) { Pathname(fr) }
106
+ parse: ->(fr) { expand_path(fr) }
101
107
 
102
108
  config_attr :config_file,
103
109
  command_line: '--config PATH',
104
110
  description: ['Configuration file (.yaml or .json)',
105
111
  'Default: .jazzy.yaml in source directory or ancestor'],
106
- parse: ->(cf) { Pathname(cf) }
112
+ parse: ->(cf) { expand_path(cf) }
107
113
 
108
114
  config_attr :xcodebuild_arguments,
109
115
  command_line: ['-x', '--xcodebuild-arguments arg1,arg2,…argN', Array],
@@ -113,20 +119,20 @@ module Jazzy
113
119
  config_attr :sourcekitten_sourcefile,
114
120
  command_line: ['-s', '--sourcekitten-sourcefile FILEPATH'],
115
121
  description: 'File generated from sourcekitten output to parse',
116
- parse: ->(s) { Pathname(s) }
122
+ parse: ->(s) { expand_path(s) }
117
123
 
118
124
  config_attr :source_directory,
119
125
  command_line: '--source-directory DIRPATH',
120
126
  description: 'The directory that contains the source to be documented',
121
127
  default: Pathname.pwd,
122
- parse: ->(sd) { Pathname(sd) }
128
+ parse: ->(sd) { expand_path(sd) }
123
129
 
124
130
  config_attr :excluded_files,
125
131
  command_line: ['-e', '--exclude file1,file2,…fileN', Array],
126
132
  description: 'Files to be excluded from documentation',
127
133
  default: [],
128
134
  parse: ->(files) do
129
- files.map { |f| File.expand_path(f) }
135
+ Array(files).map { |f| expand_path(f) }
130
136
  end
131
137
 
132
138
  config_attr :swift_version,
@@ -163,7 +169,7 @@ module Jazzy
163
169
  config_attr :readme_path,
164
170
  command_line: '--readme FILEPATH',
165
171
  description: 'The path to a markdown README file',
166
- parse: ->(rp) { Pathname(rp) }
172
+ parse: ->(rp) { expand_path(rp) }
167
173
 
168
174
  config_attr :podspec,
169
175
  command_line: '--podspec FILEPATH',
@@ -174,7 +180,7 @@ module Jazzy
174
180
 
175
181
  config_attr :docset_icon,
176
182
  command_line: '--docset-icon FILEPATH',
177
- parse: ->(di) { Pathname(di) }
183
+ parse: ->(di) { expand_path(di) }
178
184
 
179
185
  config_attr :docset_path,
180
186
  command_line: '--docset-path DIRPATH',
@@ -216,8 +222,8 @@ module Jazzy
216
222
 
217
223
  config_attr :skip_undocumented,
218
224
  command_line: '--[no-]skip-undocumented',
219
- description: "Don't document declarations that have no documentation '\
220
- 'comments.",
225
+ description: "Don't document declarations that have no documentation "\
226
+ 'comments.',
221
227
  default: false
222
228
 
223
229
  config_attr :hide_documentation_coverage,
@@ -229,21 +235,21 @@ module Jazzy
229
235
  description: ['Custom navigation categories to replace the standard '\
230
236
  '“Classes, Protocols, etc.”', 'Types not explicitly named '\
231
237
  'in a custom category appear in generic groups at the end.',
232
- 'Example: http://git.io/vcTZm'],
238
+ 'Example: http://git.io/v4Bcp'],
233
239
  default: []
234
240
 
235
241
  config_attr :template_directory,
236
242
  command_line: ['-t', '--template-directory DIRPATH'],
237
243
  description: 'The directory that contains the mustache templates to use',
238
244
  default: Pathname(__FILE__).parent + 'templates',
239
- parse: ->(td) { Pathname(td) }
245
+ parse: ->(td) { expand_path(td) }
240
246
 
241
247
  config_attr :assets_directory,
242
248
  command_line: '--assets-directory DIRPATH',
243
249
  description: 'The directory that contains the assets (CSS, JS, images) '\
244
250
  'used by the templates',
245
251
  default: Pathname(__FILE__).parent + 'assets',
246
- parse: ->(ad) { Pathname(ad) }
252
+ parse: ->(ad) { expand_path(ad) }
247
253
 
248
254
  # rubocop:enable Style/AlignParameters
249
255
 
@@ -304,14 +310,14 @@ module Jazzy
304
310
  exit
305
311
  end
306
312
  end.parse!
307
-
308
- expand_paths(Pathname.pwd)
309
313
  end
310
314
 
311
315
  def parse_config_file
312
316
  config_path = locate_config_file
313
317
  return unless config_path
314
318
 
319
+ self.base_path = config_path.parent
320
+
315
321
  puts "Using config file #{config_path}"
316
322
  config_file = read_config_file(config_path)
317
323
  self.class.all_config_attrs.each do |attr|
@@ -321,7 +327,7 @@ module Jazzy
321
327
  end
322
328
  end
323
329
 
324
- expand_paths(config_path.parent)
330
+ self.base_path = nil
325
331
  end
326
332
 
327
333
  def locate_config_file
@@ -343,15 +349,6 @@ module Jazzy
343
349
  end
344
350
  end
345
351
 
346
- def expand_paths(base_path)
347
- self.class.all_config_attrs.each do |attr|
348
- val = attr.get(self)
349
- if val.respond_to?(:expand_path)
350
- attr.set_raw(self, val.expand_path(base_path))
351
- end
352
- end
353
- end
354
-
355
352
  def print_config_file_help
356
353
  puts <<-_EOS_
357
354
 
@@ -224,7 +224,8 @@ module Jazzy
224
224
  else
225
225
  gh_line = "#L#{item.line}"
226
226
  end
227
- relative_file_path = item.file.realpath.relative_path_from(Pathname.pwd)
227
+ relative_file_path = item.file.realpath.relative_path_from(
228
+ source_module.root_path)
228
229
  "#{github_prefix}/#{relative_file_path}#{gh_line}"
229
230
  end
230
231
 
@@ -1,3 +1,3 @@
1
1
  module Jazzy
2
- VERSION = '0.4.0' unless defined? Jazzy::VERSION
2
+ VERSION = '0.4.1' unless defined? Jazzy::VERSION
3
3
  end
@@ -26,7 +26,7 @@ module Jazzy
26
26
  end
27
27
 
28
28
  def self.generated_readme(source_module)
29
- if config.podspec
29
+ if podspec = config.podspec
30
30
  ### License
31
31
 
32
32
  # <a href="#{license[:url]}">#{license[:license]}</a>
@@ -7,6 +7,40 @@ module Jazzy
7
7
  attr_accessor :type
8
8
  # static type of declared element (e.g. String.Type -> ())
9
9
  attr_accessor :typename
10
+
11
+ # Element containing this declaration in the code
12
+ attr_accessor :parent_in_code
13
+
14
+ # Logical parent in the documentation. May differ from parent_in_code
15
+ # because of top-level categories and merged extensions.
16
+ attr_accessor :parent_in_docs
17
+
18
+ # counterpart of parent_in_docs
19
+ attr_accessor :children
20
+
21
+ def children=(new_children)
22
+ # Freeze to ensure that parent_in_docs stays in sync
23
+ @children = new_children.freeze
24
+ @children.each { |c| c.parent_in_docs = self }
25
+ end
26
+
27
+ # Chain of parent_in_code from top level to self. (Includes self.)
28
+ def namespace_path
29
+ namespace_ancestors + [self]
30
+ end
31
+
32
+ def namespace_ancestors
33
+ if parent_in_code
34
+ parent_in_code.namespace_path
35
+ else
36
+ []
37
+ end
38
+ end
39
+
40
+ def fully_qualified_name
41
+ namespace_path.map(&:name).join('.')
42
+ end
43
+
10
44
  attr_accessor :file
11
45
  attr_accessor :line
12
46
  attr_accessor :column
@@ -18,7 +52,6 @@ module Jazzy
18
52
  attr_accessor :from_protocol_extension
19
53
  attr_accessor :discussion
20
54
  attr_accessor :return
21
- attr_accessor :children
22
55
  attr_accessor :parameters
23
56
  attr_accessor :url
24
57
  attr_accessor :mark
@@ -144,6 +144,18 @@ module Jazzy
144
144
  jazzy: 'Function',
145
145
  dash: 'Function',
146
146
  }.freeze,
147
+ 'sourcekitten.source.lang.objc.decl.struct' => {
148
+ jazzy: 'Struct',
149
+ dash: 'Struct',
150
+ }.freeze,
151
+ 'sourcekitten.source.lang.objc.decl.field' => {
152
+ jazzy: 'Field',
153
+ dash: 'Field',
154
+ }.freeze,
155
+ 'sourcekitten.source.lang.objc.decl.ivar' => {
156
+ jazzy: 'Ivar',
157
+ dash: 'Ivar',
158
+ }.freeze,
147
159
 
148
160
  # Swift
149
161
  'source.lang.swift.decl.function.accessor.address' => {
@@ -6,6 +6,7 @@ require 'jazzy/source_declaration'
6
6
  module Jazzy
7
7
  class SourceModule
8
8
  attr_accessor :name
9
+ attr_accessor :root_path
9
10
  attr_accessor :docs
10
11
  attr_accessor :doc_coverage
11
12
  attr_accessor :doc_structure
@@ -17,6 +18,7 @@ module Jazzy
17
18
 
18
19
  def initialize(options, docs, doc_structure, doc_coverage)
19
20
  self.docs = docs
21
+ self.root_path = options.source_directory
20
22
  self.doc_structure = doc_structure
21
23
  self.doc_coverage = doc_coverage
22
24
  self.name = options.module_name
@@ -65,21 +65,21 @@ module Jazzy
65
65
  # rubocop:disable Metrics/MethodLength
66
66
  # Generate doc URL by prepending its parents URLs
67
67
  # @return [Hash] input docs with URLs
68
- def self.make_doc_urls(docs, parents)
68
+ def self.make_doc_urls(docs)
69
69
  docs.each do |doc|
70
- if parents.empty? || doc.children.count > 0
70
+ if !doc.parent_in_docs || doc.children.count > 0
71
71
  # Create HTML page for this doc if it has children or is root-level
72
72
  doc.url = (
73
- subdir_for_doc(doc, parents) +
73
+ subdir_for_doc(doc) +
74
74
  [doc.name + '.html']
75
75
  ).join('/')
76
- doc.children = make_doc_urls(doc.children, parents + [doc])
76
+ doc.children = make_doc_urls(doc.children)
77
77
  else
78
78
  # Don't create HTML page for this doc if it doesn't have children
79
79
  # Instead, make its link a hash-link on its parent's page
80
80
  if doc.typename == '<<error type>>'
81
81
  warn 'A compile error prevented ' +
82
- (parents[1..-1] + [doc]).map(&:name).join('.') +
82
+ doc.fully_qualified_name +
83
83
  ' from receiving a unique USR. Documentation may be ' \
84
84
  'incomplete. Please check for compile errors by running ' \
85
85
  "`xcodebuild #{Config.instance.xcodebuild_arguments.shelljoin}`."
@@ -94,19 +94,23 @@ module Jazzy
94
94
  'project. If this token is declared in an `#if` block, please ' \
95
95
  'ignore this message.'
96
96
  end
97
- doc.url = parents.last.url + '#/' + id
97
+ doc.url = doc.parent_in_docs.url + '#/' + id
98
98
  end
99
99
  end
100
100
  end
101
101
  # rubocop:enable Metrics/MethodLength
102
102
 
103
103
  # Determine the subdirectory in which a doc should be placed
104
- def self.subdir_for_doc(doc, parents)
105
- parents.map(&:name).tap do |names|
106
- # We always want to create top-level subdirs according to type (Struct,
107
- # Class, etc), but parents[0] might be a custom category name.
108
- top_level_decl = (parents + [doc])[1]
109
- names[0] = top_level_decl.type.plural_name if top_level_decl
104
+ def self.subdir_for_doc(doc)
105
+ # We always want to create top-level subdirs according to type (Struct,
106
+ # Class, etc).
107
+ top_level_decl = doc.namespace_path.first
108
+ if top_level_decl && top_level_decl.type && top_level_decl.type.name
109
+ # File program elements under top ancestor’s type (Struct, Class, etc.)
110
+ [top_level_decl.type.plural_name] + doc.namespace_ancestors.map(&:name)
111
+ else
112
+ # Categories live in their own directory
113
+ []
110
114
  end
111
115
  end
112
116
 
@@ -243,6 +247,7 @@ module Jazzy
243
247
  if doc['key.substructure']
244
248
  declaration.children = make_source_declarations(
245
249
  doc['key.substructure'],
250
+ declaration,
246
251
  )
247
252
  else
248
253
  declaration.children = []
@@ -252,21 +257,24 @@ module Jazzy
252
257
  # rubocop:disable Metrics/MethodLength
253
258
  # rubocop:disable Metrics/CyclomaticComplexity
254
259
  # rubocop:disable Metrics/PerceivedComplexity
255
- def self.make_source_declarations(docs)
260
+ def self.make_source_declarations(docs, parent = nil)
256
261
  declarations = []
257
262
  current_mark = SourceMark.new
258
263
  Array(docs).each do |doc|
259
264
  if doc.key?('key.diagnostic_stage')
260
- declarations += make_source_declarations(doc['key.substructure'])
265
+ declarations += make_source_declarations(
266
+ doc['key.substructure'], parent)
261
267
  next
262
268
  end
263
269
  declaration = SourceDeclaration.new
270
+ declaration.parent_in_code = parent
264
271
  declaration.type = SourceDeclaration::Type.new(doc['key.kind'])
265
272
  declaration.typename = doc['key.typename']
266
273
  current_mark = SourceMark.new(doc['key.name']) if declaration.type.mark?
267
274
  if declaration.type.swift_enum_case?
268
275
  # Enum "cases" are thin wrappers around enum "elements".
269
- declarations += make_source_declarations(doc['key.substructure'])
276
+ declarations += make_source_declarations(
277
+ doc['key.substructure'], parent)
270
278
  next
271
279
  end
272
280
  next unless declaration.type.should_document?
@@ -346,8 +354,12 @@ module Jazzy
346
354
  end
347
355
 
348
356
  decls = typedecls + extensions
349
- decls.first.tap do |d|
350
- d.children = deduplicate_declarations(decls.flat_map(&:children).uniq)
357
+ decls.first.tap do |merged|
358
+ merged.children = deduplicate_declarations(
359
+ decls.flat_map(&:children).uniq)
360
+ merged.children.each do |child|
361
+ child.parent_in_code = merged
362
+ end
351
363
  end
352
364
  end
353
365
 
@@ -384,36 +396,69 @@ module Jazzy
384
396
  excluded_files = Config.instance.excluded_files
385
397
  json.map do |doc|
386
398
  key = doc.keys.first
387
- doc[key] unless excluded_files.include?(key)
399
+ doc[key] unless excluded_files.include?(Pathname(key))
388
400
  end.compact
389
401
  end
390
402
 
391
- def self.names_and_urls(docs)
392
- docs.flat_map do |doc|
393
- # FIXME: autolink more than just top-level items.
394
- [{ name: doc.name, url: doc.url }] # + names_and_urls(doc.children)
403
+ def self.name_match(name_part, docs)
404
+ return nil unless name_part
405
+ wildcard_expansion = Regexp.escape(name_part)
406
+ .gsub('\.\.\.', '[^)]*')
407
+ .gsub(/&lt;.*&gt;/, '')
408
+ whole_name_pat = /\A#{wildcard_expansion}\Z/
409
+ docs.find do |doc|
410
+ whole_name_pat =~ doc.name
411
+ end
412
+ end
413
+
414
+ # Find the first ancestor of doc whose name matches name_part.
415
+ def self.ancestor_name_match(name_part, doc)
416
+ doc.namespace_ancestors.reverse_each do |ancestor|
417
+ if match = name_match(name_part, ancestor.children)
418
+ return match
419
+ end
420
+ end
421
+ nil
422
+ end
423
+
424
+ def self.name_traversal(name_parts, doc)
425
+ while doc && !name_parts.empty?
426
+ next_part = name_parts.shift
427
+ doc = name_match(next_part, doc.children)
395
428
  end
429
+ doc
396
430
  end
397
431
 
398
- def self.autolink_text(text, data, url)
399
- regex = /\b(#{data.map { |d| Regexp.escape(d[:name]) }.join('|')})\b/
400
- text.gsub(regex) do
401
- name = Regexp.last_match(1)
402
- auto_url = data.find { |d| d[:name] == name }[:url]
403
- if auto_url == url # docs shouldn't autolink to themselves
404
- Regexp.last_match(0)
432
+ def self.autolink_text(text, doc, root_decls)
433
+ text.gsub(%r{<code>[ \t]*([^\s]+)[ \t]*</code>}) do
434
+ original = Regexp.last_match(0)
435
+ raw_name = Regexp.last_match(1)
436
+ parts = raw_name
437
+ .split(/(?<!\.)\.(?!\.)/) # dot with no neighboring dots
438
+ .reject(&:empty?)
439
+
440
+ # First dot-separated component can match any ancestor or top-level doc
441
+ first_part = parts.shift
442
+ name_root = ancestor_name_match(first_part, doc) ||
443
+ name_match(first_part, root_decls)
444
+
445
+ # Traverse children via subsequence components, if any
446
+ link_target = name_traversal(parts, name_root)
447
+
448
+ if link_target && link_target.url && link_target.url != doc.url
449
+ "<code><a href=\"#{ELIDED_AUTOLINK_TOKEN}#{link_target.url}\">" +
450
+ raw_name + '</a></code>'
405
451
  else
406
- "<a href=\"#{ELIDED_AUTOLINK_TOKEN}#{auto_url}\">#{name}</a>"
452
+ original
407
453
  end
408
454
  end
409
455
  end
410
456
 
411
- def self.autolink(docs, data)
412
- docs.map do |doc|
413
- doc.abstract = autolink_text(doc.abstract, data, doc.url)
414
- doc.return = autolink_text(doc.return, data, doc.url) if doc.return
415
- doc.children = autolink(doc.children, data)
416
- doc
457
+ def self.autolink(docs, root_decls)
458
+ docs.each do |doc|
459
+ doc.abstract = autolink_text(doc.abstract, doc, root_decls)
460
+ doc.return = autolink_text(doc.return, doc, root_decls) if doc.return
461
+ doc.children = autolink(doc.children, root_decls)
417
462
  end
418
463
  end
419
464
 
@@ -422,7 +467,7 @@ module Jazzy
422
467
  doc.children.select { |child| child.type.objc_enum? }.map(&:name)
423
468
  end
424
469
  docs.map do |doc|
425
- doc.children.reject! do |child|
470
+ doc.children = doc.children.reject do |child|
426
471
  child.type.objc_typedef? && enums.include?(child.name)
427
472
  end
428
473
  doc
@@ -436,7 +481,7 @@ module Jazzy
436
481
  @skip_undocumented = skip_undocumented
437
482
  sourcekitten_json = filter_excluded_files(JSON.parse(sourcekitten_output))
438
483
  docs = make_source_declarations(sourcekitten_json)
439
- docs = deduplicate_declarations(docs)
484
+ docs = ungrouped_docs = deduplicate_declarations(docs)
440
485
  docs = group_docs(docs)
441
486
  if Config.instance.objc_mode
442
487
  docs = reject_objc_enum_typedefs(docs)
@@ -445,8 +490,8 @@ module Jazzy
445
490
  # than min_acl
446
491
  docs = docs.reject { |doc| doc.type.swift_enum_element? }
447
492
  end
448
- docs = make_doc_urls(docs, [])
449
- docs = autolink(docs, names_and_urls(docs.flat_map(&:children)))
493
+ make_doc_urls(docs)
494
+ autolink(docs, ungrouped_docs)
450
495
  [docs, doc_coverage, @undocumented_tokens]
451
496
  end
452
497
  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.4.0
4
+ version: 0.4.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: 2015-11-11 00:00:00.000000000 Z
13
+ date: 2015-11-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cocoapods
@@ -167,6 +167,7 @@ files:
167
167
  - ".rubocop.yml"
168
168
  - ".travis.yml"
169
169
  - CHANGELOG.md
170
+ - CONTRIBUTING.md
170
171
  - Gemfile
171
172
  - Gemfile.lock
172
173
  - LICENSE
@@ -261,3 +262,4 @@ signing_key:
261
262
  specification_version: 4
262
263
  summary: Soulful docs for Swift & Objective-C.
263
264
  test_files: []
265
+ has_rdoc: