theZiz / aha

Ansi HTML Adapter
Other
915 stars 88 forks source link

output of shell code highlighter seems empty because of wrong colors #63

Closed rriemann closed 5 years ago

rriemann commented 5 years ago

I use the command line tool rougify of the ruby highlighting lib https://github.com/jneen/rouge to color text files that I want to save later as html.

Minimal example:

echo "{'a': 14}" | rougify highlight -l js | aha --title "rougify test"     

Unfortunately, the output seems empty, because the colors are wrongly set. The output from above is:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8" />
<title>rougify test</title>
</head>
<body>
<pre>
<span style="color:white;text-decoration:blink;">{</span><span style="color:black;text-decoration:blink;"></span><span style="color:white;font-weight:bold;text-decoration:blink;">'a'</span><span style="color:white;text-decoration:blink;">:</span><span style="color:black;text-decoration:blink;"></span><span style="color:white;text-decoration:blink;"> </span><span style="color:black;text-decoration:blink;"></span><span style="color:white;font-weight:bold;text-decoration:blink;">14</span><span style="color:white;text-decoration:blink;">}</span><span style="color:black;text-decoration:blink;"></span><span style="color:white;text-decoration:blink;"></span><span style="color:black;text-decoration:blink;">
</span><span style="color:white;text-decoration:blink;"></span><span style="color:black;text-decoration:blink;"></span>
</pre>
</body>
</html>

Note that the color is only black and white. In the browser Firefox, the file seems to be empty.

rriemann commented 5 years ago

seems to be fixed in 0.5. I noticed very late that opensuse ships an outdated version. Sorry for the noise.

output of 0.5:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8" />
<title>rougify test</title>
</head>
<body>
<pre>
<span style="color:#5fffff;">{</span><span style="color:black;"></span><span style="font-weight:bold;color:#ffffaf;">'a'</span><span style="color:#5fffff;">:</span><span style="color:black;"></span><span style="color:#ffffd7;"> </span><span style="color:black;"></span><span style="font-weight:bold;color:#ff87d7;">14</span><span style="color:#5fffff;">}</span><span style="color:black;"></span><span style="color:#ffffd7;"></span><span style="color:black;">
</span><span style="color:#ffffd7;"></span><span style="color:black;"></span></pre>
</body>
</html>
theZiz commented 5 years ago

Always glad when something fixes itself. :smile: