Skip to content

Commit

Permalink
feat(html): Add created datetime as a meta tag
Browse files Browse the repository at this point in the history
This change adds the created datetime in the UTC time zone using ISO
datetime format for HTML output of an RFC.
Example:
```
<meta content="2023-09-21T10:47:04.440964+00:00" name="created">
```

Fixes ietf-tools#1032
  • Loading branch information
kesara committed Sep 22, 2023
1 parent c10a50c commit 48be712
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xml2rfc/writers/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division

import datetime
import lxml
import os
import re
Expand Down Expand Up @@ -473,6 +474,11 @@ def render_rfc(self, h, x):

generator = "%s %s" % (xml2rfc.NAME, xml2rfc.__version__)
add.meta(head, None, name='generator', content=generator)

# o created - date created in UTC timezone using ISO format
current_time = datetime.datetime.now(datetime.timezone.utc)
created = current_time.isoformat(timespec="minutes").replace('+00:00', 'Z')
add.meta(head, None, name='created', content=created)

# o keywords - comma-separated <keyword>s from the XML source

Expand Down

0 comments on commit 48be712

Please sign in to comment.