Write files with utils
This commit is contained in:
parent
27f068a82f
commit
a8087a2508
2 changed files with 5 additions and 7 deletions
|
@ -2,9 +2,8 @@ from jinja2_simple_tags import StandaloneTag
|
|||
import jinja2
|
||||
from copy import deepcopy
|
||||
from mkdocs.structure.files import File, Files
|
||||
from mkdocs.plugins import event_priority
|
||||
from mkdocs.plugins import event_priority, get_plugin_logger
|
||||
import hashlib
|
||||
from mkdocs.plugins import get_plugin_logger
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from pathlib import Path
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from mkdocs.utils import meta
|
||||
from mkdocs.utils import meta, write_file
|
||||
from mkdocs.structure.files import File, Files
|
||||
import tempfile
|
||||
import os
|
||||
|
@ -33,8 +33,8 @@ def on_files(files: Files, config):
|
|||
|
||||
|
||||
filename = f"{tag}.md"
|
||||
with open(os.path.join(TAGS_TEMP_DIR, filename), "w") as f:
|
||||
f.write(template.render(tag=tag, content=content))
|
||||
|
||||
write_file(template.render(tag=tag, content=content).encode(), os.path.join(TAGS_TEMP_DIR, filename))
|
||||
|
||||
files.append(File(
|
||||
path=filename,
|
||||
|
@ -43,8 +43,7 @@ def on_files(files: Files, config):
|
|||
use_directory_urls=True
|
||||
))
|
||||
|
||||
with open(os.path.join(TAGS_TEMP_DIR, "tags.md"), "w") as f:
|
||||
f.write(list_template.render())
|
||||
write_file(list_template.render().encode(), os.path.join(TAGS_TEMP_DIR, "tags.md"))
|
||||
|
||||
files.append(File(
|
||||
path="tags.md",
|
||||
|
|
Loading…
Reference in a new issue