emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Don't force the <style> tag to be present in `org-agenda-export-html-style'
@ 2012-09-19 10:30 Sebastien Vauban
  2012-09-19 10:39 ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastien Vauban @ 2012-09-19 10:30 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

From db344fd8a05b11174508e2de864f2fb788ea0f29 Mon Sep 17 00:00:00 2001
From: Fabrice Niessen <fniessen-TA4HMoP+1wHrZ44/DZwexQ@public.gmane.org>
Date: Wed, 19 Sep 2012 12:10:20 +0200
Subject: [PATCH] Don't force the <style> tag to be present in
 `org-agenda-export-html-style'

	* org-agenda.el (org-agenda-write-buffer-name): remove the
          test for the presence of <style> tag.

TINYCHANGE

---
 lisp/org-agenda.el |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
 mode change 100644 => 100755 lisp/org-agenda.el

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
old mode 100644
new mode 100755
index 4b8cace..b0f031c
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -224,8 +224,7 @@ or, if you want to keep the style in a file,
    <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">

 As the value of this option simply gets inserted into the HTML <head> header,
-you can \"misuse\" it to also add other text to the header.  However,
-<style>...</style> is required, if not present the variable will be ignored."
+you can \"misuse\" it to also add other text to the header."
   :group 'org-agenda-export
   :group 'org-export-html
   :type 'string)
@@ -3058,8 +3057,7 @@ If AGENDA-BUFFER-NAME, use this as the buffer name for the agenda to write."
 	      ((string-match "\\.html?\\'" file)
 	       (require 'htmlize)
 	       (set-buffer (htmlize-buffer (current-buffer)))
-	       (when (and org-agenda-export-html-style
-			  (string-match "<style>" org-agenda-export-html-style))
+	       (when org-agenda-export-html-style
 		 ;; replace <style> section with org-agenda-export-html-style
 		 (goto-char (point-min))
 		 (kill-region (- (search-forward "<style") 6)
--
1.7.9

-- 
Sebastien Vauban

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

* Re: [PATCH] Don't force the <style> tag to be present in `org-agenda-export-html-style'
  2012-09-19 10:30 [PATCH] Don't force the <style> tag to be present in `org-agenda-export-html-style' Sebastien Vauban
@ 2012-09-19 10:39 ` Bastien
  2012-09-19 18:54   ` Sebastien Vauban
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2012-09-19 10:39 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hi Sébastien,

thanks for the patch.

matching against "<style>" is wrong, but matching against "style" 
looks still useful to me.  

What do you think?

-- 
 Bastien

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

* Re: [PATCH] Don't force the <style> tag to be present in `org-agenda-export-html-style'
  2012-09-19 10:39 ` Bastien
@ 2012-09-19 18:54   ` Sebastien Vauban
  2012-09-19 19:16     ` Sebastien Vauban
  2012-09-19 19:29     ` Achim Gratz
  0 siblings, 2 replies; 7+ messages in thread
From: Sebastien Vauban @ 2012-09-19 18:54 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Bastien,

Bastien wrote:
> thanks for the patch.
>
> matching against "<style>" is wrong, but matching against "style" 
> looks still useful to me.  
>
> What do you think?

I don't think so. Let me re-explain...

I want a correct HTML header, with a link to an external CSS file, such as:

--8<---------------cut here---------------start------------->8---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!-- Created by htmlize-1.36 in css mode. -->
<html>
  <head>
    <title>Summary Review - Aviva ETE</title>
    <link rel="stylesheet" type="text/css" href="org-agenda-views.css"/>
  </head>
--8<---------------cut here---------------end--------------->8---

If I set the variable `org-agenda-export-html-style' to the string I want:

#+begin_src emacs-lisp
(setq org-agenda-export-html-style
   "<link rel=\"stylesheet\" type=\"text/css\" href=\"org-agenda-views.css\"/>")
#+end_src

it will be *ignored*... because there is no word `style' (with or without the
angular brackets)!

I don't understand /why such a test was made/, but clearly (with the above
example), we can't force the user to wrap the <link/> inside <style> tags;
otherwise, the browser does not look for the external CSS file.

The only solution is:
- don't check for `style'
- allow a pure `link' tag to be inserted in the header

what my patch does.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [PATCH] Don't force the <style> tag to be present in `org-agenda-export-html-style'
  2012-09-19 18:54   ` Sebastien Vauban
@ 2012-09-19 19:16     ` Sebastien Vauban
  2012-09-19 19:29     ` Achim Gratz
  1 sibling, 0 replies; 7+ messages in thread
From: Sebastien Vauban @ 2012-09-19 19:16 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Bastien,

"Sebastien Vauban" wrote:
> If I set the variable `org-agenda-export-html-style' to the string I want:
>
> #+begin_src emacs-lisp
> (setq org-agenda-export-html-style
>    "<link rel=\"stylesheet\" type=\"text/css\" href=\"org-agenda-views.css\"/>")
> #+end_src
>
> it will be *ignored*... because there is no word `style' (with or without the
> angular brackets)!
>
>> matching against "<style>" is wrong, but matching against "style" 
>> looks still useful to me.  
>>
>> What do you think?
>
> I don't think so.

Sorry, just re-reading my post; and, yes, *it does make sense* to try matching
for `style' (without the brackets) -- even if I'm not sure about the reason to
force that, but it can be some "guard" against mistakes.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [PATCH] Don't force the <style> tag to be present in `org-agenda-export-html-style'
  2012-09-19 18:54   ` Sebastien Vauban
  2012-09-19 19:16     ` Sebastien Vauban
@ 2012-09-19 19:29     ` Achim Gratz
  2012-09-19 19:54       ` Sebastien Vauban
  1 sibling, 1 reply; 7+ messages in thread
From: Achim Gratz @ 2012-09-19 19:29 UTC (permalink / raw)
  To: emacs-orgmode

Sebastien Vauban writes:
> The only solution is:
> - don't check for `style'
> - allow a pure `link' tag to be inserted in the header

Well, the /only other/\TM solution then is to check for either "<style"
or "<link".  Or maybe I'm missing something.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

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

* Re: [PATCH] Don't force the <style> tag to be present in `org-agenda-export-html-style'
  2012-09-19 19:29     ` Achim Gratz
@ 2012-09-19 19:54       ` Sebastien Vauban
  2012-09-19 22:53         ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastien Vauban @ 2012-09-19 19:54 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello Achim,

Achim Gratz wrote:
> Sebastien Vauban writes:
>> The only solution is:
>> - don't check for `style'
>> - allow a pure `link' tag to be inserted in the header
>
> Well, the /only other/\TM solution then is to check for either "<style"
> or "<link".  Or maybe I'm missing something.

Well, the last option (the one taken by my patch) was no to check anything...

Otherwise, we have to:

- check for `style' (that is, matches both `<style' and `stylesheet'), as
  proposed by Bastien

- check for `<style' or `<link', as you propose.

Thanks for your input.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [PATCH] Don't force the <style> tag to be present in `org-agenda-export-html-style'
  2012-09-19 19:54       ` Sebastien Vauban
@ 2012-09-19 22:53         ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2012-09-19 22:53 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hi Sébastien,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> Well, the last option (the one taken by my patch) was no to check
> anything...

Yes, I agree.  I have now applied your patch.

Note that the root of the problem lies in htmlize.el, which puts 
<style>...</style> within <head>...</head>.  If you feel like, don't
hesitate to report this to the author.

Thanks for the patch,

-- 
 Bastien

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

end of thread, other threads:[~2012-09-19 22:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-19 10:30 [PATCH] Don't force the <style> tag to be present in `org-agenda-export-html-style' Sebastien Vauban
2012-09-19 10:39 ` Bastien
2012-09-19 18:54   ` Sebastien Vauban
2012-09-19 19:16     ` Sebastien Vauban
2012-09-19 19:29     ` Achim Gratz
2012-09-19 19:54       ` Sebastien Vauban
2012-09-19 22:53         ` Bastien

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