mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
They are auto-generated, so they wouldn't normally contain Liquid
(The post-processor may insert some, but it has control over the `raw` tags)
Some code introduced as examples contains `{{` due to nested brace expansions,
which was interpreted as (invalid) Liquid. This fixes such problems.
Additionally, Jekyll generates warnings about excerpts being part of a Liquid
block (the `{% raw %}`). This is fine, since doc pages don't use excerpts.
57 lines
1.2 KiB
Awk
Executable File
57 lines
1.2 KiB
Awk
Executable File
#!/usr/bin/awk -f
|
|
|
|
/^\s+<td><b class="Sy">.+<\/b><\/td>$/ {
|
|
# Assuming that all cells whose contents are bold are heading cells,
|
|
# use the HTML tag for those
|
|
sub(/td><b class="Sy"/, "th");
|
|
sub(/b><\/td/, "th");
|
|
}
|
|
|
|
# The whole page is being generated, so it's not meant to contain any Liquid
|
|
BEGIN {
|
|
print "{% raw %}"
|
|
}
|
|
END {
|
|
print "{% endraw %}"
|
|
}
|
|
|
|
BEGIN {
|
|
in_synopsis = 0
|
|
}
|
|
/<table class="Nm">/ {
|
|
in_synopsis = 1
|
|
}
|
|
/<\/table>/ {
|
|
# Resets synopsis state even when already reset, but whatever
|
|
in_synopsis = 0
|
|
}
|
|
/<code class="Fl">-[a-zA-Z]/ {
|
|
# Add links to arg descr in synopsis section
|
|
if (in_synopsis) {
|
|
while (match($0, /<code class="Fl">-[a-zA-Z]+/)) {
|
|
# 123456789012345678 -> 18 chars
|
|
optchars = substr($0, RSTART + 18, RLENGTH - 18)
|
|
i = length(optchars)
|
|
while (i) {
|
|
end = RSTART + 18 + i
|
|
i -= 1
|
|
len = i ? 1 : 2
|
|
$0 = sprintf("%s<a href=\"#%s\">%s</a>%s",
|
|
substr($0, 0, end - len - 1),
|
|
substr($0, end - 1, 1),
|
|
substr($0, end - len, len),
|
|
substr($0, end))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
# Make long opts (defined using `Fl Fl`) into a single tag
|
|
gsub(/<code class="Fl">-<\/code>\s*<code class="Fl">/, "<code class=\"Fl\">-")
|
|
}
|
|
|
|
{
|
|
print
|
|
}
|