From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id IHpjEVbkfmTk/AAASxT56A (envelope-from ) for ; Tue, 06 Jun 2023 09:46:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id KItZEVbkfmRo3QAA9RJhRA (envelope-from ) for ; Tue, 06 Jun 2023 09:46:30 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EB5FE103DC for ; Tue, 6 Jun 2023 09:46:29 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6RNb-0002R9-C0; Tue, 06 Jun 2023 03:45:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6RNY-0002PF-Mr for emacs-orgmode@gnu.org; Tue, 06 Jun 2023 03:45:20 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6RNQ-0006eA-UJ for emacs-orgmode@gnu.org; Tue, 06 Jun 2023 03:45:20 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 89BED240028 for ; Tue, 6 Jun 2023 09:45:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1686037510; bh=7N7dO6wcVciF/4eHcK67UiDN215CCP/h1BvcUjhVQCc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=fVq5eerAe182ZBLL5u2oGjy4jSDMOxTIHJxzshtm5BLgCjOhjFZlhfMweZYeHcQCu 0mcYrniCki0Mf+E9u22ql26LCnCj/4oZ973gMVb4Blo5kFB6Gxmy19DCRngBXlhyZR IzCTEEaZoA+0Md9p4RCh0sG/PSmVqxkLgAJXpfPDl+K9Wc16citTQhPaiffe+uCXpE Pw1KikS8GsKpimIX5/tl8Ae5joIyWw3GlDtco9OK4dXnBLUJQj+4ZEuZ54GGP9TD8E nodkpl9Eooo7EiKJKiNWYpXD3TkZmpI4e/e4T30hJVe2aS2YFcdsYrF4kD5xjoLiUn lvV6C+D7NlcgQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Qb2ZF5d6gz6trm; Tue, 6 Jun 2023 09:45:09 +0200 (CEST) From: Ihor Radchenko To: gerard.vermeulen@posteo.net, Timothy Cc: Emacs orgmode Subject: Re: [PATCH] ox-html.el: add option to embed SVG for CSS support in SVG In-Reply-To: References: Date: Tue, 06 Jun 2023 07:49:47 +0000 Message-ID: <871qip3u90.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1686037590; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=jhJyqQq4ZcpQNrLnqd/olPwTyXjz32J/kkYgHkgm6oo=; b=tdQuJ/+RiM0ehl28cZyM6bkjiopBUQfGF6VlVc3OR/GuH+H4OoEA1EZnW4Hvpjh5dWB7oZ 9/MChLRaR9zBXPkvcHNKj1gD3MWuHMGvnlj80TRqlBS6406tdxRd8xSG5DU/UJgFuDoOUq h1oc9dkRCYiObYb0S8M+VJA7bdaqxXjmZognD/HFqo0ms9Jeh3QSGk6s1fi/Ux+5sZ6BV9 yYF02RL2eERWXMujSyDtgMe8q6pDY0L/VbgyFPv7vGIJk0yb5QfwMv5cjY82Jm/NfQWY8J ncQBtWKwj1NG3HOKbpoRYlATJf4IVPjTdBSEq6/Xftps1xuL00dTLeXIqwoLWA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=fVq5eerA; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1686037590; a=rsa-sha256; cv=none; b=CJxtnHRcmth405uHwWMc7eRVTWFVEe/OpDu2iU+b6lb9j3hHGNcW8E+XFzg1Cyy77dp23W XQI/ieleuMQohanTWclCIuEJXZi/qo95BgFqA35MbEVZlj0j7OnG5RA4XUWDewv+zHpV3M 4tyRRT7p25NmVbUFd2sav3RyboXtu8pkqfis8GXWr79qQjzxpC6UeqhTpcwVA+2uM08zEb 1Cn3SD4aiOtiOOU5am7wsYdKGtUxy5VKH1onRg3H7r0MKcwWjRO2pWE3BDxj1ybXq198za k80NLnbeFZEdyYOEiRuBoxy24wNEpRoYednU8eHNp8ydxFJjDk3mxnFV9SI14Q== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -6.15 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=fVq5eerA; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: EB5FE103DC X-Spam-Score: -6.15 X-TUID: xyG9Wpm/cxeH gerard.vermeulen@posteo.net writes: > I have been trying to export SVG images having links to CSS from Org to > HTML > and I have found that the this CSS is not active in Firefox (only > browser I tried). > > I have found that the CCS is only active under two conditions: > 1. The HTML page should manage the CSS that the SVG image links to. > 2. The SVG image should be embedded in the HTML page. CCing Timothy, the maintainer. Also, does the above mean that Firefox does not support custom CSS user stylesheets? What am I missing? > I wrote an ox-html derived export backend to embed SVG images: > https://forge.chapril.org/gav451/emacs.d/src/branch/main/site-lisp/ox-my-html/ox-my-html.el > and merged the SVG embedding functionality into ox-html.el leading to > the > attached patch. Thanks! I will provide high-level comments from general ox.el perspective. > + (:html-embed-svg-excludes "HTML_EMBED_SVG_EXCLUDES" nil > + org-html-embed-svg-excludes split) > + (:html-embed-svg-includes "HTML_EMBED_SVG_INCLUDES" nil > + org-html-embed-svg-includes split) This is awkward. To do per-image export adjustments, we usually use export attributes (#+ATTR_HTML: ...). And why "split"? > + (:with-html-svg-embedding nil "html-embed-svg" org-html-embed-svg) We have :html-inline-images. Maybe better :html-embed-svg ? > +(defcustom org-html-embed-svg nil > ... > + :version "30.0" We do not use :version tag. Please use :package-version. See Elisp manual section "15.1 Common Item Keywords". Also, maybe instead of t/nil boolean values here, we may allow the value to be a list of regular expressions or a string representing regular expression. This will allow what you are trying to do with HTML_EMBED_SVG_INCLUDES. The list elements might also be (not "..."), replicating HTML_EMBED_SVG_EXLCUDES. Even more generally, we may turn this into HTML_EMBED_IMAGES and embed all the images (possibly filtered by regexp). This will be slightly beyond the scope of this patch though. > +(defun org-html--embed-svg-p (link path info) > + "Check whether LINK and INFO specify to embed the SVG file named PATH. > +LINK must have no contents and link to an SVG file. INFO may contain > +lists of SVG files to include in and/or to exclude from embedding." > + (and (not (org-element-contents link)) Please use `org-export-inline-image-p'. > +(defun org-html-svg-contents (path) > + "Return the SVG contents of the file named PATH." > + (with-temp-buffer > + (insert-file-contents path) > + ;; Delete text preceding something starting as an SVG root element. > + ;; The intent is to remove XML declarations (and XML comments). > + ;; This breaks in case of a preceding XML comment with + ;; or a preceding XML element with an SVG element inside. > + ;; See https://emacs.stackexchange.com/a/57433 for the original code. But the original code is different, no? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at