Skip to content

Commit ef29c29

Browse files
committed
update-docs: extract the list of Git project-specific manual pages
There are a couple of "manual pages" that are really not interesting to regular Git users because they affect how to work _with the Git project_, not how to work _with Git_. It is somewhat unfortunate (and a clear lack of separation of concerns) that these are included in what Git's home page calls the "Git reference". Note that this has not been the case for a long time! Only with ea0e16d (docs: include SubmittingPatches, 2018-04-16) it changed, adding a single Git project-specific file to the site. Since that dam was broken, 44bf766 (index.rake: build MyFirstContribution tutorial, 2019-08-14) and later db4e920 (docs: render 'MyFirstObjectWalk', 2020-06-07) introduced _further_ pages that have nothing to do, really, with how to use Git. In preparation for labeling these pages clearly as specific to the Git project, let's extract the list of these _special_ pages to a central location where it can be reused in the Hugo part of the site generation. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent b3fab8a commit ef29c29

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

data/docs_extra.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
git_project_specific:
3+
- MyFirstContribution
4+
- MyFirstObjectWalk
5+
- SubmittingPatches
6+
---

script/update-docs.rb

+18-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
SITE_ROOT = File.join(File.expand_path(File.dirname(__FILE__)), '../')
1414
DOCS_INDEX_FILE = "#{SITE_ROOT}external/docs/content/docs/_index.html"
1515
DATA_FILE = "#{SITE_ROOT}external/docs/data/docs.yml"
16+
DOCS_EXTRA_FILE = "#{SITE_ROOT}data/docs_extra.yml"
1617

1718
def read_data
1819
if File.exist?(DATA_FILE)
@@ -29,6 +30,20 @@ def read_data
2930
data
3031
end
3132

33+
def read_docs_extra
34+
if File.exist?(DOCS_EXTRA_FILE)
35+
# `permitted_classes` required to allow running with Ruby v3.1
36+
docs_extra = YAML.load_file(DOCS_EXTRA_FILE)
37+
else
38+
docs_extra = {}
39+
end
40+
41+
docs_extra.git_project_specific = [] unless docs_extra.git_project_specific
42+
43+
docs_extra
44+
end
45+
46+
3247
def make_asciidoc(content)
3348
Asciidoctor::Document.new(content,
3449
attributes: {
@@ -286,6 +301,7 @@ def index_doc(filter_tags, doc_list, get_content)
286301
rebuild = ENV.fetch("REBUILD_DOC", nil)
287302
rerun = ENV["RERUN"] || rebuild || false
288303

304+
docs_extra = read_docs_extra
289305
data = read_data
290306

291307
tags = filter_tags.call(rebuild).sort_by { |tag| Version.version_to_num(tag.first[1..]) }
@@ -307,9 +323,6 @@ def index_doc(filter_tags, doc_list, get_content)
307323
doc_files = tag_files.select do |ent|
308324
ent.first =~
309325
/^Documentation\/(
310-
SubmittingPatches |
311-
MyFirstContribution.txt |
312-
MyFirstObjectWalk.txt |
313326
(
314327
git.* |
315328
everyday |
@@ -323,7 +336,8 @@ def index_doc(filter_tags, doc_list, get_content)
323336
pull.* |
324337
scalar |
325338
technical\/.*
326-
)\.txt)$/x
339+
)\.txt)$/x or
340+
doc_extra.git_project_specific.include?(ent.first.sub(/^Documentation\/(.*)(\.txt|\.adoc)?$/, '\1'))
327341
end
328342

329343
puts "Found #{doc_files.size} entries"

0 commit comments

Comments
 (0)