Comments (7)
Implementing this as a DSL seems like a bit of overkill for a project the size of ansi2html. It does one thing and does it well. My guess is that the code to achieve this would be double or triple the size of ansi2html as it stands now.
My suggestion is that we modify ansi2html to accept a --extra-header=some_template.html
and/or --extra-header=some_template.html
. This way you could write a javascript stub that pulls in jquery and accomplishes exactly what you want, without having to reinvent jquery in python (all packaged inside a tiny tool like ansi2html).
This would be really useful and I would totally accept a patch for including custom headers and footers, but not for a DSL DOM-manipulation engine. :)
from ansi2html.
After evaluating how to add even --extra-header
to ansi2html, I think I'm going to have to veto even that. You can accomplish what you want by using the pieces of ansi2html that already exist.
#!/bin/bash
# Boilerplate
echo "<html><head>" > my_report.html
# Style tags
ansi2html --headers >> my_report.html
# My customization. Make the span tags dance!
echo '
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){$("span").hide("slow").show("slow");});
</script>
</head>
<body class="body_foreground body_background" style="font-size: normal;" >
<pre>' >> my_report.html
# The content
ls --color=always | ansi2html -p >> my_report.html
# Ending boilerplate
echo "</pre></body></html>" >> my_report.html
from ansi2html.
Great,
I think this is better than nothing and maybe I just missed something but I was already planning to do the work with jQuery.
I'm not very experienced with it but I think the current output is difficult to reuse because there is no tags to notify begin/end of lines (for instance, but most "invisible" characters can be considered helpful).
Is there an obvious way in the current version to know newlines and indentation/tabbing (the former can be guessed from text value if I/one can iterate over lines...) ?
from ansi2html.
Oh, I see what you mean. Off the bat, no I can't think of an obvious way to navigate the marked up code inside the
tag.An "add line numbers to the beginning of every line" option for ansi2html might be useful for that. Or wrapping each line in it's own tag.
from ansi2html.
@fdev31, does that work for you?
from ansi2html.
Way toooo busy for now to work on the project involving that problematic but I think it will be fine. I'll report eventual bugs after some tests but don't expect that to happen very fast :(
from ansi2html.
Okay. The feature is in version 0.9.0. I'll close the ticket for now, but open a new one if you encounter problems.
Thanks!
from ansi2html.
Related Issues (20)
- Fix type hints in ansi2html/converter.py HOT 1
- Support white background (currently always #AAAAAA gray) HOT 5
- Does not support colon-delimited "flavor" of 24-bit "truecolor" escape sequences. HOT 5
- use unittest.mock instead of mock HOT 2
- ResoureWarnings in style.py HOT 2
- [>=1.7.0a0] typing_extensions missing from requirements HOT 1
- Copyright headers still refer to GPL HOT 3
- Restore man page rendering dropped by pull request #194 HOT 4
- Import "ansi2html" could not be resolved HOT 1
- Hardcoded "python3" in tests/test_ansi2html.py HOT 9
- Hardcoded "python3" in tests/test_ansi2html.py HOT 1
- Hardcoded "python3" in tests/test_ansi2html.py HOT 1
- Hardcoded "python3" in tests/test_ansi2html.py HOT 1
- font_size option does not have an effect
- Project description in pyproject.toml (and on PyPI) is from ansible-lint rather than ansi2html HOT 6
- How to use my own custom colors and background color HOT 1
- Final release for 1.9? HOT 7
- Missing HTML Head and tags
- Is there a way to split output into multiple files?
- AttributeError: 'list' object has no attribute 'replace' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansi2html.