Skip to content

Instantly share code, notes, and snippets.

@kmuto
Created July 2, 2021 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmuto/4638c2b8ab4a875cab40e06fe5ebcc56 to your computer and use it in GitHub Desktop.
Save kmuto/4638c2b8ab4a875cab40e06fe5ebcc56 to your computer and use it in GitHub Desktop.
module ReVIEW
module BuilderOverride
def inline_href(arg)
# 区切り文字に単純に|を使うようにする
url, label = arg.split(/\s*\|\s*/, 2)
url = url.gsub(/\\,/, ',').strip
if label
label = label.gsub(/\\,/, ',').strip
end
compile_href(url, label)
end
# def inline_href(arg)
# # 既存のをいじらず、|で区切れるようにしてみる
# # しかしこれだと @<href>{http://localhost/a,b} のパターンに耐えられないので意味ないか
# url, label = *arg.scan(/(?:(?:(?:\\\\)*\\,)|[^,\\]+)+/).map(&:lstrip)
#
# # |があったら区切りやり直し
# if arg =~ /\|/
# url, label = arg.split(/\s*\|\s*/, 2)
# end
#
# url = url.gsub(/\\,/, ',').strip
# if label
# label = label.gsub(/\\,/, ',').strip
# end
# compile_href(url, label)
# end
end
class Builder
prepend BuilderOverride
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment