-
Notifications
You must be signed in to change notification settings - Fork 0
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 #31 from razeware/development
v1.0.4: 🐌 Shell
- Loading branch information
Showing
10 changed files
with
175 additions
and
16 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
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,23 @@ | ||
# frozen_string_literal: true | ||
|
||
module Linting | ||
module Markdown | ||
# Lint the markdown associated with a book | ||
class Book | ||
include Linting::Markdown::Renderable | ||
|
||
def self.lint(book) | ||
new(book).lint | ||
end | ||
|
||
def lint | ||
[].tap do |annotations| | ||
annotations.concat(lint_markdown_attributes) | ||
object.sections.each do |section| | ||
annotations.concat(Linting::Markdown::Section.lint(section)) | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module Linting | ||
module Markdown | ||
# Lint the markdown associated with a chapter | ||
class Chapter | ||
include Linting::Markdown::Renderable | ||
|
||
def self.lint(chapter) | ||
new(chapter).lint | ||
end | ||
|
||
def lint | ||
[].tap do |annotations| | ||
annotations.concat(lint_markdown_attributes) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
module Linting | ||
module Markdown | ||
# Check that the attributes marked as markdown renderable are valid | ||
module Renderable | ||
include Linting::FileExistenceChecker | ||
|
||
attr_reader :object | ||
|
||
def initialize(object) | ||
@object = object | ||
end | ||
|
||
def lint_markdown_attributes | ||
object.markdown_render_loop do |content, is_file| | ||
markdown = is_file ? File.read(content) : content | ||
# TODO: Do some checking here | ||
content | ||
end | ||
[] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
module Linting | ||
module Markdown | ||
# Lint the markdown associated with a section | ||
class Section | ||
include Linting::Markdown::Renderable | ||
|
||
def self.lint(section) | ||
new(section).lint | ||
end | ||
|
||
def lint | ||
[].tap do |annotations| | ||
annotations.concat(lint_markdown_attributes) | ||
object.chapters.each do |chapter| | ||
annotations.concat(Linting::Markdown::Chapter.lint(chapter)) | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
module Linting | ||
# Lints the markdown in a book | ||
class MarkdownLinter | ||
attr_reader :book | ||
|
||
def initialize(book:) | ||
@book = book | ||
end | ||
|
||
def lint | ||
Linting::Markdown::Book.lint(book) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module Parser | ||
# An error for capturing parsing issues | ||
class Error < StandardError | ||
attr_reader :file | ||
|
||
def initialize(file:, error: nil, msg: nil) | ||
message = "There was a problem parsing #{file}" | ||
message += "\n#{error.class.name}\n#{error.message}" if error.present? | ||
message += "\n#{msg}" if msg.present? | ||
|
||
super(message) | ||
@file = file | ||
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