-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #523 from agentk/integrated-markdown
Integrated markdown parsing and guide support
- Loading branch information
Showing
12 changed files
with
208 additions
and
17 deletions.
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