-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: auto-populate markets from template
- Loading branch information
1 parent
66dd58c
commit 303485e
Showing
6 changed files
with
109 additions
and
108 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from __future__ import annotations | ||
|
||
import mkdocs.plugins | ||
|
||
from render_map.auto_populate import auto_populate_map | ||
|
||
@mkdocs.plugins.event_priority(100) | ||
def on_page_markdown( | ||
markdown: str, | ||
page: mkdocs.plugins.Page, | ||
config: mkdocs.plugins.MkDocsConfig, | ||
**kwargs, | ||
): | ||
"""Find all geotags in the markdown and process them into a list of GeoLink objects. | ||
Args: | ||
markdown: The markdown to search for geotags. | ||
page: The page object. | ||
config: The mkdocs config. | ||
Returns: | ||
A list of GeoLink objects. | ||
""" | ||
# Skip, if page is excluded | ||
if page.file.inclusion.is_excluded(): | ||
return | ||
|
||
latitude, longitude = config.extra["auto_populate"]["center"] | ||
radius = config.extra["auto_populate"]["population_radius"] | ||
|
||
geolinks, markdown = auto_populate_map.find_auto_populate_geotags(markdown, latitude, longitude, radius) | ||
|
||
return markdown | ||
|
This file contains 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
This file contains 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