Skip to content

Commit 8da5630

Browse files
feat: created at metadata (#79)
* feat: created at * version bump
1 parent ac8185f commit 8da5630

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "cmi-docx"
3-
version = "0.6.10"
3+
version = "0.6.11"
44
description = "Additional tooling for Python-docx."
55
readme = "README.md"
66
requires-python = ">=3.12"

src/cmi_docx/declarative/document.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import asyncio
44
import dataclasses
5+
import datetime
56
import io
67
import pathlib
78
from collections.abc import Sequence
@@ -85,6 +86,7 @@ def __init__( # noqa: PLR0913, D107
8586
keywords: str | None = None,
8687
category: str | None = None,
8788
comments: str | None = None,
89+
version: str | None = None,
8890
comment_author: str | None = None,
8991
styles: (
9092
list[styles_mod.ParagraphStyleDefinition | styles_mod.TableStyleDefinition]
@@ -99,6 +101,7 @@ def __init__( # noqa: PLR0913, D107
99101
self.description = description
100102
self.keywords = keywords
101103
self.category = category
104+
self.version = version
102105
self.comments = comments
103106
self.comment_author = comment_author
104107
self.styles = styles
@@ -137,6 +140,13 @@ async def to_docx( # noqa: C901
137140
docx_doc.core_properties.keywords = self.keywords
138141
if self.category:
139142
docx_doc.core_properties.category = self.category
143+
if self.version:
144+
docx_doc.core_properties.version = self.version
145+
if self.comments:
146+
docx_doc.core_properties.comments = self.comments
147+
now = datetime.datetime.now(datetime.UTC)
148+
docx_doc.core_properties.created = now
149+
docx_doc.core_properties.modified = now
140150

141151
if self.styles:
142152
_apply_style_definitions(docx_doc, self.styles)

0 commit comments

Comments
 (0)