git: 040006ae08 - main - website: improve hardware-notes-processor.rb
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 21 May 2026 07:09:58 UTC
The branch main has been updated by vladlen:
URL: https://cgit.FreeBSD.org/doc/commit/?id=040006ae086d3edd3e57cf21477323a6ef6a2365
commit 040006ae086d3edd3e57cf21477323a6ef6a2365
Author: Vladlen Popolitov <vladlen@FreeBSD.org>
AuthorDate: 2026-05-21 07:09:49 +0000
Commit: Vladlen Popolitov <vladlen@FreeBSD.org>
CommitDate: 2026-05-21 07:09:49 +0000
website: improve hardware-notes-processor.rb
fixes mandoc generation of left bracket
adds messages, when HARDWARE section is absent or empty
remains hwlist macro in hardware.adoc for next cycles
hwlist macro has warning message text in the same line
Reviewed by: carlavilla
Approved by: carlavilla
Differential Revision: https://reviews.freebsd.org/D57133
---
website/tools/hardware-notes-processor.rb | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/website/tools/hardware-notes-processor.rb b/website/tools/hardware-notes-processor.rb
index 9532b54180..1974bf2aea 100644
--- a/website/tools/hardware-notes-processor.rb
+++ b/website/tools/hardware-notes-processor.rb
@@ -23,14 +23,16 @@ hardwareNotesContent = ""
File.foreach(hardwareNotesPath).with_index do |line|
if (line[/&hwlist.\b/])
- manualPage = line.gsub("&hwlist.", "").gsub(";", "").gsub("\n", "")
+ macro = line.match(/&hwlist\.[^\s;]+;?/)[0]
+ manualPage = macro.gsub("&hwlist.", "").gsub(";", "").gsub("\n", "")
if(File.exist?("tmp/share/man/man4/" + manualPage + ".4"))
cmd = "mandoc -Tmarkdown tmp/share/man/man4/" + manualPage + ".4 | sed -n '/^# HARDWARE/,/^# /{ /^# /d; p; }'"
mandocOut, err, s = Open3::capture3(cmd)
if s.success?
- #replace \_ to _ in drivers name and description
+ #replace \_ to _ and \[ to [ in drivers name and description
mandocOut.gsub!(/\\_/, '_')
+ mandocOut.gsub!(/\\\[/, '[')
# extract Nm (real driver name)
nm_cmd = "grep -m1 '^\\.Nm' tmp/share/man/man4/#{manualPage}.4"
@@ -56,10 +58,20 @@ File.foreach(hardwareNotesPath).with_index do |line|
end
end
+ if mandocOut.strip.empty?
+ puts "WARNING: No HARDWARE section content for manual page #{manualPage}"
+ hardwareNotesContent << "#{macro} WARNING: No HARDWARE section content for manual page #{manualPage}\n"
+ next
+ end
+
hardwareNotesContent << mandocOut
+ else
+ puts "WARNING: The manual page " + manualPage + " without HARDWARE exists or malformed"
+ hardwareNotesContent << "#{macro} WARNING: The manual page " + manualPage + " without HARDWARE exists or malformed\n"
end
else
puts "WARNING: The manual page " + manualPage + " does not exists"
+ hardwareNotesContent << "#{macro} WARNING: The manual page " + manualPage + " does not exists\n"
end
else
hardwareNotesContent << line