-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I plan to write a command where you select one or more lines and then invoke the command to have it interpret the content and transform it into an AsciiDoc block.
Use Case 1: quotations
If every line follows the pattern of: text enclosed in double-quotes (or typographical ones) immediately followed by an em-dash, double n-dashes, or a tilde, followed by anything that begins with a letter, then each line is converted into a quotation block.
"The cure for boredom is curiosity. There is no cure for curiosity." -- Dorothy Parker
becomes
[quote,Dorothy Parker]
__________________________________________
The cure for boredom is curiosity. There is no cure for curiosity.
__________________________________________
Use Case 2: Comment Blocks
// a whole
// bunch
// of comments
becomes
////
a whole
bunch
of comments
////
Use Case 3: source code
If it can determine that the selected lines are some sort of source code, then it'll enclose it as a source code block.
[source, bash]
-------------------------------------------------------------------------------
sudo apt update
-------------------------------------------------------------------------------
- If there is a she-bang to go by (#!/usr/bin/env bash), it's obvious.
- If there are lines that start with
sudo
then it's a bash script. - If there are lines that start with
import
orfrom ... import
then it's Python. - etc.
In all cases, it would unindent the block if every line begins with white space.