Rendering Module

Source: gitlab_overviewer.rendering.__init__.py

Rendering subpackage for gitlab_overviewer.

Implements Specification: Markdown Overview Renderer §1-4 and Specification: Quarto Renderer (index.qmd + project sheets) §1-4, covering:

  • Markdown and Quarto rendering utilities

  • Table rendering helpers and configuration

Provides utilities for rendering tables and documents in Markdown and Quarto formats.

See also: TableConfig, MarkdownRenderer, QuartoRenderer

rendering.quarto

Source: gitlab_overviewer.rendering.quarto.py

Quarto renderer implementation.

Implements Specification: Quarto Renderer (index.qmd + project sheets) §1-8, covering:

  • Directory and naming conventions (§1)

  • index.qmd structure (§2)

  • Summary and detailed sections (§2-3)

  • Error handling (§6)

  • Implementation interface (§8)

class gitlab_overviewer.rendering.quarto.QuartoRenderer(table_config)[source]

Bases: Renderer

__init__(table_config)[source]
render(overview_data, base_dir='quarto')[source]

Render the full index.qmd as a string. Implements Renderer.render(). See /specs/spec_renderer_quarto.md §6 for required output.

Return type:

str

render_index(overview_data, base_dir='quarto')[source]

Render the full index.qmd with all tables and detailed sections.

Return type:

str

render_project_section(od)[source]

Render a detailed section for a project, as in legacy index.qmd.

Return type:

str

write_files(overview_data, base_dir='quarto')[source]

Write rendered output to .qmd files as specified. Implements Renderer.write_files(). See /specs/spec_renderer_quarto.md §6 for file output requirements.

Return type:

None

render_project_qmd(od, group_dir_name)[source]

Render a per-project .qmd file with full frontmatter and content.

Return type:

str

rendering.markdown

Source: gitlab_overviewer.rendering.markdown.py

Markdown renderer implementation.

Implements Specification: Markdown Overview Renderer §1-4, covering:

  • Top-level layout (§1)

  • Summary tables (§2)

  • Project detail sections (§3)

  • Ordering guarantees (§4)

class gitlab_overviewer.rendering.markdown.MarkdownRenderer(table_config)[source]

Bases: Renderer

Markdown renderer implementation as a class. Implements /specs/spec_renderer_markdown.md §6 interface.

__init__(table_config)[source]
write_files(overview_data, output_file='Overview.md', *args, **kwargs)[source]

Write the rendered markdown output to Overview.md. See /specs/spec_renderer_markdown.md §6 for file output requirements.

Return type:

None

render(overview_data, *args, **kwargs)[source]

Render the grouped markdown overview. See /specs/spec_renderer_markdown.md §6 for required output.

Return type:

str

render_project_section(od)[source]

Render a detailed section for a project

Return type:

str

render_summary_table(overview_data)[source]

Render the summary table for the grouped overview data using the default render_table logic (no rowmod), after preprocessing with sort_overview and using od.model_dump().

Return type:

str

rendering.table

Source: gitlab_overviewer.rendering.table.py

Table rendering utilities for repository overview.

Implements Specification: Table Rendering & UI §1-6, covering:

  • Input contract (§1)

  • Column handling (§2)

  • Table structure (§3)

  • Star scale (§4)

  • Group sections (§5)

  • Error handling (§6)

gitlab_overviewer.rendering.table.render_table(overview_table, table_config, rowmod=None, max_priority=5, max_urgency=5, group_by=None)[source]

Render a Markdown table for the repository overview.

Parameters:
  • overview_table (Union[dict[str, dict], list[tuple[str, dict]]]) – Dict with repo names as keys and column values as values, or list of (key, dict) tuples (for sorted tables)

  • table_config (dict) – Dict with ‘columns’ (keys, labels, visible) and optional ‘group_notes’

  • rowmod (Optional[Callable[[Optional[str], str, dict], dict]]) – Optional function to modify each row

  • max_priority (int) – For star rating display

  • max_urgency (int) – For star rating display

  • group_by (Optional[Dict[str, list]]) – Optional grouping dict (e.g. REPOS_BY_GROUP)

Return type:

str

Returns:

Rendered Markdown table as string

Raises:

TableConfigurationError – If column configuration is invalid

exception gitlab_overviewer.rendering.table.TableConfigurationError[source]

Bases: Exception

Exception raised for table configuration errors.

rendering.renderer_base

Source: gitlab_overviewer.rendering.renderer_base.py

class gitlab_overviewer.rendering.renderer_base.Renderer[source]

Bases: ABC

Abstract base class for all renderers.

Implements the required interface for all renderers as per:

  • /specs/spec_renderer_markdown.md §6

  • /specs/spec_renderer_quarto.md §6

  • /specs/spec_model_mapping.md (for data model expectations)

# TODO: Open questions # 1. Should future renderers (e.g., HTML, PDF) follow this interface? (TBD) # 2. Are there additional common methods that should be included in the base interface? (TBD) # Possible candidates: # # * get_supported_formats(cls) -> List[str] # * validate_output(self, output: str) -> bool # * get_default_config(cls) -> dict

abstractmethod render(*args, **kwargs)[source]

Render the output for the given data. See /specs/spec_renderer_markdown.md and /specs/spec_renderer_quarto.md for required output.

Return type:

Any

abstractmethod write_files(*args, **kwargs)[source]

Write rendered output to files as specified. See /specs/spec_renderer_markdown.md and /specs/spec_renderer_quarto.md for file output requirements.

Return type:

None

static is_placeholder_value(val)[source]
Return type:

bool

static star_rating(val, max_val=5)[source]
Return type:

str

static safe_str(val)[source]
Return type:

str

static format_date(dt)[source]
Return type:

str

static parse_iso_date(dt)[source]
Return type:

Optional[datetime]

static parse_comma_list(value)[source]
Return type:

List[str]

static safe_int(value, default=0)[source]
Return type:

int

static safe_float(value, default=0.0)[source]
Return type:

float

static is_numeric_string(value)[source]
Return type:

bool

static get_with_fallback(data, key, fallback='—')[source]
Return type:

str

static format_table_row(row, keys, formatters=None)[source]
Return type:

List[str]

static process_readme_lines(content, max_lines=12)[source]
Return type:

List[str]

static format_priority_urgency(row, priority_key='priority', urgency_key='urgency', max_priority=5, max_urgency=5)[source]
Return type:

dict

static strip_trailing_whitespace(text)[source]
Return type:

str