← Back to team overview

maria-docs team mailing list archive

Re: KB Macro Proposal

 

On Wed, 7 Dec 2011 22:00:56 +0100
Sergei Golubchik <serg@xxxxxxxxxxxx> wrote:

Sergei> Hi, Daniel!

Hi!

With some prompting from Bryan, I wanted to re-open this conversation.
I think this will be a good addition to the KB, and I like the
direction that Sergei proposed:

<snip>

Sergei> Usually the input in highlighted by making it bold or
Sergei> underlined. But using sql highlighting is kind of cool - I've
Sergei> never seen it embedded in the tty output, but it looks nice.
Sergei> 
Sergei> Just don't forget that tty input is not always sql:
Sergei> 
Sergei> <<output>>
Sergei> $ <<input>>./mtr --force --parallel 5<</input>>
Sergei> ...
Sergei> Failing tests: subselect subselect4
Sergei> $ <<input>>diff -u r/subselect.re*<</input>>
Sergei> <</output>>

After thinking about this more, I don't think creating new <<input>>
and <<output>> macros is the way to go. Instead we should extend the
existing <<code>> macro to allow the embedding of a new <<highlight>>
macro.

Apart from wrapping text inside it in a box, <<highlight>> would have a
"lang=" property, just like <<code>>.

The way it would work in practice would be for example:

<<code>>
MariaDB [test]> <<highlight lang="sql">>SELECT * FROM t1 WHERE d LIKE "%es";<</highlight>>

+-----------+
| d         |
+-----------+
| Tuesday   |
| Wednesday |
+-----------+
2 rows in set (0.00 sec)
<</code>>

The above code block would then produce output similar to what is shown
at the bottom of the attached screenshot.

If no "lang=" attribute is given, only the box is drawn, and no syntax 
colorization or styling of the text happens.

Multiple <<highlight>> blocks should be allowed inside an individual
<<code>> block.

The reason I'm using <<highlight>> as the name for the macro instead of
<<input>> is that by making it generic, it becomes more obvious that it
can be used for input, output, or anything else that the author of the
article wants to highlight.

As far as the actual name, <<highlight>> is a bit long, maybe we could
use something shorter like <<hl>> (or do both and make one an alias for
the other).

What do you think?

Especially for Bryan: How hard would it be to implement the above?

Thanks.

-- 
Daniel Bartholomew
MariaDB - http://mariadb.org
Monty Program - http://montyprogram.com
AskMonty Knowledgebase - http://kb.askmonty.org

Attachment: LIKE-v3.png
Description: PNG image


Follow ups

References