Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions boostjp/templates/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
{% if latest_commit_info %}
<p class="text-right"><small>
最終更新日時:
<span itemprop="datePublished" content="{{ latest_commit_info['last_updated'].strftime('%Y-%m-%dT%H:%M:%S') }}">
{{ latest_commit_info['last_updated'].strftime('%Y年%m月%d日 %H時%M分%S秒') }}
<span itemprop="datePublished" content="{{ latest_commit_info['last_updated'].strftime('%Y-%m-%dT%H:%M:%S%z') }}">
{{ latest_commit_info['last_updated'].strftime('%Y年%m月%d日 %H時%M分%S秒') }} (JST)
</span>
<br/>
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
Expand Down
6 changes: 3 additions & 3 deletions cpprefjp/templates/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@
{% block latest_commit_info %}
{% if latest_commit_info %}
<p class="text-right"><small>
最終更新日時(UTC):
<span itemprop="datePublished" content="{{ latest_commit_info['last_updated'].strftime('%Y-%m-%dT%H:%M:%S') }}">
{{ latest_commit_info['last_updated'].strftime('%Y年%m月%d日 %H時%M分%S秒') }}
最終更新日時:
<span itemprop="datePublished" content="{{ latest_commit_info['last_updated'].strftime('%Y-%m-%dT%H:%M:%S%z') }}">
{{ latest_commit_info['last_updated'].strftime('%Y年%m月%d日 %H時%M分%S秒') }} (JST)
</span>
<br/>
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
Expand Down
8 changes: 6 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from datetime import datetime
from datetime import datetime, timedelta, timezone
import glob
import importlib
import json
Expand Down Expand Up @@ -469,13 +469,17 @@ def flush(self):
f.write(json.dumps(self._cache))


_JST = timezone(timedelta(hours=9), 'JST')


def get_latest_commit_info(path):
commit_log = subprocess.check_output(['git', 'log', '-1', '--date=iso', '--pretty=format:%at %an', path + '.md'], cwd=settings.INPUT_DIR, text=True, errors='ignore')
if not commit_log:
return None
timestamp, author = commit_log.split(' ', 1)
return {
'last_updated': datetime.fromtimestamp(int(timestamp)),
# git の %at は Unix 時刻 (UTC の瞬間) なので JST に変換して返す。
'last_updated': datetime.fromtimestamp(int(timestamp), _JST),
'last_author': author,
}

Expand Down
Loading