unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Stéphane Travostino" <stephane.travostino@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Rendering buffer to HTML from command line script
Date: Sat, 20 Feb 2016 17:20:29 +0000	[thread overview]
Message-ID: <CAPnpZcCAuR8fRVOkV1LDH58oJyb-SrXYjYY_59pzYC4y2vjnbQ@mail.gmail.com> (raw)

Hello,

I'm trying to create a command line Emacs script that, by specifying a file
and a theme, renders the file to HTML using the theme colours.
For example:

emacs --script render-theme.el some-theme.el test.c > test.c.html

I'm using htmlfontify to render the buffer to HTML, and works great when
called from X, but I get a black and white output when called from the
terminal _with most themes_.

The problem is that themes specify the minimum terminal requirements to
enable a specific face, i.e. minimum amount of colours supported by the
terminal, window-system, etc. (
http://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Faces.html
)

For example: (defface 'foo (((min-colors 88) (class color) etc.))

If I modify the theme to disable these terminal requirements options,
htmlfontify renders correctly.

That's probably a long shot, but is it possible to either force a
particular terminal configuration from command line, or force-enable all
theme faces?

For example, (display-color-cells) in X returns 16777216, while I get 0
when executed from the script; that's probably part of the problem.

Why am I doing this: I want to create an Emacs theme browser web
application which creates a preview of any theme against a few different
file formats, and I want an headless Emacs to create the HTML preview.

Thanks.
Stephane.


             reply	other threads:[~2016-02-20 17:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-20 17:20 Stéphane Travostino [this message]
2016-08-05 19:10 ` Rendering buffer to HTML from command line script Thien-Thi Nguyen
     [not found] <mailman.5246.1456006059.843.help-gnu-emacs@gnu.org>
2016-02-24 20:41 ` Gene

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPnpZcCAuR8fRVOkV1LDH58oJyb-SrXYjYY_59pzYC4y2vjnbQ@mail.gmail.com \
    --to=stephane.travostino@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).