mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Autogenerate documentation for settings
This commit is contained in:
parent
df6d984d10
commit
4095963b0a
@ -9,7 +9,7 @@ RUN CGO_ENABLED=0 go install github.com/wjdp/htmltest@v${HTMLTEST_VERSION} \
|
||||
# nodejs 17 prefers ipv6 and is broken in our environment
|
||||
FROM node:16-alpine
|
||||
|
||||
RUN apk add --no-cache git openssh bash
|
||||
RUN apk add --no-cache git openssh bash curl
|
||||
|
||||
# At this point we want to really update /opt/clickhouse-docs directory
|
||||
# So we reset the cache
|
||||
@ -33,4 +33,7 @@ RUN mkdir /output_path \
|
||||
COPY run.sh /run.sh
|
||||
COPY --from=htmltest-builder /usr/bin/htmltest /usr/bin/htmltest
|
||||
|
||||
# Install ClickHouse Local, which is used to auto-generate some doc pages.
|
||||
RUN curl https://clickhouse.com/ | sh && ./clickhouse install -y
|
||||
|
||||
ENTRYPOINT ["/run.sh"]
|
||||
|
@ -21,6 +21,60 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
# Generate pages with settings
|
||||
|
||||
ch -q "
|
||||
WITH
|
||||
|
||||
'/ClickHouse/docs/en/operations/settings/settings.md' AS doc_file,
|
||||
'/ClickHouse/src/Core/Settings.cpp' AS cpp_file,
|
||||
|
||||
settings_from_cpp AS
|
||||
(
|
||||
SELECT extract(line, 'M\(\w+, (\w+),') AS name
|
||||
FROM file(cpp_file, LineAsString)
|
||||
WHERE match(line, '^\s*M\(')
|
||||
),
|
||||
|
||||
main_content AS
|
||||
(
|
||||
SELECT format('## {} {}\n\nType: {}\n\nDefault value: {}\n\n{}\n\n', name, '{#'||name||'}', type, default, trim(BOTH '\n' FROM description))
|
||||
FROM system.settings WHERE name IN settings_from_cpp
|
||||
ORDER BY name
|
||||
),
|
||||
|
||||
(SELECT extract(raw_blob, '(^(?:[^#]|#[^#])+)##') FROM file(doc_file, RawBLOB)) AS prefix
|
||||
|
||||
SELECT prefix || (SELECT groupConcat(*) FROM main_content)
|
||||
INTO OUTFILE '/opt/clickhouse-docs/docs/en/operations/settings/settings.md' TRUNCATE FORMAT LineAsString
|
||||
"
|
||||
|
||||
ch -q "
|
||||
WITH
|
||||
|
||||
'/ClickHouse/docs/en/operations/settings/settings-formats.md' AS doc_file,
|
||||
'/ClickHouse/src/Core/FormatFactorySettingsDeclaration.h' AS cpp_file,
|
||||
|
||||
settings_from_cpp AS
|
||||
(
|
||||
SELECT extract(line, 'M\(\w+, (\w+),') AS name
|
||||
FROM file(cpp_file, LineAsString)
|
||||
WHERE match(line, '^\s*M\(')
|
||||
),
|
||||
|
||||
main_content AS
|
||||
(
|
||||
SELECT format('## {} {}\n\nType: {}\n\nDefault value: {}\n\n{}\n\n', name, '{#'||name||'}', type, default, trim(BOTH '\n' FROM description))
|
||||
FROM system.settings WHERE name IN settings_from_cpp
|
||||
ORDER BY name
|
||||
),
|
||||
|
||||
(SELECT extract(raw_blob, '(^(?:[^#]|#[^#])+)##') FROM file(doc_file, RawBLOB)) AS prefix
|
||||
|
||||
SELECT prefix || (SELECT groupConcat(*) FROM main_content)
|
||||
INTO OUTFILE '/opt/clickhouse-docs/docs/en/operations/settings/settings-formats.md' TRUNCATE FORMAT LineAsString
|
||||
"
|
||||
|
||||
# Force build error on wrong symlinks
|
||||
sed -i '/onBrokenMarkdownLinks:/ s/ignore/error/g' docusaurus.config.js
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user