Skip to content

Commit

Permalink
Handle protocol relative eips link
Browse files Browse the repository at this point in the history
  • Loading branch information
aslikaya authored and SamWilsn committed Jun 19, 2024
1 parent 9a0ec23 commit d37f14e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions eipw-lint/src/lints/markdown/relative_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ where
S: Debug + Display + AsRef<str>,
{
fn lint<'a>(&self, slug: &'a str, ctx: &Context<'a, '_>) -> Result<(), Error> {
let re = Regex::new("(^/)|(://)").unwrap();
let eip_re = Regex::new(r"^https://eips.ethereum.org/EIPS/eip-(\d+)$").unwrap();
let re: Regex = Regex::new("(^/)|(://)").unwrap();
let eip_re = Regex::new(r"^(https?:)?//eips\.ethereum\.org/EIPS/(eip-\d+)+$").unwrap();

let exceptions = RegexSet::new(&self.exceptions).map_err(Error::custom)?;

Expand All @@ -47,7 +47,7 @@ where

for Link { address, line_start } in links {
let (suggestion, extra_help) = if let Some(caps) = eip_re.captures(&address) {
(format!("./eip-{}.md", &caps[1]), true)
(format!("./{}.md", &caps[2]), true)
} else if address == "https://creativecommons.org/publicdomain/zero/1.0/" {
("../LICENSE.md".to_string(), true)
} else {
Expand Down

0 comments on commit d37f14e

Please sign in to comment.