Subject: split func.sgml to separated individual sgml files

From: jian he <[email-masked]>
Date: Thu, 7 Nov 2024 12:15:05 +0800

hi.

move to a new thread.
Since the old thread[1], many things have interacted together.

we are going to split func.sgml to 31 inviduaul sgml files.
the new file name pattern is "func-" as the prefix.
all the func-*.sgml files stored in doc/src/sgml/func
based on the original func.sgml line number,
each file has a line beginning and line end,
which is why the python script is long.

python3 v1-0001-split_func_sgml.py
git apply v1-0001-all-filelist-for-directory-doc-src-sgml-func.patch
execute the above two commands, we should go good to go.

The following is step-by-step logic.

#--step0 get line number info, and validate it.
in func.sgml, we have 62 "sect1", these corresponding to the line
begin and line end of the new sgml file.
so in func.sgml, we locate and validate it.
later we use the SED command to do the copy, and need these line
number information.

#--step1. create doc/src/sgml/func directory, move func.sgml to there.
create each new empty invidual sgml file

#---step2 construct sed copy commands and execute it.
This will roughly copy func.sgml content from line 52 to line 31655 to
corresponding new individual sgml file, based on
line number information.

#-----step3 validates that the new file only has 2 "sect1". also
validate new files "<sect1 id.*"is unique.".
just to make sure the output works fine.

#---setp4 truncate func.sgml begins from line 52.

#---step5 append place-holder string to func.sgml

[1]
https://www.postgresql.org/message-id/flat/CA%2BTgmoZ2F%2BK0j%3D6BOJLD%3DYfpJMdJRXC7sWmtXGRjx1Rq0x8PUA%40mail.gmail.com
From d123a7c9ef6ad45e3b697aa20bcfc831f594b45d Mon Sep 17 00:00:00 2001
From: jian he <[email-masked]>
Date: Sun, 21 Jul 2024 20:43:45 +0800
Subject: [PATCH v6 1/1] all filelist for directory doc/src/sgml/func

---
 doc/src/sgml/filelist.sgml      |  5 ++++-
 doc/src/sgml/func/allfiles.sgml | 40 +++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 doc/src/sgml/func/allfiles.sgml

diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index a7ff5f82..d9f36933 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -17,7 +17,10 @@
 <!ENTITY datatype   SYSTEM "datatype.sgml">
 <!ENTITY ddl        SYSTEM "ddl.sgml">
 <!ENTITY dml        SYSTEM "dml.sgml">
-<!ENTITY func       SYSTEM "func.sgml">
+
+<!ENTITY % allfiles_func   SYSTEM "func/allfiles.sgml">
+%allfiles_func;
+
 <!ENTITY indices    SYSTEM "indices.sgml">
 <!ENTITY json       SYSTEM "json.sgml">
 <!ENTITY mvcc       SYSTEM "mvcc.sgml">
diff --git a/doc/src/sgml/func/allfiles.sgml b/doc/src/sgml/func/allfiles.sgml
new file mode 100644
index 00000000..34eec608
--- /dev/null
+++ b/doc/src/sgml/func/allfiles.sgml
@@ -0,0 +1,40 @@
+<!--
+doc/src/sgml/func/allfiles.sgml
+PostgreSQL documentation
+Complete list of usable sgml source files in this directory.
+-->
+
+<!-- function references -->
+
+<!ENTITY func                       SYSTEM "func.sgml">
+<!ENTITY func-logical               SYSTEM "func-logical.sgml">
+<!ENTITY func-comparison            SYSTEM "func-comparison.sgml">
+<!ENTITY func-math                  SYSTEM "func-math.sgml">
+<!ENTITY func-string                SYSTEM "func-string.sgml">
+<!ENTITY func-binarystring          SYSTEM "func-binarystring.sgml">
+<!ENTITY func-bitstring             SYSTEM "func-bitstring.sgml">
+<!ENTITY func-matching              SYSTEM "func-matching.sgml">
+<!ENTITY func-formatting            SYSTEM "func-formatting.sgml">
+<!ENTITY func-datetime              SYSTEM "func-datetime.sgml">
+<!ENTITY func-enum                  SYSTEM "func-enum.sgml">
+<!ENTITY func-geometry              SYSTEM "func-geometry.sgml">
+<!ENTITY func-net                   SYSTEM "func-net.sgml">
+<!ENTITY func-textsearch            SYSTEM "func-textsearch.sgml">
+<!ENTITY func-uuid                  SYSTEM "func-uuid.sgml">
+<!ENTITY func-xml                   SYSTEM "func-xml.sgml">
+<!ENTITY func-json                  SYSTEM "func-json.sgml">
+<!ENTITY func-sequence              SYSTEM "func-sequence.sgml">
+<!ENTITY func-conditional           SYSTEM "func-conditional.sgml">
+<!ENTITY func-array                 SYSTEM "func-array.sgml">
+<!ENTITY func-range                 SYSTEM "func-range.sgml">
+<!ENTITY func-aggregate             SYSTEM "func-aggregate.sgml">
+<!ENTITY func-window                SYSTEM "func-window.sgml">
+<!ENTITY func-merge-support         SYSTEM "func-merge-support.sgml">
+<!ENTITY func-subquery              SYSTEM "func-subquery.sgml">
+<!ENTITY func-comparisons           SYSTEM "func-comparisons.sgml">
+<!ENTITY func-srf                   SYSTEM "func-srf.sgml">
+<!ENTITY func-info                  SYSTEM "func-info.sgml">
+<!ENTITY func-admin                 SYSTEM "func-admin.sgml">
+<!ENTITY func-trigger               SYSTEM "func-trigger.sgml">
+<!ENTITY func-event-triggers        SYSTEM "func-event-triggers.sgml">
+<!ENTITY func-statistics            SYSTEM "func-statistics.sgml">
\ No newline at end of file
-- 
2.34.1