Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marksweiss/381680 to your computer and use it in GitHub Desktop.
Save marksweiss/381680 to your computer and use it in GitHub Desktop.
# Convert a line of a block to textile
def make_textile(line)
j = 0
prefix = ''
while line[j] == 32
prefix.concat " "
j += 1
end
line = line.strip
if line.length > 0
prefix + '@' + line + "@<br/>"
else
"<br/>"
end
end
# Iterate lines of script block, redirect to file or stdout to just copy out of shell
def make_block_textile(lines)
lines.each do |line|
puts(make_textile(line))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment