Created
July 2, 2022 16:17
-
-
Save wernsey/de253d42a8df6f3b21358e4b5422b955 to your computer and use it in GitHub Desktop.
Awk script to generate Markdeep documentation from source code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/awk -f | |
BEGIN { print "<meta charset=\"utf-8\">" } | |
/\/\*\*/ { | |
sub(/^.*\/\*/,""); | |
incomment=1; | |
} | |
incomment && /\*\// { | |
incomment=0; | |
sub(/[[:space:]]*\*\/.*/,""); | |
sub(/^[[:space:]]*\*[[:space:]]?/,""); | |
} | |
incomment && /^[[:space:]]*\*/ { | |
sub(/^[[:space:]]*\*[[:space:]]?/,""); | |
} | |
!incomment && /\/\/\// { | |
sub(/.*\/\/\/[[:space:]]?/,""); | |
} | |
END { | |
print "<!-- Markdeep: -->"; | |
print "<style class=\"fallback\">body{visibility:hidden;white-space:pre;font-family:monospace}</style>"; | |
print "<script>markdeepOptions={tocStyle:\"auto\"};</script>"; | |
print "<script src=\"https://morgan3d.github.io/markdeep/latest/markdeep.min.js\" charset=\"utf-8\"></script>"; | |
print "<script>window.alreadyProcessedMarkdeep||(document.body.style.visibility=\"visible\")</script>" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment