-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
Kramdown warnings #967
Kramdown warnings #967
Conversation
|
||
# Run filter | ||
io = capturing_stdio do | ||
filter.setup_and_run('{:foo}this is bogus') | ||
end | ||
assert_empty io[:stdout] | ||
assert_equal "kramdown warning: Found span IAL after text - ignoring it\n", io[:stderr] | ||
assert_equal "kramdown warning(s) for item, rep: #{item.identifier}, #{item_rep.name}\n Found span IAL after text - ignoring it\n", io[:stderr] |
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’d replace
"… item, rep: #{item.identifier}, #{item_rep.name}"
with
"… #{item_rep.inspect}"
Looks good! There’s a couple of style issues that Travis CI complains about still. |
warnings = document.warnings | ||
end | ||
|
||
if warnings.length != 0 |
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.
Replace this with warnings.any?
(I know Rubocop says warnings.length.nonzero?
but that’s not as nice.)
$stderr.puts "kramdown warning: #{warning}" | ||
if (warning_filters) | ||
r = Regexp.union(warning_filters) | ||
warnings = document.warnings.select { |warning| !(r =~ warning) } |
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.
Replace
!(r =~ warning)
with
r !~ warning
Or alternatively, replace
select { |warning| !(r =~ warning) }
with
reject { |warning| r =~ warning }
Does it make sense to provide the warning filters via the configuration file, rather than arguments to the |
d89ae1f
to
fc1ec10
Compare
I took your comments into account. Well in my setup, I was already doing e.g in
and then when filtering
A quick grep didn't really exhibit existing filters reading their options straight from |
fc1ec10
to
e30fdf3
Compare
This is awesome, I've wanted this myself. Thanks @gpakosz! |
I’m OK with leaving it as a filter argument, as it’s more flexible, and still leaves open the option for using the configuration in the way you described. Is this still WIP or is it ready to go? |
Summary
This PR does two things in two commits:
To do
The
:warning_filters
array should be documented on https://nanoc.ws as part of the filters reference documentation.