emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Berthier <nberth@member.fsf.org>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Fontify inline source blocks when exporting to HTML
Date: Mon, 15 May 2017 16:35:52 +0100	[thread overview]
Message-ID: <syfd1barv3b.fsf@nberth.csc.liv.ac.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

Hi!

Inline source code blocks are not fontified by the HTML backend anymore
(I have a document with such code blocks that exported fine two years
ago, with Org 7 or 8 I think).

If that's the intended behavior, then I would like to know the proper
way to recover the old behavior; otherwise, let me suggest this small
patch to remedy that issue.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fontify-inline-source-blocks-when-exporting-to-HTML.patch --]
[-- Type: text/x-patch, Size: 952 bytes --]

From 4682af888ca3b86eb05c6d40169725cca17136e3 Mon Sep 17 00:00:00 2001
From: Nicolas Berthier <nberth@member.fsf.org>
Date: Mon, 15 May 2017 15:44:11 +0100
Subject: [PATCH] Fontify inline source blocks when exporting to HTML

* lisp/ox-html.el (org-html-inline-src-block): Fontify inline source
blocks.
---
 lisp/ox-html.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index fc91e96..fef79ca 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2685,7 +2685,8 @@ contextual information."
 	 (let ((lbl (and (org-element-property :name inline-src-block)
 			 (org-export-get-reference inline-src-block info))))
 	   (if (not lbl) "" (format " id=\"%s\"" lbl)))))
-    (format "<code class=\"src src-%s\"%s>%s</code>" lang label code)))
+    (format "<code class=\"src src-%s\"%s>%s</code>" lang label
+	    (org-html-fontify-code code lang))))
 
 ;;;; Inlinetask
 
-- 
2.7.0.rc0.20.g4b9ab0e


[-- Attachment #3: Type: text/plain, Size: 92 bytes --]


Best regards,
-- 
Nicolas Berthier                                        FSF Member #7975

             reply	other threads:[~2017-05-15 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 15:35 Nicolas Berthier [this message]
2017-05-15 16:29 ` [PATCH] Fontify inline source blocks when exporting to HTML Nicolas Goaziou

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.orgmode.org/

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

  git send-email \
    --in-reply-to=syfd1barv3b.fsf@nberth.csc.liv.ac.uk \
    --to=nberth@member.fsf.org \
    --cc=emacs-orgmode@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).