Skip to content

Commit

Permalink
馃悰 FIX: Port regression
Browse files Browse the repository at this point in the history
Comparing to #110 I noticed a few mistaken regressions
  • Loading branch information
chrisjsewell committed Mar 10, 2021
1 parent 29a8d5e commit d9c7c79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion markdown_it/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ def fence(self, tokens: Sequence[Token], idx: int, options, env) -> str:
langAttrs = ""

if info:
langName = info.split()[0]
arr = info.split(maxsplit=1)
langName = arr[0]
if len(arr) == 2:
Expand Down
13 changes: 6 additions & 7 deletions markdown_it/rules_inline/autolink.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Process autolinks '<protocol:...>'
import re
from .state_inline import StateInline
from ..common.normalize_url import normalizeLinkText, normalizeLink, validateLink

EMAIL_RE = re.compile(
r"^([a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$" # noqa: E501
Expand Down Expand Up @@ -34,8 +33,8 @@ def autolink(state: StateInline, silent: bool) -> bool:
url = state.src[start + 1 : pos]

if AUTOLINK_RE.search(url) is not None:
fullUrl = normalizeLink(url)
if not validateLink(fullUrl):
fullUrl = state.md.normalizeLink(url)
if not state.md.validateLink(fullUrl):
return False

if not silent:
Expand All @@ -45,7 +44,7 @@ def autolink(state: StateInline, silent: bool) -> bool:
token.info = "auto"

token = state.push("text", "", 0)
token.content = normalizeLinkText(url)
token.content = state.md.normalizeLinkText(url)

token = state.push("link_close", "a", -1)
token.markup = "autolink"
Expand All @@ -55,8 +54,8 @@ def autolink(state: StateInline, silent: bool) -> bool:
return True

if EMAIL_RE.search(url) is not None:
fullUrl = normalizeLink("mailto:" + url)
if not validateLink(fullUrl):
fullUrl = state.md.normalizeLink("mailto:" + url)
if not state.md.validateLink(fullUrl):
return False

if not silent:
Expand All @@ -66,7 +65,7 @@ def autolink(state: StateInline, silent: bool) -> bool:
token.info = "auto"

token = state.push("text", "", 0)
token.content = normalizeLinkText(url)
token.content = state.md.normalizeLinkText(url)

token = state.push("link_close", "a", -1)
token.markup = "autolink"
Expand Down

0 comments on commit d9c7c79

Please sign in to comment.