diff --git a/antsibull/data/docsite/plugins_by_collection.rst.j2 b/antsibull/data/docsite/plugins_by_collection.rst.j2 index 998c2f9b0..fef278ab8 100644 --- a/antsibull/data/docsite/plugins_by_collection.rst.j2 +++ b/antsibull/data/docsite/plugins_by_collection.rst.j2 @@ -15,29 +15,18 @@ Collection version @{ collection_version }@ :maxdepth: 1 {% for section in docsite_sections %} - @{section.title}@ @{ '-' * (section.title | length) }@ {% if section.toctree %} .. toctree:: :maxdepth: 1 -{% if section.entries %} - :hidden: -{% endif %} -{% for toctree_entry in section.toctree %} +{% for toctree_entry in section.toctree %} @{toctree_entry}@ -{% endfor %} +{% endfor %} {% endif %} -{% for entry in section.entries %} -{% if entry.title %} -* :ref:`@{entry.title}@ <@{entry.ref}@>` -{% else %} -* :ref:`@{entry.ref}@` -{% endif %} -{% endfor %} {% endfor %} Plugin Index diff --git a/antsibull/docsite_docs.py b/antsibull/docsite_docs.py index a8faf3151..eefd35e2f 100644 --- a/antsibull/docsite_docs.py +++ b/antsibull/docsite_docs.py @@ -23,23 +23,12 @@ _RST_LABEL_DEFINITION = re.compile(r'''^\.\. _([^:]+):''') -class SectionEntry: - title: t.Optional[str] - ref: str - - def __init__(self, title: t.Optional[str], ref: str): - self.title = title - self.ref = ref - - class Section: title: str - entries: t.List[SectionEntry] toctree: t.List[str] - def __init__(self, title: str, entries: t.List[SectionEntry], toctree: t.List[str]): + def __init__(self, title: str, toctree: t.List[str]): self.title = title - self.entries = entries self.toctree = toctree @@ -103,28 +92,6 @@ def lint_required_conditions(content: str, collection_name: str return sorted(labels), errors -def load_entries(yaml_section: t.Dict[str, t.Any], section_index: int = 0 - ) -> t.Tuple[t.List[SectionEntry], t.List[str]]: - errors: t.List[str] = [] - entries: t.List[SectionEntry] = [] - if 'entries' in yaml_section: - for entry_index, yaml_entry in enumerate(yaml_section['entries']): - if not isinstance(yaml_entry, dict): - errors.append(f'Entry #{entry_index} in section #{section_index}' - ' must be a mapping') - continue - missing = False - for required_key in ('ref', ): - if required_key not in yaml_entry: - errors.append(f'Entry #{entry_index} in section #{section_index}' - f' has no "{required_key}" entry') - missing = True - if missing: - continue - entries.append(SectionEntry(yaml_entry.get('title'), yaml_entry['ref'])) - return entries, errors - - def load_toctree(yaml_section: t.Dict[str, t.Any], section_index: int = 0 ) -> t.Tuple[t.List[str], t.List[str]]: errors: t.List[str] = [] @@ -151,15 +118,13 @@ def load_section(yaml_section: t.Dict[str, t.Any], section_index: int = 0 missing = True if missing: return None, errors - entries, entries_errors = load_entries(yaml_section, section_index) - errors.extend(entries_errors) toctree, toctree_errors = load_toctree(yaml_section, section_index) errors.extend(toctree_errors) - if not entries and not toctree: + if not toctree: errors.append( f'Section #{section_index} has no content') return None, errors - return Section(yaml_section['title'], entries, toctree), errors + return Section(yaml_section['title'], toctree), errors def load_docsite_index(index_path: str, report_not_existing: bool = False diff --git a/antsibull/lint_docsite_docs.py b/antsibull/lint_docsite_docs.py index 4b37d6c57..627ed03e2 100644 --- a/antsibull/lint_docsite_docs.py +++ b/antsibull/lint_docsite_docs.py @@ -13,7 +13,6 @@ from .docsite_docs import ( find_docsite_docs, - get_label_prefix, lint_required_conditions, load_docsite_index, ) @@ -72,14 +71,4 @@ def lint_collection_docsite_files(path_to_collection: str) -> t.List[t.Tuple[str index_path = os.path.join(path_to_collection, 'docs', 'docsite', 'extra-docs.yml') sections, errors = load_docsite_index(index_path, report_not_existing=len(docs) > 0) result.extend((index_path, 0, 0, error) for error in errors) - label_prefix = get_label_prefix(collection_name) - for section in sections: - for entry in section.entries: - if not entry.ref.startswith(label_prefix): - result.append( - (index_path, 0, 0, - f'Label "{entry.ref} does not start with collection prefix "{label_prefix}"')) - elif entry.ref not in all_labels: - result.append( - (index_path, 0, 0, f'Label "{entry.ref} does not appear in included files')) return result