From 02101f473b6d16d0b6d019442c41724e308f493b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 8 Oct 2024 23:43:02 +0900 Subject: [PATCH] rdoc-srcdir: Adjust the version number in the title in .rdoc_options Other command line options are no longer needed usually. --- common.mk | 1 - tool/rdoc-srcdir | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/common.mk b/common.mk index de7b553dee..3000a49319 100644 --- a/common.mk +++ b/common.mk @@ -70,7 +70,6 @@ HTMLOUT = $(EXTOUT)/html CAPIOUT = doc/capi INSTALL_DOC_OPTS = --rdoc-output="$(RDOCOUT)" --html-output="$(HTMLOUT)" RDOC_GEN_OPTS = --no-force-update \ - --title "Documentation for Ruby $(RUBY_API_VERSION)" \ $(empty) INITOBJS = dmyext.$(OBJEXT) dmyenc.$(OBJEXT) diff --git a/tool/rdoc-srcdir b/tool/rdoc-srcdir index 10c63caf9e..304deb67ce 100755 --- a/tool/rdoc-srcdir +++ b/tool/rdoc-srcdir @@ -9,6 +9,12 @@ invoked = Dir.pwd Dir.chdir(File.dirname(__dir__)) options = RDoc::Options.load_options +options.title = options.title.sub(/Ruby \K.*version/) { + File.read("include/ruby/version.h") + .scan(/^ *# *define +RUBY_API_VERSION_(MAJOR|MINOR) +(\d+)/) + .sort # "MAJOR" < "MINOR", fortunately + .to_h.values.join(".") +} options.parse ARGV options.singleton_class.define_method(:finish) do