Skip to content

Add short title auto links #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _data/external_links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ sn-graphite:
title: [ "Collecting syslog-ng statistics to Graphite" ]

sn-grouping-by:
id: sn--grouping-by
id: sn-grouping-by
url: https://www.syslog-ng.com/community/b/blog/posts/the-grouping-by-parser-in-syslog-ng-3-8
title: [ "The grouping-by() parser in syslog-ng blog post" ]

Expand Down
54 changes: 54 additions & 0 deletions _data/link_aliases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,59 @@ adm-src-wild:
adm-src-file:
aliases: [ "/file(?:\\(\\))? source[s]?/" ]

adm-src-program:
aliases: [ "program() source" ]

adm-dest-program:
aliases: [ "program() destination" ]

adm-src-mqtt:
aliases: [ "mqtt() source" ]

adm-dest-mqtt:
aliases: [ "mqtt() destination" ]

adm-src-netw:
aliases: [ "network() source" ]

adm-dest-netw:
aliases: [ "network() destination" ]

adm-src-optel:
aliases: [ "opentelemetry() source" ]

adm-dest-optel:
aliases: [ "opentelemetry() destination" ]

adm-src-osquery:
aliases: [ "osquery() source" ]

adm-dest-osquery:
aliases: [ "osquery() destination" ]

adm-src-syslog:
aliases: [ "syslog() source" ]

adm-dest-syslog:
aliases: [ "syslog() destination" ]

adm-src-sng-otlp:
aliases: [ "syslog-ng-otlp() source" ]

adm-dest-sng-otlp:
aliases: [ "syslog-ng-otlp() destination" ]

adm-src-unix:
aliases: [ "unix-dgram() source", "unix-stream() source", "unix-dgram() and unix-stream() source" ]

adm-dest-unix:
aliases: [ "unix-dgram() destination", "unix-stream() destination", "unix-dgram() and unix-stream() destination" ]

adm-man-ctl:
aliases: [ "syslog-ng-ctl" ]

adm-stats:
aliases: [ "syslog-ng-ctl stats", "syslog-ng-ctl query" ]

doxygen-home:
aliases: [ "/[Dd]oxygen/" ]
31 changes: 14 additions & 17 deletions _data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,20 @@ admin-guide-nav:
- title: "Sources"
url: /admin-guide/060_Sources/README
subnav:
- title: "Arr logs"
url: /admin-guide/060_Sources/000_Arr_logs/README
subnav:
- title: "default-network-drivers"
url: /admin-guide/060_Sources/000_Default-network-drivers/README
url: /admin-guide/060_Sources/005_Default-network-drivers/README
subnav:
- title: "default-network-drivers() source options"
url: /admin-guide/060_Sources/000_Default-network-drivers/000_Default-network-drivers_options
url: /admin-guide/060_Sources/005_Default-network-drivers/000_Default-network-drivers_options
- title: "internal"
url: /admin-guide/060_Sources/010_Internal/README
subnav:
- title: "internal() source options"
url: /admin-guide/060_Sources/010_Internal/000_Internal_options
- title: "file"
- title: "file (DEPRECATED)"
url: /admin-guide/060_Sources/020_File/README
subnav:
- title: "file() source options"
Expand All @@ -144,9 +147,6 @@ admin-guide-nav:
url: /admin-guide/060_Sources/020_File/001_File_following
- title: "Notes on reading kernel messages"
url: /admin-guide/060_Sources/020_File/002_Notes_on_reading_kernel_messages
- title: "Arr logs"
url: /admin-guide/060_Sources/025_Arr_logs/README
subnav:
- title: "wildcard-file"
url: /admin-guide/060_Sources/030_Wildcard-file/README
subnav:
Expand Down Expand Up @@ -255,6 +255,11 @@ admin-guide-nav:
subnav:
- title: "snmptrap() source options"
url: /admin-guide/060_Sources/150_snmptrap/000_snmptrap_options
- title: "stdin"
url: /admin-guide/060_Sources/155_stdin/README
subnav:
- title: "stdin() source options"
url: /admin-guide/060_Sources/155_stdin/000_stdin_options
- title: "sun-streams"
url: /admin-guide/060_Sources/160_sun-streams/README
subnav:
Expand Down Expand Up @@ -297,11 +302,6 @@ admin-guide-nav:
url: /admin-guide/060_Sources/220_unix-stream_unix-dgram/000_Unix_credentials
- title: "unix-stream() and unix-dgram() source options"
url: /admin-guide/060_Sources/220_unix-stream_unix-dgram/001_unixstream_source_options
- title: "stdin"
url: /admin-guide/060_Sources/230_stdin/README
subnav:
- title: "stdin() source options"
url: /admin-guide/060_Sources/230_stdin/000_stdin_options
- title: "Destinations"
url: /admin-guide/070_Destinations/README
subnav:
Expand Down Expand Up @@ -918,7 +918,7 @@ admin-guide-nav:
- title: "ruleset"
url: /admin-guide/120_Parser/023_db_parser/004_The_syslog-ng_patterndb_format/000_patterndb/000_ruleset/README
subnav:
- title: "patterns"
- title: "patterns container"
url: /admin-guide/120_Parser/023_db_parser/004_The_syslog-ng_patterndb_format/000_patterndb/000_ruleset/000_patterns/README
subnav:
- title: "rules"
Expand Down Expand Up @@ -951,7 +951,7 @@ admin-guide-nav:
- title: "create-context"
url: /admin-guide/120_Parser/023_db_parser/004_The_syslog-ng_patterndb_format/000_patterndb/000_ruleset/002_actions/000_action/000_create_context/README
subnav:
- title: "tags"
- title: "element tags"
url: /admin-guide/120_Parser/023_db_parser/004_The_syslog-ng_patterndb_format/000_patterndb/000_ruleset/003_tags/README
subnav:
- title: "OpenTelemetry parser"
Expand Down Expand Up @@ -1145,7 +1145,7 @@ dev-guide-nav:
subnav:
- title: "file() Destination Driver"
url: /dev-guide/chapter_4/section_2/macos-testing-status/affile/file-destination-driver
- title: "file() Source Driver"
- title: "file() Source Driver (DEPRECATED)"
url: /dev-guide/chapter_4/section_2/macos-testing-status/affile/file-source-driver
- title: "pipe() Destination Driver"
url: /dev-guide/chapter_4/section_2/macos-testing-status/affile/pipe-destination-driver
Expand Down Expand Up @@ -1194,9 +1194,6 @@ dev-guide-nav:
url: /dev-guide/chapter_4/section_2/macos-testing-status/afuser
- title: "elasticsearch-http"
url: /dev-guide/chapter_4/section_2/macos-testing-status/elasticsearch-http
- title: "grpc"
url: /dev-guide/chapter_4/section_2/macos-testing-status/grpc/README
subnav:
- title: "http"
url: /dev-guide/chapter_4/section_2/macos-testing-status/http
- title: "mod-python"
Expand Down
23 changes: 22 additions & 1 deletion _plugins/generate_links.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def write_yaml_file(file_path, data)
file.write("id: " + data["id"] + "\n")
file.write("url: " + data["url"] + "\n")
file.write("title: " + data["title"] + "\n")
file.write("pri: " + data["pri"].to_s + "\n")
end
#puts file_path
end
Expand Down Expand Up @@ -88,6 +89,7 @@ def generate_links(page, ids, titles)
"id" => page_id + "##{heading_id}",
"url" => page_url + "##{heading_id}",
"title" => '"' + render_title(page, heading.text) + '"',
"pri" => 50,
}
#register_id(page, link_data["id"], link_data["title"], ids, titles)

Expand All @@ -111,6 +113,7 @@ def generate_links(page, ids, titles)
"id" => anchor_id,
"url" => page_url + "##{anchor_name}",
"title" => '"' + (anchor_text.empty? ? anchor_id : render_title(page, anchor_text)) + '"',
"pri" => 50,
}
#register_id(page, link_data["id"], link_data["title"], ids, titles)

Expand All @@ -125,11 +128,29 @@ def generate_links(page, ids, titles)
"id" => page_id,
"url" => page_url,
"title" => '"' + page_title + '"',
"pri" => 50,
}
register_id(page, page_link_data["id"], page_link_data["title"], ids, titles)

# Write data to separate YAML file for each page
page_file_path = "#{page_id}.#{link_ext}"
page_file_path = "#{page_link_data["id"]}.#{link_ext}"
page_file_path = "_data/links/" + page_file_path.gsub(/\/|:|\s/, "-").downcase
write_yaml_file(page_file_path, page_link_data)

# Create links data for the page short_title too
page_short_title = page.data["short_title"]
if page_short_title and not page_short_title.empty?
page_link_data = {
"id" => page_id + "_short_title",
"url" => page_url,
"title" => '"' + page_short_title + '()"',
"pri" => 100,
}
register_id(page, page_link_data["id"], page_link_data["title"], ids, titles)
end

# Write data to separate YAML file for each page short_title
page_file_path = "#{page_link_data["id"]}.#{link_ext}"
page_file_path = "_data/links/" + page_file_path.gsub(/\/|:|\s/, "-").downcase
write_yaml_file(page_file_path, page_link_data)

Expand Down
8 changes: 6 additions & 2 deletions _plugins/generate_tooltips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ def filtered_page_ids_sorted_by_title_len(page_links)
page_links.each do |page_id, page_data|
#puts "page_id: #{page_id}, page_data: #{page_data}"
titles = page_data["title"]
pri = page_data["pri"]

titles.each do |title|
# Skip excluded titles
Expand All @@ -316,15 +317,16 @@ def filtered_page_ids_sorted_by_title_len(page_links)
sorted_arr << page_link_data = {
"id" => page_id,
"title" => title,
"pri" => pri,
}
end
end

# With this reversed length sort order we try to guarantie that
# With this reversed length sort order we try to guarantee that
# the autolink/tooltip title pattern matching finds titles like
# 'Soft macros' before 'macros'
# In most of the cases matching the longer titles first will eliminate such issues
sorted_arr.sort_by { |page| page["title"].length }.reverse
sorted_arr.sort_by { |page| [page["title"].length, page["pri"].to_i] }.reverse

# Just for debugging
# sorted_arr.each do |data|
Expand All @@ -348,6 +350,7 @@ def gen_page_link_data(links_dir, link_files_pattern)
page_url = yaml_content['url']
page_title = yaml_content['title']
open_in_blank = yaml_content['open_in_blank']
page_pri = yaml_content['pri']
chars_to_remove = %{"'}
page_title = page_title.gsub(/\A[#{Regexp.escape(chars_to_remove)}]+|[#{Regexp.escape(chars_to_remove)}]+\z/, '')
#puts "page_title: " + page_title
Expand All @@ -360,6 +363,7 @@ def gen_page_link_data(links_dir, link_files_pattern)
page_link_data = {
"id" => page_id,
"url" => page_url,
"pri" => (page_pri ? page_pri : 50),
"title" => [ page_title ],
"open_in_blank" => open_in_blank,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: program() source options
id: adm-src-prog-opt
id: adm-src-program-opt
description: >-
This section describes the options of the program() source in {{ site.product.short_name }}.
---
Expand Down
2 changes: 1 addition & 1 deletion doc/_admin-guide/060_Sources/130_Program/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'program: Receiving messages from external applications'
short_title: program
id: adm-src-prog
id: adm-src-program
description: >-
The program driver starts an external application and reads messages
from the standard output (stdout) of the application. It is mainly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: syslog-ng-otlp() source options
id: adm-src-otlp-opt
id: adm-src-sng-otlp-opt
description: >-
This section describes the options of the syslog-ng-otlp() source in {{ site.product.short_name }}.
---
Expand Down
2 changes: 1 addition & 1 deletion doc/_admin-guide/060_Sources/175_syslog-otlp/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'syslog-ng-otlp() source'
short_title: syslog-ng-otlp
id: adm-src-otlp
id: adm-src-sng-otlp
description: >-
In syslog-ng OSE 4.4 and later versions, the syslog-ng-otlp() source and destination make it possible to transfer the internal representation of log messages between syslog-ng OSE instances, using the OpenTelemetry protocol. The syslog-ng-otlp() utilizes the OpenTelemetry protocol for efficient and reliable log message transmission instead of the traditional syslog-ng() drivers, which rely on simple TCP connections.
---
Expand Down
2 changes: 1 addition & 1 deletion doc/_admin-guide/070_Destinations/060_Graylog/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'graylog2(): Sending logs to Graylog'
short_title: Graylog
short_title: graylog2
id: adm-dest-graylog
description: >-
You can use the graylog2() destination and a Graylog Extended Log Format
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Element: patterns container'
short_title: patterns
short_title: patterns container
id: adm-parser-db-elem-patterns-ruleset
description: >-
A container element. A \<patterns\> element may contain any number of \<pattern\> elements.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Element: tags'
short_title: tags
short_title: element tags
id: adm-parser-db-elem-tags
description: >-
An element containing custom keywords (tags) about the
Expand Down