Skip to content
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

Remove extra backslashes from code snippets #3139

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def to_str
option_tags(operation, api),
return_tag(operation, api),
pagination(pager, operation, api),
generated_examples(operation, api),
eventstream_examples(module_name, method_name, operation, api),
shared_examples(examples, operation, api),
given_examples(client_examples),
Expand Down Expand Up @@ -203,15 +202,11 @@ def shared_examples(examples, operation, api)
end
example_block.join("\n")
rescue
puts "Invalid example for operation: #{@name}"
puts "Invalid example for operation: #{@module_name} - #{@name}"
nil
end
end

def generated_examples(operation, api)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this just not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so...

nil
end

def eventstream_examples(module_name, method_name, operation, api)
return unless !!Helper.eventstream_output?(operation, api)
EventStreamExample.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def block_comment(text, options = {})
text.lines.map do |line|
line = line.rstrip
if line == ''
"#"
'#'
else
"##{gap}#{line}"
end
Expand Down Expand Up @@ -118,10 +118,6 @@ def html_to_markdown(html, options = {})
if html
html = "<p>#{html}</p>" unless html.match(/<\w+>/)

# unescaped curly braces cause YARD errors, they are interpreted
# as code links.
html = html.gsub('{', "\\{").gsub('}', "\\}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we take an escape_curly_braces option and pass it only when this is called for code docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't fix inline code snippets in the documentation. This applies on the whole block of documentation text.


# Kramdown generates invalid markup when there are attributes
# on the code tag, have to reduce these down to get the proper markdown.
html = html.gsub(/<code.*?>(.+?)<\/code>/) { "<code>#{$1}</code>" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def build_keyword_arguments(plugins)
grouped = buffer.group_by { |name, _| name }
grouped.transform_values(&:count).find_all { |_, c| 1 < c }.each do |name,|
case name
when :endpoint, :endpoint_provider, :retry_limit, :disable_s3_express_session_auth, :account_id_endpoint_mode
when :endpoint, :endpoint_provider, :retry_limit, :disable_s3_express_session_auth, :account_id, :account_id_endpoint_mode
# ok
else
warn("Duplicate client option in #{@service_name}: `#{grouped[name].map { |g| g.values_at(0, 2) }}`", uplevel: 0)
Expand Down
2 changes: 0 additions & 2 deletions gems/aws-sigv4/lib/aws-sigv4/asymmetric_credentials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ module AsymmetricCredentials

N_MINUS_2 = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551 - 2

# @param [String] :access_key_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove these? They are still the correct paramters here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module is API private and these were wrong. These are positional parameters but they were symbolized name, so it produced a warning. I just deleted them because it's clear what they are (and API private).

# @param [String] :secret_access_key
# @return [OpenSSL::PKey::EC, Hash]
def self.derive_asymmetric_key(access_key_id, secret_access_key)
check_openssl_support!
Expand Down