Skip to content

Commit 6252400

Browse files
authored
Add doxygen source to the generated site (#169)
- added Doxygen source code generation step - added integration of the result of it into the Dev guide - added an open_in_blank page option to any links in the links file Signed-off-by: Hofi <[email protected]>
2 parents 3395955 + 81a876c commit 6252400

File tree

7 files changed

+51
-3
lines changed

7 files changed

+51
-3
lines changed

.github/workflows/jekyll-gh-pages.yml

+14
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ jobs:
9696
./_tools/pack debug
9797
ls -AlR _site/assets/js
9898
99+
# Generate and add Doxygen source documentation
100+
sudo apt-get install doxygen graphviz -y
101+
102+
OSE_SRC_REPO=https://github.com/syslog-ng/syslog-ng.git
103+
OSE_SRC_REPO_BRANCH=develop # as this is a developer documentation use the latest develop branch instead of the master
104+
git clone --branch ${OSE_SRC_REPO_BRANCH} --single-branch ${OSE_SRC_REPO} ./_work
105+
106+
pushd ./_work
107+
# How to override Doxygen options from command line
108+
# https://www.doxygen.nl/manual/faq.html#faq_cmdline
109+
( cat ./Doxyfile; echo "OUTPUT_DIRECTORY=../_site/dev-guide/chapter_9/" ) | doxygen -
110+
popd
111+
rm -Rf ./_work
112+
99113
- name: Upload artifact
100114
# Automatically uploads an artifact from the './_site' directory by default
101115
uses: actions/upload-pages-artifact@v3

_data/external_links.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ sn-ose-adminguide:
107107
url: https://syslog-ng.github.io/admin-guide/README
108108
title: [ "The syslog-ng OSE Administration Guide" ]
109109

110+
sn-ose-source-doc:
111+
id: sn-ose-source-doc
112+
url: /dev-guide/chapter_9/html/index.html
113+
title: [ "syslog-ng OSE source code documentation" ]
114+
open_in_blank: true
115+
110116
sn-ose-upgrade:
111117
id: sn-ose-upgrade
112118
url: https://syslog-ng.com/blog/upgrading-from-syslog-ng-open-source-to-premium-edition/
@@ -795,7 +801,12 @@ discord-wh-intro:
795801
id: discord-wh-intro
796802
url: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
797803
title: [ "Discord: Intro to Webhooks" ]
798-
804+
805+
doxygen-home:
806+
id: doxygen-home
807+
url: https://www.doxygen.nl/
808+
title: [ "Doxygen HomePage" ]
809+
799810
ebpf:
800811
id: ebpf
801812
url: https://ebpf.io/

_data/link_aliases.yml

+3
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,6 @@ adm-src-wild:
104104

105105
adm-src-file:
106106
aliases: [ "/file(?:\\(\\))? source[s]?/" ]
107+
108+
doxygen-home:
109+
aliases: [ "/[Dd]oxygen/" ]

_data/navigation.yml

+6
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ admin-guide-nav:
327327
url: /admin-guide/070_Destinations/030_Elasticsearch-http/000_Batch_mode_and_load_balancing
328328
- title: "elasticsearch-http() destination options"
329329
url: /admin-guide/070_Destinations/030_Elasticsearch-http/001_Elasticsearch-http_options
330+
- title: "elasticsearch-datastream"
331+
url: /admin-guide/070_Destinations/035_elasticsearch-datastream/README
332+
subnav:
330333
- title: "file"
331334
url: /admin-guide/070_Destinations/040_File/README
332335
subnav:
@@ -1267,6 +1270,9 @@ dev-guide-nav:
12671270
url: /dev-guide/chapter_8/section_4
12681271
- title: "Template Function"
12691272
url: /dev-guide/chapter_8/section_5
1273+
- title: "Source code documentation"
1274+
url: /dev-guide/chapter_9/README
1275+
subnav:
12701276

12711277
# doc-guide
12721278
doc-guide-nav:

_plugins/generate_tooltips.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def is_modifiable_markdown_part?(part)
5454
end
5555

5656
def make_tooltip(page, page_links, id, url, match)
57+
use_blank = false
5758
match_parts = match.split(/(?<!\\)\|/)
5859

5960
# If the text has an '|' it means it comes from our special autolink/tooltip [[text|id]] markdown block
@@ -74,6 +75,7 @@ def make_tooltip(page, page_links, id, url, match)
7475
end
7576
link_data = page_links[id]
7677
if link_data != nil
78+
use_blank = link_data["open_in_blank"]
7779
url = link_data["url"]
7880
url = prefixed_url(url, page.site.config["baseurl"])
7981
else
@@ -99,7 +101,7 @@ def make_tooltip(page, page_links, id, url, match)
99101
# NOTE: Now we treat every link that has protocol prefix part as an external one
100102
# that allows usage of direct links anywhere if needed (not recommended, plz use external_links.yml instead)
101103
# but, at the same time requires e.g. all the really external links to be fully qualified (even in external_links.yml as well)
102-
external_url = is_prefixed_url?(url)
104+
external_url = is_prefixed_url?(url) || use_blank
103105
title = save_from_markdownify(title)
104106
replacement_text = '<a href="' + url + '" class="nav-link content-tooltip"' + (external_url ? ' target="_blank"' : '') + '>' + title + '</a>'
105107
# puts "replacement_text: " + replacement_text
@@ -345,6 +347,7 @@ def gen_page_link_data(links_dir, link_files_pattern)
345347
page_id = yaml_content['id']
346348
page_url = yaml_content['url']
347349
page_title = yaml_content['title']
350+
open_in_blank = yaml_content['open_in_blank']
348351
chars_to_remove = %{"'}
349352
page_title = page_title.gsub(/\A[#{Regexp.escape(chars_to_remove)}]+|[#{Regexp.escape(chars_to_remove)}]+\z/, '')
350353
#puts "page_title: " + page_title
@@ -358,6 +361,7 @@ def gen_page_link_data(links_dir, link_files_pattern)
358361
"id" => page_id,
359362
"url" => page_url,
360363
"title" => [ page_title ],
364+
"open_in_blank" => open_in_blank,
361365
}
362366

363367
# Add the page_link_data object to the ID dictionary
@@ -423,7 +427,7 @@ def JekyllTooltipGen_debug_page_info(page, details = true)
423427
def JekyllTooltipGen_debug_filter_pages?(page)
424428
debug_pages = {
425429
# "doc/README.md" => true,
426-
}
430+
}
427431
debug_ok = true
428432
# Comment this line out if not debugging!!!
429433
# debug_ok = (debug_pages[page.relative_path] != nil && debug_pages[page.relative_path])

_tools/serve

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ start_process() {
4141
# Either use navgen or build once with JEKYLL_BUILD_LINKS manually in a separate run
4242
# as the output of it must already be presented to be able to serve a valid content
4343
#
44+
if [ "${JEKYLL_BUILD_LINKS}" == "yes" ]; then
45+
echo -e "Generating navigation data..."
46+
./_tools/navgen ./doc ./_data/navigation.yml
47+
fi
4448
JEKYLL_BUILD_LINKS='no' bundle exec jekyll serve ${ALL_PARAMS} &
4549
PROC_PID=$!
4650

doc/_dev-guide/chapter_9/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Source code documentation
3+
id: dev-source-doc
4+
---
5+
6+
We have the {{ site.product.short_name }} [[source code documentation|sn-ose-source-doc]] generated via Doxygen.

0 commit comments

Comments
 (0)