Skip to content

Commit

Permalink
Detect material version and make test agnostic to CDN path
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Sep 20, 2023
1 parent f36f937 commit a2c9a4e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 7 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Changelog

## 1.2

- **NEW**: Add official support for Python 3.11 and 3.12.
- **NEW**: Remove support for Python 3.7.
- **FIX**: Update to support latest Material.

## 1.1.1

- **FIX**: Properly handle special glob characters in path.

## 1.1.0
## 1.1

- **NEW**: Drop Python 3.6 and officially support 3.10.
- **NEW**: Cache emoji table to reduce build times.
Expand Down
6 changes: 5 additions & 1 deletion materialx/emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@

OPTION_SUPPORT = pymdownx.__version_info__ >= (7, 1, 0)
RESOURCES = os.path.dirname(inspect.getfile(material))
if os.path.exists(os.path.join(RESOURCES, 'templates', '.icons')):
RES_PATH = os.path.join(RESOURCES, 'templates', '.icons')
else:
RES_PATH = os.path.join(RESOURCES, '.icons')


def _patch_index(options):
"""Patch the given index."""

icon_locations = options.get('custom_icons', [])[:]
icon_locations.append(os.path.join(RESOURCES, 'templates', '.icons'))
icon_locations.append(RES_PATH)
return _patch_index_for_locations(tuple(icon_locations))


Expand Down
3 changes: 2 additions & 1 deletion tests/extensions/test_emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from materialx import emoji
from bs4 import BeautifulSoup
import markdown
from pymdownx.emoji import TWEMOJI_SVG_CDN


class TestEmoji(util.MdCase):
Expand Down Expand Up @@ -46,5 +47,5 @@ def test_twemoji(self):

self.check_markdown(
':smile:',
'<p><img alt="\U0001f604" class="twemoji" src="https://twemoji.maxcdn.com/v/latest/svg/1f604.svg" title=":smile:" /></p>' # noqa: E501
'<p><img alt="\U0001f604" class="twemoji" src="{}1f604.svg" title=":smile:" /></p>'.format(TWEMOJI_SVG_CDN) # noqa: E501
)

0 comments on commit a2c9a4e

Please sign in to comment.