emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to change org-export-html-style
@ 2014-04-15 11:30 Rustom Mody
       [not found] ` <28e944dca49c583c458b6ba60f29d078@mail.rickster.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Rustom Mody @ 2014-04-15 11:30 UTC (permalink / raw)
  To: emacs-orgmode

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

My html styles are in a file my-org.css in ~/orghacks

I need (for various reasons) to inline these styles

I have this code in my init to change the html style

---------------------------------
(defun rusi/load-css()
  "Returns string from css file (hardwired) suitable for inline css"
  (interactive)
  (setq org-export-html-style
    (with-temp-buffer
      (insert "\n<style type=\"text/css\">\n")
      (insert-file-contents (expand-file-name "my-org.css" "~/orghacks"))
      (goto-char (point-max))
      (insert "\n</style>\n")
      (buffer-string))))
(rusi/load-css)
--------------------------------
Now if I edit and save the my-org.css file and then call M-: (rusi/load-css)
it does not work.
Restarting emacs makes it work.
Ive checked that org-export-html-style is actually changed.
However org-mode seems to be keeping some internal copy after first use.
org-reload is not helping here

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

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

* Re: How to change org-export-html-style
@ 2014-04-15 11:35 Rustom Mody
  0 siblings, 0 replies; 6+ messages in thread
From: Rustom Mody @ 2014-04-15 11:35 UTC (permalink / raw)
  To: emacs-orgmode

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

On Tue, Apr 15, 2014 at 5:00 PM, Rustom Mody <rustompmody@gmail.com> wrote:

> My html styles are in a file my-org.css in ~/orghacks
>
> I need (for various reasons) to inline these styles
>


I should have mentioned the org version: 8.2.5e
Emacs version: 24.3.1

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

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

* Re: How to change org-export-html-style
       [not found] ` <28e944dca49c583c458b6ba60f29d078@mail.rickster.com>
@ 2014-04-16  3:25   ` Rustom Mody
  2014-04-16  4:53     ` Nick Dokos
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rustom Mody @ 2014-04-16  3:25 UTC (permalink / raw)
  To: Rick Frankel, emacs-orgmode

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

On Tue, Apr 15, 2014 at 10:39 PM, Rick Frankel <rick@rickster.com> wrote:

> On 2014-04-15 07:30, Rustom Mody wrote:
>
>> I need (for various reasons) to inline these styles
>>
>> I have this code in my init to change the html style
>>
>> ---------------------------------
>> (defun rusi/load-css()
>>   "Returns string from css file (hardwired) suitable for inline css"
>>   (interactive)
>>   (setq org-export-html-style
>>     (with-temp-buffer
>>       (insert "n<style type="text/css">n")
>>       (insert-file-contents (expand-file-name "my-org.css" "~/orghacks"))
>>       (goto-char (point-max))
>>       (insert "n</style>n")
>>       (buffer-string))))
>> (rusi/load-css)
>> --------------------------------
>> Now if I edit and save the my-org.css file and then call M-:
>> (rusi/load-css)
>> it does not work.
>> Restarting emacs makes it work.
>> Ive checked that org-export-html-style is actually changed.
>> However org-mode seems to be keeping some internal copy after first use.
>> org-reload is not helping here
>>
>
> Can you explain "not working"? There's not enough info here to see
> what problem you are having.
>
> rick
>


Lets say my-org.css has this one line:

code { color: green; }

ie put inline code blocks in green when exporting to html

I change it to

code { color: blue; }

1  save the file
2. Run rusi/load-css
3. Check that org-export-html-file's value has changed from green to blue

However exports from org to html continue to export code-blocks as green

Restart emacs and export (some org file that has code blocks)
Now they are blue

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

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

* Re: How to change org-export-html-style
  2014-04-16  3:25   ` Rustom Mody
@ 2014-04-16  4:53     ` Nick Dokos
  2014-04-16  8:35     ` Rustom Mody
  2014-04-16 14:59     ` Rick Frankel
  2 siblings, 0 replies; 6+ messages in thread
From: Nick Dokos @ 2014-04-16  4:53 UTC (permalink / raw)
  To: emacs-orgmode

Rustom Mody <rustompmody@gmail.com> writes:

> On Tue, Apr 15, 2014 at 10:39 PM, Rick Frankel <rick@rickster.com> wrote:
>
>     On 2014-04-15 07:30, Rustom Mody wrote:
>    
>         I need (for various reasons) to inline these styles
>        
>         I have this code in my init to change the html style
>        
>         ---------------------------------
>         (defun rusi/load-css()
>           "Returns string from css file (hardwired) suitable for inline css"
>           (interactive)
>           (setq org-export-html-style
>             (with-temp-buffer
>               (insert "n<style type="text/css">n")
>               (insert-file-contents (expand-file-name "my-org.css" "~/orghacks"))
>               (goto-char (point-max))
>               (insert "n</style>n")
>               (buffer-string))))

1) I hope that the various escapes needed *are* in your definition
and were stripped during the email trip; e.g. the inner quotes in the
first string  should be \" and \n instead of n.

2) org-export-html-style smells like an org 7.x variable to me. Are you using
org 7.x? If not, you might need to change the name (although I don't
know for sure and I haven't researched it.)


>         (rusi/load-css)
>         --------------------------------
>         Now if I edit and save the my-org.css file and then call M-: (rusi/load-css)
>         it does not work.
>         Restarting emacs makes it work.
>         Ive checked that org-export-html-style is actually changed.
>         However org-mode seems to be keeping some internal copy after first use.
>         org-reload is not helping here
>
>     Can you explain "not working"? There's not enough info here to see
>     what problem you are having.
>    
>     rick
>
> Lets say my-org.css has this one line:
>
> code { color: green; }
>
> ie put inline code blocks in green when exporting to html
>
> I change it to
>
> code { color: blue; }
>

Is `code' meaningful? Exporting a simple file with code I get things
like this (with org 8.x):

   <pre class="src src-asymptote">

My css is rusty, but shouldn't that be 

src { color: blue; }

? 

> 1  save the file
> 2. Run rusi/load-css
> 3. Check that org-export-html-file's value has changed from green to blue
>
> However exports from org to html continue to export code-blocks as green
>
> Restart emacs and export (some org file that has code blocks)
> Now they are blue
>

-- 
Nick

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

* Re: How to change org-export-html-style
  2014-04-16  3:25   ` Rustom Mody
  2014-04-16  4:53     ` Nick Dokos
@ 2014-04-16  8:35     ` Rustom Mody
  2014-04-16 14:59     ` Rick Frankel
  2 siblings, 0 replies; 6+ messages in thread
From: Rustom Mody @ 2014-04-16  8:35 UTC (permalink / raw)
  To: emacs-orgmode

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

Ok Thanks Nick

I had to change org-export-html-style  to org-html-head  and now its working

How the 7.xx variable was working is still somewhat a mystery though.

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

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

* Re: How to change org-export-html-style
  2014-04-16  3:25   ` Rustom Mody
  2014-04-16  4:53     ` Nick Dokos
  2014-04-16  8:35     ` Rustom Mody
@ 2014-04-16 14:59     ` Rick Frankel
  2 siblings, 0 replies; 6+ messages in thread
From: Rick Frankel @ 2014-04-16 14:59 UTC (permalink / raw)
  To: Rustom Mody; +Cc: emacs-orgmode

On 2014-04-15 23:25, Rustom Mody wrote:
> On Tue, Apr 15, 2014 at 10:39 PM, Rick Frankel <rick@rickster.com> 
> wrote:
> 
> On 2014-04-15 07:30, Rustom Mody wrote:
> 
> I need (for various reasons) to inline these styles
> 
> I have this code in my init to change the html style
> 
> (defun rusi/load-css()
>   "Returns string from css file (hardwired) suitable for inline css"
>   (interactive)
>   (setq org-export-html-style
>     (with-temp-buffer
>       (insert "n<style type="text/css">n")
>       (insert-file-contents (expand-file-name "my-org.css" 
> "~/orghacks"))
>       (goto-char (point-max))
>       (insert "n</style>n")
>       (buffer-string))))
> (rusi/load-css)
> Now if I edit and save the my-org.css file and then call M-: 
> (rusi/load-css)
> it does not work.
> Restarting emacs makes it work.
> Ive checked that org-export-html-style is actually changed.
> However org-mode seems to be keeping some internal copy after first 
> use.
> org-reload is not helping here
> 
> Can you explain "not working"? There's not enough info here to see
> what problem you are having.
> 

On further examination, I'm not sure how it works at all!
`org-export-html-style' is a customization variable from the (old)
version of org included w/ emacs:

#+BEGIN_SRC emacs-lisp
(describe-variable 'org-export-html-style)
#+END_SRC

#+RESULTS:
#+begin_example
org-export-html-style is a variable defined in `org-html.el'.
<snip/>
#+end_example

The source file for the current exporter is `ox-html.el'.

Try setting `org-html-head' and `org-html-head-include-default-style'.

rick

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

end of thread, other threads:[~2014-04-16 14:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 11:30 How to change org-export-html-style Rustom Mody
     [not found] ` <28e944dca49c583c458b6ba60f29d078@mail.rickster.com>
2014-04-16  3:25   ` Rustom Mody
2014-04-16  4:53     ` Nick Dokos
2014-04-16  8:35     ` Rustom Mody
2014-04-16 14:59     ` Rick Frankel
  -- strict thread matches above, loose matches on Subject: below --
2014-04-15 11:35 Rustom Mody

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