💾 Archived View for gemini.susa.net › xtract_lua_api.awk captured on 2023-07-22 at 16:47:32.

View Raw

More Information

⬅️ Previous capture (2020-09-24)

➡️ Next capture (2023-09-08)

-=-=-=-=-=-=-

#!/usr/bin/awk -f

BEGIN {
    idx = 0;
}

/^===/ {
    print "```"
    for(i=0; i < (idx - 1); i++)
        print ar[i]
    print "```"
    delete ar
    idx = 0

    print("#",prev);
    next;
}

/^---/ { 
    print "```"
    for(i=0; i < (idx - 1); i++)
        print ar[i]
    print "```"
    delete ar
    idx = 0

    print("##", prev);
    next;
}

/^### / { 
    print "```"
    for(i=0; i < (idx); i++)
        print ar[i]
    print "```"
    print $0
    delete ar
    idx = 0

    next;
}

{
    prev = $0 
    ar[idx++] = $0
}