emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* bug report: ox-html with coderef links needs a space between attributes in <a> element (with patch)
@ 2017-01-24 10:55 dmg
  2017-01-24 17:22 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: dmg @ 2017-01-24 10:55 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi everybody,

I have the following org-snippet:

---------------------------------------------------------------
This is an example

#+BEGIN_SRC sml -r -l "(*(ref:%s)*)" -n
val x = 1
fun f y = x + y (*(ref:f)*)
val x = 2
val y = 3
val z = f(x+y) (*(ref:callf)*)
#+END_SRC

- Line [[(f)]] defines a function that, when called, evaluates body *x+y*
  in environment where *x* maps to *1* and *y* maps to the argument
------------------------------------------------------------------
The HTML that it generates creates invalid HTML (one parser used by my
university refuses to accept  it :)

I have inspected the code and this is where it fails: Note how there is no
space between " and class in the <a> element:


<li>Line <a href="#coderef-f"class="coderef"
onmouseover="CodeHighlightOn(this, 'coderef-f');"
onmouseout="CodeHighlightOff(this, 'coderef-f');">2</a> defines a function
that, when called, evaluates body <b>x+y</b>
in environment where <b>x</b> maps to <b>1</b> and <b>y</b> maps to the
argument</li>


​I am running version 9.0.3 of org.

I believe this patch will solve the issue. It simply adds a space before
the class attribute.

​
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index a741142..9b40cc9 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -3058,7 +3058,7 @@ INFO is a plist holding contextual information.  See
       (let ((fragment (concat "coderef-" (org-html-encode-plain-text
path))))
        (format "<a href=\"#%s\"%s%s>%s</a>"
                fragment
-               (format "class=\"coderef\"
onmouseover=\"CodeHighlightOn(this, \
+               (format " class=\"coderef\"
onmouseover=\"CodeHighlightOn(this, \
 '%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\""
                        fragment fragment)
                attributes

-- 
--dmg

---
Daniel M. German
http://turingmachine.org

[-- Attachment #2: Type: text/html, Size: 4995 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: bug report: ox-html with coderef links needs a space between attributes in <a> element (with patch)
  2017-01-24 10:55 bug report: ox-html with coderef links needs a space between attributes in <a> element (with patch) dmg
@ 2017-01-24 17:22 ` Nicolas Goaziou
  2017-01-24 19:43   ` D M German
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2017-01-24 17:22 UTC (permalink / raw)
  To: dmg; +Cc: emacs-orgmode

Hello,

dmg <dmg@turingmachine.org> writes:

> I have the following org-snippet:
>
> ---------------------------------------------------------------
> This is an example
>
> #+BEGIN_SRC sml -r -l "(*(ref:%s)*)" -n
> val x = 1
> fun f y = x + y (*(ref:f)*)
> val x = 2
> val y = 3
> val z = f(x+y) (*(ref:callf)*)
> #+END_SRC
>
> - Line [[(f)]] defines a function that, when called, evaluates body *x+y*
>   in environment where *x* maps to *1* and *y* maps to the argument
> ------------------------------------------------------------------
> The HTML that it generates creates invalid HTML (one parser used by my
> university refuses to accept  it :)
>
> I have inspected the code and this is where it fails: Note how there is no
> space between " and class in the <a> element:
>
>
> <li>Line <a href="#coderef-f"class="coderef"
> onmouseover="CodeHighlightOn(this, 'coderef-f');"
> onmouseout="CodeHighlightOff(this, 'coderef-f');">2</a> defines a function
> that, when called, evaluates body <b>x+y</b>
> in environment where <b>x</b> maps to <b>1</b> and <b>y</b> maps to the
> argument</li>
>
>
> ​I am running version 9.0.3 of org.
>
> I believe this patch will solve the issue. It simply adds a space before
> the class attribute.

It works but I eventually applied a slightly different patch. Thank you
for both the report and the patch.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug report: ox-html with coderef links needs a space between attributes in <a> element (with patch)
  2017-01-24 17:22 ` Nicolas Goaziou
@ 2017-01-24 19:43   ` D M German
  0 siblings, 0 replies; 3+ messages in thread
From: D M German @ 2017-01-24 19:43 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

 Nicolas Goaziou twisted the bytes to say:


 >> 
 >> ​I am running version 9.0.3 of org.
 >> 
 >> I believe this patch will solve the issue. It simply adds a space before
 >> the class attribute.

 Nicolas> It works but I eventually applied a slightly different patch. Thank you
 Nicolas> for both the report and the patch.

thank you very much!

--daniel

 Nicolas> Regards,

 Nicolas> -- 
 Nicolas> Nicolas Goaziou

--
Daniel M. German                  "For indeed who is there alive
                                   that will not be swayed by his
                                   bias and partiality to
    Jonathan Swift ->              the place of his birth?"
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-24 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-24 10:55 bug report: ox-html with coderef links needs a space between attributes in <a> element (with patch) dmg
2017-01-24 17:22 ` Nicolas Goaziou
2017-01-24 19:43   ` D M German

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