]>
git.madduck.net Git - etc/vim.git/blobdiff - docs/conf.py
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
from pathlib import Path
import re
import string
from pathlib import Path
import re
import string
-from typing import Callable, List, Optional, Pattern, Tuple, Set
+from typing import Callable, Dict, List, Optional, Pattern, Tuple, Set
from dataclasses import dataclass
import logging
from dataclasses import dataclass
import logging
for lineno, line in enumerate(f, start=1):
if lineno >= start_line and lineno < end_line:
contents.append(line)
for lineno, line in enumerate(f, start=1):
if lineno >= start_line and lineno < end_line:
contents.append(line)
- return "".join(contents)
+ result = "".join(contents)
+ # Let's make Prettier happy with the amount of trailing newlines in the sections.
+ if result.endswith("\n\n"):
+ result = result[:-1]
+ if not result.endswith("\n"):
+ result = result + "\n"
+ return result
def get_sections_from_readme() -> List[DocSection]:
def get_sections_from_readme() -> List[DocSection]:
It processes custom sections before the README generated sections so sections in the
README can be overwritten with custom options.
"""
It processes custom sections before the README generated sections so sections in the
README can be overwritten with custom options.
"""
- processed_sections: Set[str] = set()
+ processed_sections: Dict[str, DocSection] = {}
modified_files: Set[Path] = set()
sections: List[DocSection] = custom_sections
sections.extend(readme_sections)
for section in sections:
modified_files: Set[Path] = set()
sections: List[DocSection] = custom_sections
sections.extend(readme_sections)
for section in sections:
- LOG.info(f"Processing '{section.name}' from {section.src}")
if section.name in processed_sections:
if section.name in processed_sections:
f"Skipping '{section.name}' from '{section.src}' as it is a duplicate"
f"Skipping '{section.name}' from '{section.src}' as it is a duplicate"
+ f" of a custom section from '{processed_sections[section.name].src}'"
+ LOG.info(f"Processing '{section.name}' from '{section.src}'")
target_path: Path = CURRENT_DIR / section.get_out_filename()
if target_path in modified_files:
LOG.warning(
target_path: Path = CURRENT_DIR / section.get_out_filename()
if target_path in modified_files:
LOG.warning(
rel = section.src.resolve().relative_to(CURRENT_DIR.parent)
f.write(f'[//]: # "NOTE: THIS FILE WAS AUTOGENERATED FROM {rel}"\n\n')
f.write(contents)
rel = section.src.resolve().relative_to(CURRENT_DIR.parent)
f.write(f'[//]: # "NOTE: THIS FILE WAS AUTOGENERATED FROM {rel}"\n\n')
f.write(contents)
- processed_sections.add(section.name)
+ processed_sections[section.name] = section
modified_files.add(target_path)
modified_files.add(target_path)