Skip to content

Commit

Permalink
MM: readme title independent of module name
Browse files Browse the repository at this point in the history
Add a new flag to set this thing manually.  Will add some docs in
a future commit to explain what each of these title flags do to the UI.
  • Loading branch information
johnfairh committed Feb 9, 2024
1 parent fccb8f5 commit dea804d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

##### Enhancements

* Add `--docset-title` to set the title of a docset separately
to the module name.
* Add `--readme-title` and `--docset-title` to set the titles of the readme
docs page and the Dash docset independently of the module name.
[John Fairhurst](https://github.com/johnfairh)

* Support Swift 5.9 symbolgraph extension symbols.
Expand Down
4 changes: 4 additions & 0 deletions lib/jazzy/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ def hide_objc?
description: 'The path to a markdown README file',
parse: ->(rp) { expand_path(rp) }

config_attr :readme_title,
command_line: '--readme-title TITLE',
description: 'The title for the README in the generated documentation'

config_attr :documentation_glob,
command_line: '--documentation GLOB',
description: 'Glob that matches available documentation',
Expand Down
4 changes: 2 additions & 2 deletions lib/jazzy/doc_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def self.new_document(source_module, doc_model)
doc[:doc_coverage] = source_module.doc_coverage unless
Config.instance.hide_documentation_coverage
doc[:structure] = source_module.doc_structure
doc[:module_name] = source_module.name
doc[:module_name] = source_module.readme_title # historical name
doc[:author_name] = source_module.author_name
if source_host = source_module.host
doc[:source_host_name] = source_host.name
Expand All @@ -270,7 +270,7 @@ def self.new_document(source_module, doc_model)
# @param [String] path_to_root
def self.document_markdown(source_module, doc_model, path_to_root)
doc = new_document(source_module, doc_model)
name = doc_model.name == 'index' ? source_module.name : doc_model.name
name = doc_model.name == 'index' ? source_module.readme_title : doc_model.name
doc[:name] = name
doc[:overview] = render(doc_model, doc_model.content(source_module))
doc[:path_to_root] = path_to_root
Expand Down
2 changes: 1 addition & 1 deletion lib/jazzy/source_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def generated_readme(source_module)
README
else
<<-README
# #{source_module.name}
# #{source_module.readme_title}
### Authors
Expand Down
5 changes: 3 additions & 2 deletions lib/jazzy/source_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Jazzy
class SourceModule
include Config::Mixin

attr_accessor :name
attr_accessor :readme_title
attr_accessor :docs
attr_accessor :doc_coverage
attr_accessor :doc_structure
Expand All @@ -25,7 +25,8 @@ def initialize(docs, doc_structure, doc_coverage, docset_builder)
self.docs = docs
self.doc_structure = doc_structure
self.doc_coverage = doc_coverage
self.name = config.module_names.first # XXX what actually is this type for
self.readme_title =
config.readme_title || config.module_names.first
self.author_name = config.author_name
self.author_url = config.author_url
self.host = SourceHost.create(config)
Expand Down
2 changes: 1 addition & 1 deletion spec/integration_specs
Submodule integration_specs updated 23 files
+2 −2 jazzy_multi_modules/after/docs/Categories/NSURL(MyCategory).html
+2 −2 jazzy_multi_modules/after/docs/Classes/AlphaClass.html
+2 −2 jazzy_multi_modules/after/docs/Classes/AlphaClass/Nested.html
+2 −2 jazzy_multi_modules/after/docs/Classes/BetaClass.html
+2 −2 jazzy_multi_modules/after/docs/Classes/GammaClass.html
+2 −2 jazzy_multi_modules/after/docs/Extensions/MultiKitAlpha+String.html
+2 −2 jazzy_multi_modules/after/docs/Extensions/MultiKitBeta+String.html
+2 −2 jazzy_multi_modules/after/docs/MultKitGamma.html
+2 −2 jazzy_multi_modules/after/docs/MultiKitAlpha.html
+2 −2 jazzy_multi_modules/after/docs/MultiKitBeta.html
+2 −2 ...les/after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/Categories/NSURL(MyCategory).html
+2 −2 ...multi_modules/after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/Classes/AlphaClass.html
+2 −2 ...odules/after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/Classes/AlphaClass/Nested.html
+2 −2 ..._multi_modules/after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/Classes/BetaClass.html
+2 −2 ...multi_modules/after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/Classes/GammaClass.html
+2 −2 .../after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/Extensions/MultiKitAlpha+String.html
+2 −2 ...s/after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/Extensions/MultiKitBeta+String.html
+2 −2 jazzy_multi_modules/after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/MultKitGamma.html
+2 −2 jazzy_multi_modules/after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/MultiKitAlpha.html
+2 −2 jazzy_multi_modules/after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/MultiKitBeta.html
+5 −5 jazzy_multi_modules/after/docs/docsets/Jazzy_MultiKit.docset/Contents/Resources/Documents/index.html
+5 −5 jazzy_multi_modules/after/docs/index.html
+2 −0 jazzy_multi_modules/before/.jazzy.yaml

0 comments on commit dea804d

Please sign in to comment.