Skip to content

Commit

Permalink
WIP allow for granular section restyling via convenience api
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed May 14, 2024
1 parent 7eae1f2 commit ee9d265
Show file tree
Hide file tree
Showing 4 changed files with 374 additions and 132 deletions.
48 changes: 45 additions & 3 deletions great_tables/_gt_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections.abc import Sequence
from dataclasses import dataclass, field, replace
from enum import Enum, auto
from typing import Any, Callable, TypeVar, overload
from typing import Any, Callable, Literal, TypeVar, Union, overload

from typing_extensions import Self, TypeAlias

Expand Down Expand Up @@ -779,10 +779,52 @@ class FootnotePlacement(Enum):
right = auto()
auto = auto()

LocHeaderName = Literal[
"header",
"title",
"subtitle",
]
LocStubheadName = Literal[
"stubhead",
"stubhead_label",
]
LocColumnLabelsName = Literal[
"column_labels",
"spanner_label",
"column_label",
]
LocStubName = Literal[
"stub",
"row_group_label",
"row_label",
"summary_label",
]
LocBodyName = Literal[
"body",
"cell",
"summary"
]
LocFooterName = Literal[
"footer",
"footnotes",
"source_notes",
]
LocUnknownName = Literal[
"none",
]
LocName = Union[
LocHeaderName,
LocStubheadName,
LocColumnLabelsName,
LocStubName,
LocBodyName,
LocFooterName,
LocUnknownName,
]

@dataclass(frozen=True)
class FootnoteInfo:
locname: str | None = None
locname: LocName | None = None
grpname: str | None = None
colname: str | None = None
locnum: int | None = None
Expand All @@ -800,7 +842,7 @@ class FootnoteInfo:

@dataclass(frozen=True)
class StyleInfo:
locname: str
locname: LocName
locnum: int
grpname: str | None = None
colname: str | None = None
Expand Down
Loading

0 comments on commit ee9d265

Please sign in to comment.