View previous topic :: View next topic |
Author |
Message |
Goverp Veteran
Joined: 07 Mar 2007 Posts: 1998
|
Posted: Tue May 11, 2021 10:12 am Post subject: ANSI coloured console to wiki markup? |
|
|
Is there a way to cut and paste console session output into a box in a (Gentoo) wiki page that preserves the ANSI colouring?
I think I found something once, but it's a long time ago. There are a couple of wiki templates, "{{Cmd|foo}}" and "{{RootCmd|bah}}", but they only fake a coloured prompt and monochrome output, whereas it should be a trivial matter to capture the ANSI output and paste it for rendering directly by the wiki engine. _________________ Greybeard |
|
Back to top |
|
|
Maffblaster Developer
Joined: 01 May 2007 Posts: 70 Location: Spokane, Washington, USA
|
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3339 Location: Rasi, Finland
|
Posted: Tue May 11, 2021 10:47 pm Post subject: |
|
|
There are tools to create html from "terminal output" (ANSI) like ansi2html and ansifilter, but you'd need to add much more into it. For example escape some characters etc...
I tested this Code: | eshowkw --color --overlays ansifilter | ansifilter --html | awk 'BEGIN {while ($1 != "<body>") getline} {if ($1 != "</body>") print; else exit}' | ... and it's pretty broken, without further processing. You get some colors (and broken layout) if you remove pre -tags from start and end.
Quite much effort for colored terminal text. _________________ ..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9677 Location: almost Mile High in the USA
|
Posted: Tue May 11, 2021 11:44 pm Post subject: |
|
|
Does it handle ANSI animation? _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
|