From 72ab90ceadd6a421126643cef6780b8be96f5d17 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Tue, 8 Aug 2017 15:43:28 +0000 Subject: [PATCH] dman: Use d-tags.json instead of d.tag Fixes issue 17731. --- dman.d | 11 ++++++----- posix.mak | 6 +++--- win32.mak | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dman.d b/dman.d index 0d590afbf1..bff79f645f 100755 --- a/dman.d +++ b/dman.d @@ -128,12 +128,13 @@ string DmcCommands(string topic) string D(string topic) { - static struct IndexEntry { string keyword; string[] urls; } - static IndexEntry[] entries = mixin (import("d.tag")); + static immutable tagJson = import("d-tags.json"); - foreach (entry; entries) - if (entry.keyword == topic && entry.urls.length) - return entry.urls[0]; + import std.json; + JSONValue tags = parseJSON(tagJson); + + if (topic in tags && tags[topic].array.length) + return tags[topic][0].str; return null; } diff --git a/posix.mak b/posix.mak index 56c9e13a72..3235365d4e 100644 --- a/posix.mak +++ b/posix.mak @@ -77,10 +77,10 @@ $(TOOLS) $(DOC_TOOLS) $(CURL_TOOLS) $(TEST_TOOLS): $(ROOT)/%: %.d ALL_OF_PHOBOS_DRUNTIME_AND_DLANG_ORG = # ??? -$(DOC)/d.tag : $(ALL_OF_PHOBOS_DRUNTIME_AND_DLANG_ORG) - ${MAKE} --directory=${DOC} -f posix.mak d.tag +$(DOC)/d-tags.json : $(ALL_OF_PHOBOS_DRUNTIME_AND_DLANG_ORG) + ${MAKE} --directory=${DOC} -f posix.mak d-tags.json -$(ROOT)/dman: $(DOC)/d.tag +$(ROOT)/dman: $(DOC)/d-tags.json $(ROOT)/dman: DFLAGS += -J$(DOC) install: $(TOOLS) $(CURL_TOOLS) $(ROOT)/dustmite diff --git a/win32.mak b/win32.mak index 21aa383507..ffbbf6db83 100644 --- a/win32.mak +++ b/win32.mak @@ -54,10 +54,10 @@ dustmite: $(ROOT)\dustmite.exe ALL_OF_PHOBOS_DRUNTIME_AND_DLANG_ORG = # ??? -$(DOC)\d.tag : $(ALL_OF_PHOBOS_DRUNTIME_AND_DLANG_ORG) - cmd /C "cd $(DOC) && $(MAKE) -f win32.mak d.tag" +$(DOC)\d-tags.json : $(ALL_OF_PHOBOS_DRUNTIME_AND_DLANG_ORG) + cmd /C "cd $(DOC) && $(MAKE) -f win32.mak d-tags.json" -$(ROOT)\dman.exe : dman.d $(DOC)\d.tag +$(ROOT)\dman.exe : dman.d $(DOC)\d-tags.json $(DMD) $(DFLAGS) -of$@ dman.d -J$(DOC) $(ROOT)\rdmd.exe : rdmd.d