-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrated markdown parsing and guide support #523
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,4 @@ Icon | |
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'pathname' | ||
|
||
require 'jazzy/jazzy_markdown' | ||
require 'jazzy/source_document' | ||
|
||
module Jazzy | ||
module DocumentationGenerator | ||
extend Config::Mixin | ||
|
||
def self.source_docs | ||
documentation_entries.map do |file_path| | ||
SourceDocument.new.tap do |sd| | ||
sd.name = File.basename(file_path, '.md') | ||
sd.url = sd.name.downcase.strip | ||
.tr(' ', '-').gsub(/[^\w-]/, '') + '.html' | ||
sd.type = SourceDeclaration::Type.new 'document.markdown' | ||
sd.children = [] | ||
sd.overview = overview Pathname(file_path) | ||
sd.usr = 'documentation.' + sd.name | ||
sd.abstract = '' | ||
sd.return = '' | ||
sd.parameters = [] | ||
end | ||
end | ||
end | ||
|
||
def self.overview(file_path) | ||
return '' unless file_path && file_path.exist? | ||
file_path.read | ||
end | ||
|
||
def self.documentation_entries | ||
return [] unless | ||
config.documentation_glob_configured && config.documentation_glob | ||
config.documentation_glob.select { |e| File.file? e } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
require 'pathname' | ||
|
||
require 'jazzy/jazzy_markdown' | ||
|
||
module Jazzy | ||
class SourceDocument < SourceDeclaration | ||
attr_accessor :overview | ||
attr_accessor :readme_path | ||
|
||
def config | ||
Config.instance | ||
end | ||
|
||
def url | ||
name.downcase.strip.tr(' ', '-').gsub(/[^\w-]/, '') + '.html' | ||
end | ||
|
||
def content(source_module) | ||
return readme_content(source_module) if name == 'index' | ||
overview | ||
end | ||
|
||
def readme_content(source_module) | ||
config_readme || fallback_readme || generated_readme(source_module) | ||
end | ||
|
||
def config_readme | ||
readme_path.read if readme_path && readme_path.exist? | ||
end | ||
|
||
def fallback_readme | ||
%w(README.md README.markdown README.mdown README).each do |potential_name| | ||
file = config.source_directory + potential_name | ||
return file.read if file.exist? | ||
end | ||
false | ||
end | ||
|
||
def generated_readme(source_module) | ||
if podspec = config.podspec | ||
### License | ||
|
||
# <a href="#{license[:url]}">#{license[:license]}</a> | ||
<<-EOS | ||
# #{podspec.name} | ||
|
||
### #{podspec.summary} | ||
|
||
#{podspec.description} | ||
|
||
### Installation | ||
|
||
```ruby | ||
pod '#{podspec.name}' | ||
``` | ||
|
||
### Authors | ||
|
||
#{source_module.author_name} | ||
EOS | ||
else | ||
<<-EOS | ||
# #{source_module.name} | ||
|
||
### Authors | ||
|
||
#{source_module.author_name} | ||
EOS | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule integration_specs
updated
from 7d8348 to 06d2fd
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it would make sense to filter files named
index.*
here too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably wouldn't hurt, but I'm not sure if it's necessary there. Without it, it makes it possible to override the readme and have it included in the Dash Guides section.