💾 Archived View for midnight.pub › replies › 46 captured on 2024-08-18 at 19:16:22. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-04-28)
-=-=-=-=-=-=-
Okay, trying it one more time, this time with a bit more attention to lines beginning with whitespace:
y1:
<pre><code>#! /usr/bin/env lua<br>local lines = {}<br>for line in io.stdin:lines() do<br> table.insert(lines, line)<br>end<br>local url = ''<br>if arg[1] then<br> url = ' ' .. arg[1]<br>end<br>local handle = io.popen('fmt -60 | quote-br' .. url, 'w')<br>handle:write(table.concat(lines, ' '))<br>handle:close()<br>local num_url_spaces = 30<br>if arg[1] then<br> io.stdout:write('><br>>')<br> for i=1,num_url_spaces do<br> io.stdout:write(' ')<br> end<br> print('- ' .. arg[1])<br>end<br></code></pre>
quote-br:
<pre><code>#! /usr/bin/env lua<br>local lines = {}<br>for line in io.stdin:lines() do<br> if arg[1] then<br> local whitespace,rest = string.match(line, '^(%s+)(.*)