Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ANSI coloured console to wiki markup?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Goverp
Veteran
Veteran


Joined: 07 Mar 2007
Posts: 1998

PostPosted: Tue May 11, 2021 10:12 am    Post subject: ANSI coloured console to wiki markup? Reply with quote

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
View user's profile Send private message
Maffblaster
Developer
Developer


Joined: 01 May 2007
Posts: 70
Location: Spokane, Washington, USA

PostPosted: Tue May 11, 2021 10:00 pm    Post subject: Reply with quote

No. Not possible at present. Nothing on our wiki respects ANSI color codes. They don't translate into wiki markup or HTML.

Best we have right now, if you have a commonly used code language, you can use the
Code:
lang=
parameter to color code the language inside the FileBox, but you probably already knew that.

https://wiki.gentoo.org/wiki/Template:FileBox#Usage
_________________
Lets make Gentoo better together!
wiki: https://wiki.gentoo.org/wiki/User:Maffblaster
blog: http://dev.gentoo.org/~maffblaster/


Last edited by Maffblaster on Tue May 11, 2021 11:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3339
Location: Rasi, Finland

PostPosted: Tue May 11, 2021 10:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9677
Location: almost Mile High in the USA

PostPosted: Tue May 11, 2021 11:44 pm    Post subject: Reply with quote

Does it handle ANSI animation? :D
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum