mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-05-14 08:28:04 +08:00
[Doc] Fix UTF-8 encoding issues in documentation generation on Windows (#24361)
Signed-off-by: alekramelaheehridoy <aliqramalaheehridoy@gmail.com> Signed-off-by: alekramelaheehridoy <alekramelaheehridoy@gmail.com> Co-authored-by: alekramelaheehridoy <alekramelaheehridoy@gmail.com>
This commit is contained in:
parent
3bca396f79
commit
8c892b1831
@ -165,6 +165,7 @@ def on_startup(command: Literal["build", "gh-deploy", "serve"], dirty: bool):
|
|||||||
# Generate documentation for each parser
|
# Generate documentation for each parser
|
||||||
for stem, parser in parsers.items():
|
for stem, parser in parsers.items():
|
||||||
doc_path = ARGPARSE_DOC_DIR / f"{stem}.md"
|
doc_path = ARGPARSE_DOC_DIR / f"{stem}.md"
|
||||||
with open(doc_path, "w") as f:
|
# Specify encoding for building on Windows
|
||||||
|
with open(doc_path, "w", encoding="utf-8") as f:
|
||||||
f.write(parser.format_help())
|
f.write(parser.format_help())
|
||||||
logger.info("Argparse generated: %s", doc_path.relative_to(ROOT_DIR))
|
logger.info("Argparse generated: %s", doc_path.relative_to(ROOT_DIR))
|
||||||
|
|||||||
@ -106,7 +106,8 @@ class Example:
|
|||||||
|
|
||||||
def determine_title(self) -> str:
|
def determine_title(self) -> str:
|
||||||
if not self.is_code:
|
if not self.is_code:
|
||||||
with open(self.main_file) as f:
|
# Specify encoding for building on Windows
|
||||||
|
with open(self.main_file, encoding="utf-8") as f:
|
||||||
first_line = f.readline().strip()
|
first_line = f.readline().strip()
|
||||||
match = re.match(r'^#\s+(?P<title>.+)$', first_line)
|
match = re.match(r'^#\s+(?P<title>.+)$', first_line)
|
||||||
if match:
|
if match:
|
||||||
@ -174,6 +175,7 @@ def on_startup(command: Literal["build", "gh-deploy", "serve"], dirty: bool):
|
|||||||
doc_path = EXAMPLE_DOC_DIR / example.category / example_name
|
doc_path = EXAMPLE_DOC_DIR / example.category / example_name
|
||||||
if not doc_path.parent.exists():
|
if not doc_path.parent.exists():
|
||||||
doc_path.parent.mkdir(parents=True)
|
doc_path.parent.mkdir(parents=True)
|
||||||
with open(doc_path, "w+") as f:
|
# Specify encoding for building on Windows
|
||||||
|
with open(doc_path, "w+", encoding="utf-8") as f:
|
||||||
f.write(example.generate())
|
f.write(example.generate())
|
||||||
logger.debug("Example generated: %s", doc_path.relative_to(ROOT_DIR))
|
logger.debug("Example generated: %s", doc_path.relative_to(ROOT_DIR))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user