Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Sep 24, 2022
1 parent a8d213e commit 1a0463b
Show file tree
Hide file tree
Showing 4 changed files with 397 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/src/dictionary/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ ned
nl
octocat
online
parser's
plugin
plugins
plusminus
Expand Down
2 changes: 1 addition & 1 deletion pymdownx/blocks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ def split_header(self, block, blocks, length):

# Move block ending to be parsed later
if m:
block = block[:m.start(0)]
end = block[m.start(0):]
blocks.insert(0, end)
block = block[:m.start(0)]

# More formal YAML config
start = RE_YAML_START.match(block.strip('\n'))
Expand Down
16 changes: 7 additions & 9 deletions pymdownx/blocks/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def type_string_insensitive(value):
def type_html_attribute_value(value):
"""Ensure type HTML attribute value or fail."""

return type_string(value).replace('"', '&quote;')
return type_string(value).replace('"', '"')


def type_html_attribute_name(value):
Expand All @@ -117,15 +117,15 @@ def _delimiter(string, split, string_type):
"""Split the string by the delimiter and then parse with the parser."""

l = []
# Ensure input is a string
string = type_string(string)
for s in string.split(split):
s = s.strip()
if not s:
continue
try:
s = string_type(s)
l.append(s)
except Exception:
pass
# Ensure each part conforms to the desired string type
s = string_type(s)
l.append(s)
return l


Expand Down Expand Up @@ -264,7 +264,7 @@ def parse_config(self, args, **options):
# A `None` for a parser means accept as is.
total_parsers = len(parsers)
for e, a in enumerate(arguments):
parser = parsers[e] if e <= total_parsers else parsers[-1]
parser = parsers[e] if e < total_parsers else parsers[-1]
if parser is not None:
try:
a = parser(a)
Expand All @@ -278,8 +278,6 @@ def parse_config(self, args, **options):
spec = self.option_spec
parsed = {}
for k, v in spec.items():
if not k:
continue
parsed[k] = v[0]

# Parse provided options
Expand Down
Loading

0 comments on commit 1a0463b

Please sign in to comment.