theZiz / aha

Ansi HTML Adapter
Other
915 stars 88 forks source link

Italics support #69

Closed madprops closed 4 years ago

madprops commented 4 years ago

Italic ansi codes don't seem to be applied into the html render.

theZiz commented 4 years ago

I can't reproduce your issue. I have a text file with italics: italic.txt Looks like this: grafik And produces this output with aha:

<?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>stdin</title>
</head>
<body>
<pre>
<span style="font-style:italic;">foo</span>bar
</pre>
</body>
</html>

Can you give me an example where this is not working for you?

madprops commented 4 years ago

For instance check this generated html: https://madprops.github.io/sym/

As you can see the original output has some italics:

I use a script to generate this:

Just checked and the 'script' output does contain the italics, even after sed. So it's likely some parse problem at the 'aha' level.

theZiz commented 4 years ago

Can you give my the script or the output of the script for having a deeper look?

madprops commented 4 years ago

Here's the output of script -c 'sym' -q example.script

Script started on 2020-01-02 14:52:45-0600

Symlink creator and manager

Examples:

  Add an item:
   sym add movies ~/media/movies art videos
   This creates an item called movies.
   Associated with the provided path.
   And 2 tags were added to it.
   This will create a symlink: ~/sym/movies
   It will also create tag symlinks:
   ~/sym/tags/art/movies
   and ~/sym/tags/videos/movies
   These 3 symlinks point to the same path.
   You can do for instance 'ls ~/sym/movies'
   And it will show the contents of ~/media/movies

  Remove an item:
   sym remove movies
   or regex...
   sym remove re:\\w+

  Remove an item by path:
   sym removepath /media/movies
   or regex...
   sym removepath re:\\w+

  Rename an item:
   sym rename movies moviez

  Add tags:
   sym addtags movies art modern

  Remove tags:
   sym removetags movies art modern

  Replace tags:
   sym replacetags movies art modern

  List items:
   sym list

  List tags:
   sym tags

  List paths associated with a tag:
   sym tag funny

  Change the path of an item:
   sym changepath movies /media/movies

  Show the path of an item:
   sym path movies

  Open a path in the file manager:
   sym open movies

  Remake symlinks based on the database:
   sym remake

  Make a backup:
   sym backup

  Restore from backup:
   sym restore

  Print a string of item names:
   sym printnames

  Scripts:
   Scripts can be used for automation.
   Scripts are 1 command per line.
   
   Example script:
   movies ~/media/movies plot
   tag movies woomy
   backup

  Run a script:
   sym runscript /path/to/script

  Make a script:
   sym makescript /path/to/save

Flags:

  --dev
  Used for development

  --force
  Run commands without confirmation

Script done on 2020-01-02 14:52:45-0600
theZiz commented 4 years ago

I tried to reproduce your problem, even learned what sed '1d;$d' does, but for me it just works. Even in your pasted snipped I clearly see \033[3m which should produce italic output. Which version are you using?

madprops commented 4 years ago

I think I was using an old version, and it got updated with the Ubuntu upgrade (I'm now running 0.5), because now I ran the same command and it outputs italics just fine. So it works! thank you