Created
July 2, 2021 05:29
-
-
Save kmuto/4638c2b8ab4a875cab40e06fe5ebcc56 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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