From 74f6b1d1aed3b309be791830fb582b79775ed93d Mon Sep 17 00:00:00 2001
From: Hideki Yamane <h-yamane@sios.com>
Date: Tue, 18 Sep 2018 15:49:32 +0900
Subject: [PATCH] Use replace function in sphinx for version and date

By replacing version and date with make, translators cannot do unfuzzy
for those strings. Using replace function in sphinx solves this.
---
 Makefile                           | 13 +++++++++----
 policy/{index.rst.in => index.rst} |  4 +++-
 2 files changed, 12 insertions(+), 5 deletions(-)
 rename policy/{index.rst.in => index.rst} (89%)

diff --git a/Makefile b/Makefile
index 57f1d8c..8d800b4 100644
--- a/Makefile
+++ b/Makefile
@@ -97,7 +97,7 @@ POLICY_FILES := $(MDWN_FILES:=.html)				\
 INFO_FILES := policy/_build/texinfo/debian-policy.info
 
 # Source files that go into the Debian Policy manual.
-POLICY_SOURCE := $(wildcard policy/*.rst) policy/conf.py policy/index.rst
+POLICY_SOURCE := $(wildcard policy/*.rst) policy/conf.py policy/definition.txt
 
 # Used by the clean rules.  FILES_TO_CLEAN are individual generated files to
 # remove.  DIRS_TO_CLEAN are entire directories to remove.
@@ -113,7 +113,8 @@ FILES_TO_CLEAN := $(MDWN_FILES:=.html)			\
 		  $(XML_SINGLE_FILES:=.validate)	\
 		  $(DIA_PNGS)				\
 		  policy/locale/*/LC_MESSAGES/*.mo	\
-		  policy/index.rst			\
+		  policy/conf.py			\
+		  policy/definition.txt			\
 		  version.md version.xml
 
 
@@ -182,7 +183,12 @@ install: all
 # publication date.
 #
 
-policy/conf.py policy/index.rst: %: %.in debian/changelog
+policy/definition.txt: debian/changelog
+	rm -f $@
+	echo '.. |policy_version| replace:: $(VERSION)' >> $@
+	echo '.. |policy_date| replace:: $(DATE)' >> $@
+
+policy/conf.py: %: %.in
 	sed -e 's/@VERSION@/$(VERSION)/' -e 's/@DATE@/$(DATE)/' $< > $@
 
 version.md: debian/changelog
@@ -197,7 +203,6 @@ version.xml: debian/changelog
 	echo '<!ENTITY version "$(VERSION)">'	     >> $@
 	echo '<!ENTITY date    "$(DATE)">'	     >> $@
 
-
 #
 # Individual file and pattern build rules.
 #
diff --git a/policy/index.rst.in b/policy/index.rst
similarity index 89%
rename from policy/index.rst.in
rename to policy/index.rst
index 4afe1d5..aa3fecd 100644
--- a/policy/index.rst.in
+++ b/policy/index.rst
@@ -7,7 +7,9 @@ This includes the structure and contents of the Debian archive and several
 design issues of the operating system, as well as technical requirements
 that each package must satisfy to be included in the distribution.
 
-This is Debian Policy version @VERSION@, released on @DATE@.
+.. include:: definition.txt
+
+This is Debian Policy version |policy_version|, released on |policy_date|.
 
 .. toctree::
    :maxdepth: 3
-- 
2.19.0

