Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c816fb1ea8 | ||
|
|
92f810592e | ||
|
|
ab0eb1dd29 | ||
|
|
57f716b2f9 | ||
|
|
236822885e |
@@ -1,6 +1,12 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
0.3.1
|
||||||
|
-----
|
||||||
|
|
||||||
|
- Fix issue when ``source_suffix`` equals ``source_link_suffix``
|
||||||
|
`#29 <https://github.com/jdillard/sphinx-llms-txt/pull/29>`_
|
||||||
|
|
||||||
0.3.0
|
0.3.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
A Sphinx extension that generates a summary `llms.txt` file and a single combined documentation `llms-full.txt` file.
|
A Sphinx extension that generates a summary `llms.txt` file and a single combined documentation `llms-full.txt` file.
|
||||||
|
|
||||||
[](https://pypi.python.org/pypi/sphinx-llms-txt)
|
[](https://pypi.python.org/pypi/sphinx-llms-txt)
|
||||||
|
[](https://anaconda.org/conda-forge/sphinx-llms-txt)
|
||||||
[](https://pepy.tech/project/sphinx-llms-txt)
|
[](https://pepy.tech/project/sphinx-llms-txt)
|
||||||
[](#)
|
[](#)
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -81,7 +81,11 @@ html_theme = "furo"
|
|||||||
# further. For a list of options available for each theme, see the
|
# further. For a list of options available for each theme, see the
|
||||||
# documentation.
|
# documentation.
|
||||||
#
|
#
|
||||||
html_theme_options = {}
|
html_theme_options = {
|
||||||
|
"source_repository": "https://github.com/jdillard/sphinx-llms-txt/",
|
||||||
|
"source_branch": "main",
|
||||||
|
"source_directory": "docs/source/",
|
||||||
|
}
|
||||||
|
|
||||||
html_baseurl = "https://sphinx-llms-txt.readthedocs.org/"
|
html_baseurl = "https://sphinx-llms-txt.readthedocs.org/"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Sphinx llms.txt Generator
|
|||||||
|
|
||||||
A `Sphinx`_ extension that generates a summary ``llms.txt`` file, written in Markdown, and a single combined documentation ``llms-full.txt`` file, written in reStructuredText.
|
A `Sphinx`_ extension that generates a summary ``llms.txt`` file, written in Markdown, and a single combined documentation ``llms-full.txt`` file, written in reStructuredText.
|
||||||
|
|
||||||
|PyPI version| |Downloads| |Parallel Safe| |GitHub Stars|
|
|PyPI version| |Conda Version| |Downloads| |Parallel Safe| |GitHub Stars|
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
@@ -20,6 +20,9 @@ A `Sphinx`_ extension that generates a summary ``llms.txt`` file, written in Mar
|
|||||||
.. |PyPI version| image:: https://img.shields.io/pypi/v/sphinx-llms-txt.svg
|
.. |PyPI version| image:: https://img.shields.io/pypi/v/sphinx-llms-txt.svg
|
||||||
:target: https://pypi.python.org/pypi/sphinx-llms-txt
|
:target: https://pypi.python.org/pypi/sphinx-llms-txt
|
||||||
:alt: Latest PyPi Version
|
:alt: Latest PyPi Version
|
||||||
|
.. |Conda Version| image:: https://img.shields.io/conda/vn/conda-forge/sphinx-llms-txt.svg
|
||||||
|
:target: https://anaconda.org/conda-forge/sphinx-llms-txt
|
||||||
|
:alt: Latest Conda Version
|
||||||
.. |Downloads| image:: https://static.pepy.tech/badge/sphinx-llms-txt/month
|
.. |Downloads| image:: https://static.pepy.tech/badge/sphinx-llms-txt/month
|
||||||
:target: https://pepy.tech/project/sphinx-llms-txt
|
:target: https://pepy.tech/project/sphinx-llms-txt
|
||||||
:alt: PyPi Downloads per month
|
:alt: PyPi Downloads per month
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ from .manager import LLMSFullManager
|
|||||||
from .processor import DocumentProcessor
|
from .processor import DocumentProcessor
|
||||||
from .writer import FileWriter
|
from .writer import FileWriter
|
||||||
|
|
||||||
__version__ = "0.3.0"
|
__version__ = "0.3.1"
|
||||||
|
|
||||||
# Export classes needed by tests
|
# Export classes needed by tests
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|||||||
@@ -90,7 +90,13 @@ class DocumentCollector:
|
|||||||
|
|
||||||
# Try to find the source file with any of the valid source suffixes
|
# Try to find the source file with any of the valid source suffixes
|
||||||
for src_suffix in source_suffixes:
|
for src_suffix in source_suffixes:
|
||||||
candidate_file = sources_dir / f"{docname}{src_suffix}{source_link_suffix}"
|
# Avoid duplicate extensions when source_suffix == source_link_suffix
|
||||||
|
if src_suffix == source_link_suffix:
|
||||||
|
candidate_file = sources_dir / f"{docname}{src_suffix}"
|
||||||
|
else:
|
||||||
|
candidate_file = (
|
||||||
|
sources_dir / f"{docname}{src_suffix}{source_link_suffix}"
|
||||||
|
)
|
||||||
if candidate_file.exists():
|
if candidate_file.exists():
|
||||||
return src_suffix
|
return src_suffix
|
||||||
|
|
||||||
|
|||||||
@@ -138,13 +138,22 @@ class LLMSFullManager:
|
|||||||
|
|
||||||
# Build the source file path directly using the known suffix
|
# Build the source file path directly using the known suffix
|
||||||
if src_suffix:
|
if src_suffix:
|
||||||
source_file = sources_dir / f"{docname}{src_suffix}{source_link_suffix}"
|
# Avoid duplicate extensions when source_suffix == source_link_suffix
|
||||||
|
if src_suffix == source_link_suffix:
|
||||||
|
source_file = sources_dir / f"{docname}{src_suffix}"
|
||||||
|
expected_suffix = src_suffix
|
||||||
|
else:
|
||||||
|
source_file = (
|
||||||
|
sources_dir / f"{docname}{src_suffix}{source_link_suffix}"
|
||||||
|
)
|
||||||
|
expected_suffix = f"{src_suffix}{source_link_suffix}"
|
||||||
|
|
||||||
if source_file.exists():
|
if source_file.exists():
|
||||||
docname_to_file[docname] = source_file
|
docname_to_file[docname] = source_file
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"sphinx-llms-txt: Source file not found for: {docname}."
|
f"sphinx-llms-txt: Source file not found for: {docname}."
|
||||||
f"Expected: {docname}{src_suffix}{source_link_suffix}"
|
f"Expected: {docname}{expected_suffix}"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
@@ -205,6 +214,10 @@ class LLMSFullManager:
|
|||||||
source_suffixes = self._get_source_suffixes()
|
source_suffixes = self._get_source_suffixes()
|
||||||
all_source_files = []
|
all_source_files = []
|
||||||
for src_suffix in source_suffixes:
|
for src_suffix in source_suffixes:
|
||||||
|
# Avoid duplicate extensions when source_suffix == source_link_suffix
|
||||||
|
if src_suffix == source_link_suffix:
|
||||||
|
glob_pattern = f"**/*{src_suffix}"
|
||||||
|
else:
|
||||||
glob_pattern = f"**/*{src_suffix}{source_link_suffix}"
|
glob_pattern = f"**/*{src_suffix}{source_link_suffix}"
|
||||||
all_source_files.extend(sources_dir.glob(glob_pattern))
|
all_source_files.extend(sources_dir.glob(glob_pattern))
|
||||||
|
|
||||||
@@ -231,7 +244,12 @@ class LLMSFullManager:
|
|||||||
|
|
||||||
# Try each source suffix to find which one this file uses
|
# Try each source suffix to find which one this file uses
|
||||||
for src_suffix in source_suffixes:
|
for src_suffix in source_suffixes:
|
||||||
|
# Avoid duplicate extensions when suffixes match
|
||||||
|
if src_suffix == source_link_suffix:
|
||||||
|
combined_suffix = src_suffix
|
||||||
|
else:
|
||||||
combined_suffix = f"{src_suffix}{source_link_suffix}"
|
combined_suffix = f"{src_suffix}{source_link_suffix}"
|
||||||
|
|
||||||
if rel_path.endswith(combined_suffix):
|
if rel_path.endswith(combined_suffix):
|
||||||
docname = rel_path[: -len(combined_suffix)] # Remove suffix
|
docname = rel_path[: -len(combined_suffix)] # Remove suffix
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user