diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-01-06 20:04:14 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-01-06 21:19:51 +0900 |
commit | 9b78ef75522b1f6aa20fc81ddf06e5fb40db152d (patch) | |
tree | 0acde8b8ff28f89d5eea6c547ad6e415f80d93a9 | |
parent | 3dac27897e5b48c5c95fa2f58badec1fb6da94be (diff) |
[DOC] Load options and parse files from srcdir
RDoc options that do not change and can be written in `.rdoc_options`
file are moved, so that they match when called without `make`.
Get rid of parsing the files in `page_dir` twice (as relative paths
and absolute paths).
-rw-r--r-- | .rdoc_options | 3 | ||||
-rw-r--r-- | common.mk | 10 | ||||
-rw-r--r-- | tool/rdoc-srcdir | 20 |
3 files changed, 28 insertions, 5 deletions
diff --git a/.rdoc_options b/.rdoc_options index 760507c7a2..57e03c9dd7 100644 --- a/.rdoc_options +++ b/.rdoc_options @@ -1,4 +1,7 @@ --- page_dir: doc +charset: UTF-8 +encoding: UTF-8 main_page: README.md title: Documentation for Ruby development version +visibility: :private @@ -64,14 +64,14 @@ LIBRUBY_EXTS = ./.libruby-with-ext.time REVISION_H = ./.revision.time PLATFORM_D = $(TIMESTAMPDIR)/.$(PLATFORM_DIR).time ENC_TRANS_D = $(TIMESTAMPDIR)/.enc-trans.time -RDOC = $(XRUBY) "$(srcdir)/libexec/rdoc" --root "$(srcdir)" --encoding=UTF-8 --all +RDOC = $(XRUBY) "$(tooldir)/rdoc-srcdir" RDOCOUT = $(EXTOUT)/rdoc HTMLOUT = $(EXTOUT)/html CAPIOUT = doc/capi INSTALL_DOC_OPTS = --rdoc-output="$(RDOCOUT)" --html-output="$(HTMLOUT)" -RDOC_GEN_OPTS = --page-dir "$(srcdir)/doc" --no-force-update \ +RDOC_GEN_OPTS = --no-force-update \ --title "Documentation for Ruby $(RUBY_API_VERSION)" \ - --main README.md + $(empty) INITOBJS = dmyext.$(OBJEXT) dmyenc.$(OBJEXT) NORMALMAINOBJ = main.$(OBJEXT) @@ -662,11 +662,11 @@ post-install-dbg:: rdoc: PHONY main srcs-doc @echo Generating RDoc documentation - $(Q) $(RDOC) --ri --op "$(RDOCOUT)" $(RDOC_GEN_OPTS) $(RDOCFLAGS) "$(srcdir)" + $(Q) $(RDOC) --ri --op "$(RDOCOUT)" $(RDOC_GEN_OPTS) $(RDOCFLAGS) . html: PHONY main srcs-doc @echo Generating RDoc HTML files - $(Q) $(RDOC) --op "$(HTMLOUT)" $(RDOC_GEN_OPTS) $(RDOCFLAGS) "$(srcdir)" + $(Q) $(RDOC) --op "$(HTMLOUT)" $(RDOC_GEN_OPTS) $(RDOCFLAGS) . rdoc-coverage: PHONY main srcs-doc @echo Generating RDoc coverage report diff --git a/tool/rdoc-srcdir b/tool/rdoc-srcdir new file mode 100644 index 0000000000..10c63caf9e --- /dev/null +++ b/tool/rdoc-srcdir @@ -0,0 +1,20 @@ +#!ruby + +require 'rdoc/rdoc' + +# Make only the output directory relative to the invoked directory. +invoked = Dir.pwd + +# Load options and parse files from srcdir. +Dir.chdir(File.dirname(__dir__)) + +options = RDoc::Options.load_options +options.parse ARGV + +options.singleton_class.define_method(:finish) do + super() + @op_dir = File.expand_path(@op_dir, invoked) +end + +# Do not hide errors when generating documents of Ruby itself. +RDoc::RDoc.new.document options |