emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thibault Marin <thibault.marin@gmx.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: org mode <emacs-orgmode@gnu.org>
Subject: Re: Possible bug with coderef highlighting in HTML export
Date: Sun, 03 Dec 2017 18:41:42 -0600	[thread overview]
Message-ID: <87y3mjtjcp.fsf@dell-desktop.WORKGROUP> (raw)
In-Reply-To: <877eu3dhtz.fsf@nicolasgoaziou.fr>

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


Hi,

Hi the attach patch fixes the issue for me.  Please let me know if you
have any suggestions.

As always, thanks for the guidance.

thibault



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-bug-in-HTML-export-of-code-blocks-with-starting-.patch --]
[-- Type: text/x-diff, Size: 1552 bytes --]

From a78dc91c9fd1aacb2c65f66ae5afa9ee25f56e01 Mon Sep 17 00:00:00 2001
From: thibault <thibault.marin@gmx.com>
Date: Sun, 3 Dec 2017 17:42:13 -0600
Subject: [PATCH] Fix bug in HTML export of code blocks with starting blank
 lines

* lisp/ox-html.el (org-html-do-format-code): Preverse starting blank
  lines when splitting code lines (use `split-string' instead of
  `org-split-string').

  (org-html-fontify-code): Preserve starting blank lines in returned
  code string.
---
 lisp/ox-html.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 0e22c1699..90a6cede0 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2202,7 +2202,7 @@ https://github.com/hniksic/emacs-htmlize"))
 		      (org-html-htmlize-region-for-paste
 		       (point-min) (point-max))))))
 	  ;; Strip any enclosing <pre></pre> tags.
-	  (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0)))
+	  (let* ((beg (and (string-match "\\`<pre[^>]*>\n?" code) (match-end 0)))
 		 (end (and beg (string-match "</pre>\\'" code))))
 	    (if (and beg end) (substring code beg end) code)))))))))
 
@@ -2215,7 +2215,7 @@ alist between line numbers and references (as returned by
 `org-export-unravel-code'), a boolean specifying if labels should
 appear in the source code, and the number associated to the first
 line of code."
-  (let* ((code-lines (org-split-string code "\n"))
+  (let* ((code-lines (split-string code "\n"))
 	 (code-length (length code-lines))
 	 (num-fmt
 	  (and num-start
-- 
2.14.1


  reply	other threads:[~2017-12-04  0:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-03 10:35 Possible bug with coderef highlighting in HTML export Thibault Marin
2017-12-03 14:08 ` Nicolas Goaziou
2017-12-04  0:41   ` Thibault Marin [this message]
2017-12-04  7:24     ` 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=87y3mjtjcp.fsf@dell-desktop.WORKGROUP \
    --to=thibault.marin@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).