emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Fully featured Web publishing
@ 2009-03-18 16:04 Sébastien Vauban
  2009-03-18 16:57 ` Sebastian Rose
  0 siblings, 1 reply; 17+ messages in thread
From: Sébastien Vauban @ 2009-03-18 16:04 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

I'd like to use Org exclusively for composing and then publishing my Web site.
I've done it so far with Emacs Muse, but I have a strong deepish attraction to
go the Org way, for many different reasons you must be aware of -- more than I
am...

The features I need are:

- Conditional CSS [if IE]
- Favicon
- JavaScript for Google Analytics
- Date in the copyright
- Contextual navigation menu

I'll come back into more details to these.

All of these were coded in the header or footer of each page with Muse. What
was good, is that I could write:

--8<---------------cut here---------------start------------->8---
(setq muse-project-alist
      `(
        ("My-Muse-Public-Website"
         ("~/Public/Websites/Muse/source/" :default "index")
         (:base "xhtml"
                :path   "~/Public/Websites/Muse/publish/"
                :header "~/Public/Websites/Muse/source/header.html"
                :footer "~/Public/Websites/Muse/source/footer.html"))))
--8<---------------cut here---------------end--------------->8---

Hence, specifying file names instead of file contents for both the header and
footer. This is good, as I don't have to change my .emacs file every time I
wanna change the way my pages have to look like. Such a feature would be nice
for Org as well. Is it scheduled?  Can we achieve the same result otherwise?

Regarding the above features:

- Conditional CSS [if IE]

  Can be coded in the common header string. OK.

- Favicon

  Can be coded in the common header string -- if it's a common one for all my
  Web site. How can we specify on a per page basis?  This more or less comes
  down to the recent addition of the `keywords' and `description' meta tags
  (thanks Carsten).

- JavaScript for Google Analytics

  Can be coded in the common header string. OK.

- Date in the copyright

  Can be coded in the common footer string. Well, it would be nice if it could
  be computed somehow, and be for example (depending of user prefs) the date
  when the file (or page) has been changed.

  Hence, it's not specifically a data that's common to every page of my Web
  site. How can we do this?

  This is what I did with Emacs Muse, embedding Emacs Lisp in the footer:

--8<---------------cut here---------------start------------->8---
  Last Updated:
      <lisp>
          (format-time-string muse-footer-date-format
                              (nth 5 (file-attributes (muse-current-file))))
      </lisp>
--8<---------------cut here---------------end--------------->8---

  but I think this is not currently possible with Org, right?  Is there some
  other solution?

- Contextual navigation menu

  Finally, the only real problem that I see (the above being nice-to-have's)
  is the following: I want to have a common navigation menu, but whose current
  page is highlighted. To do so, I just have to add the class `current' to
  the current entry, but this means the navigation menu is not constant
  between pages!

  I did that with Muse doing so:

--8<---------------cut here---------------start------------->8---
  (setq nav-menu '((\"Home\" .            \"index.html\")
                   (\"About Me\" .        ( (\"CV\"             . \"curriculum-vitae.html\")
                                          (\"PGP Public Key\" . \"pgp-public-key.html\")
                                          (\"Contact Me\"     . \"contact-me.html\")))
                   (\"Resources\" .       ( (\"Ubuntu\"         . \"ubuntu.html\")
                                          (\"Emacs\"          . \"dot-emacs.html\")))))
--8<---------------cut here---------------end--------------->8---

  and in the footer file:

--8<---------------cut here---------------start------------->8---
            <div id=\"navigation\">
                <h2>Navigation</h2>
                <lisp>(my-muse-generate-nav-menu)</lisp>
            </div>
--8<---------------cut here---------------end--------------->8---

  with the following (ugly -- caus' it should be written in a recursive way!)
  definition for `my-muse-generate-nav-menu':

--8<---------------cut here---------------start------------->8---
        (defun my-muse-generate-nav-menu ()
          (let* ((html-menu "")
                 (cur-path-muse (muse-current-file))
                 (cur-path-html
                  (replace-regexp-in-string "\\.muse" ".html" cur-path-muse)))
            (setq html-menu "<ul>\n")
            (while nav-menu
              (progn
                (if (not (listp (cdr (car nav-menu))))
                    (setq html-menu
                          (concat html-menu
                                  "<li><a href=\"" (cdr (car nav-menu))
                                  "\" title=\"" (caar nav-menu) "\""
                                  (if (string-match
                                       (concat ".*" (cdr (car nav-menu)) "$")
                                       cur-path-html)
                                      " class=\"current\""
                                    "")
                                  ">" (caar nav-menu) "</a></li>\n"))
                  (progn
                    (setq html-menu
                          (concat html-menu
                                  "<li>" (caar nav-menu) "\n" "<ul>\n"))

                    (setq nav-submenu (cdr (car nav-menu)))
                    (while nav-submenu
                      (setq html-menu
                            (concat html-menu
                                    "<li><a href=\"" (cdr (car nav-submenu))
                                    "\" title=\"" (caar nav-submenu) "\""
                                    (if (string-match
                                         (concat ".*" (cdr (car nav-submenu)) "$")
                                         cur-path-html)
                                        " class=\"current\""
                                      "")
                                    ">" (caar nav-submenu) "</a></li>\n"))
                      (setq nav-submenu (cdr nav-submenu)))

                    (setq html-menu (concat html-menu "</ul>\n</li>\n"))))
                (setq nav-menu (cdr nav-menu))))
            (setq html-menu (concat html-menu "</ul>"))
            html-menu))
--8<---------------cut here---------------end--------------->8---

  How can I do such a thing in Org?

THANK YOU VERY MUCH for all the hints or help you can provide me with!

I really want to go the Org way for all my composed stuff...

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Fully featured Web publishing
  2009-03-18 16:04 Fully featured Web publishing Sébastien Vauban
@ 2009-03-18 16:57 ` Sebastian Rose
  2009-03-18 21:20   ` Sébastien Vauban
  0 siblings, 1 reply; 17+ messages in thread
From: Sebastian Rose @ 2009-03-18 16:57 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Sébastien Vauban <zthjwsqqafhv@spammotel.com> writes:

> Hello,
>
> I'd like to use Org exclusively for composing and then publishing my Web site.
> I've done it so far with Emacs Muse, but I have a strong deepish attraction to
> go the Org way, for many different reasons you must be aware of -- more than I
> am...
>
> The features I need are:
>
> - Conditional CSS [if IE]
> - Favicon

Both can be achieved through the

#+STYLE:

options. Multiple lines possible. Those lines are added to the `<head>'
section of the resulting documents.

Also, you might take a look into the documentation for
org-publish-project-alist in
http://orgmode.org/manual/Sample-configuration.html#Sample-configuration



> - JavaScript for Google Analytics
> - Date in the copyright
> - Contextual navigation menu

#+begin_html

  your menu here

#+end_html


#+begin_html

  your analytics script here

#+end_html



Regards,

   Sebastian



> I'll come back into more details to these.
>
> All of these were coded in the header or footer of each page with Muse. What
> was good, is that I could write:
>
>
> (setq muse-project-alist
>       `(
>         ("My-Muse-Public-Website"
>          ("~/Public/Websites/Muse/source/" :default "index")
>          (:base "xhtml"
>                 :path   "~/Public/Websites/Muse/publish/"
>                 :header "~/Public/Websites/Muse/source/header.html"
>                 :footer "~/Public/Websites/Muse/source/footer.html"))))
>
> Hence, specifying file names instead of file contents for both the header and
> footer. This is good, as I don't have to change my .emacs file every time I
> wanna change the way my pages have to look like. Such a feature would be nice
> for Org as well. Is it scheduled?  Can we achieve the same result otherwise?
>
> Regarding the above features:
>
> - Conditional CSS [if IE]
>
>   Can be coded in the common header string. OK.
>
> - Favicon
>
>   Can be coded in the common header string -- if it's a common one for all my
>   Web site. How can we specify on a per page basis?  This more or less comes
>   down to the recent addition of the `keywords' and `description' meta tags
>   (thanks Carsten).
>
> - JavaScript for Google Analytics
>
>   Can be coded in the common header string. OK.
>
> - Date in the copyright
>
>   Can be coded in the common footer string. Well, it would be nice if it could
>   be computed somehow, and be for example (depending of user prefs) the date
>   when the file (or page) has been changed.
>
>   Hence, it's not specifically a data that's common to every page of my Web
>   site. How can we do this?
>
>   This is what I did with Emacs Muse, embedding Emacs Lisp in the footer:
>
>
>   Last Updated:
>       <lisp>
>           (format-time-string muse-footer-date-format
>                               (nth 5 (file-attributes (muse-current-file))))
>       </lisp>
>
>   but I think this is not currently possible with Org, right?  Is there some
>   other solution?
>
> - Contextual navigation menu
>
>   Finally, the only real problem that I see (the above being nice-to-have's)
>   is the following: I want to have a common navigation menu, but whose current
>   page is highlighted. To do so, I just have to add the class `current' to
>   the current entry, but this means the navigation menu is not constant
>   between pages!
>
>   I did that with Muse doing so:
>
>
>   (setq nav-menu '((\"Home\" .            \"index.html\")
>                    (\"About Me\" .        ( (\"CV\"             . \"curriculum-vitae.html\")
>                                           (\"PGP Public Key\" . \"pgp-public-key.html\")
>                                           (\"Contact Me\"     . \"contact-me.html\")))
>                    (\"Resources\" .       ( (\"Ubuntu\"         . \"ubuntu.html\")
>                                           (\"Emacs\"          . \"dot-emacs.html\")))))
>
>   and in the footer file:
>
>
>             <div id=\"navigation\">
>                 <h2>Navigation</h2>
>                 <lisp>(my-muse-generate-nav-menu)</lisp>
>             </div>
>
>   with the following (ugly -- caus' it should be written in a recursive way!)
>   definition for `my-muse-generate-nav-menu':
>
>
>         (defun my-muse-generate-nav-menu ()
>           (let* ((html-menu "")
>                  (cur-path-muse (muse-current-file))
>                  (cur-path-html
>                   (replace-regexp-in-string "\\.muse" ".html" cur-path-muse)))
>             (setq html-menu "<ul>\n")
>             (while nav-menu
>               (progn
>                 (if (not (listp (cdr (car nav-menu))))
>                     (setq html-menu
>                           (concat html-menu
>                                   "<li><a href=\"" (cdr (car nav-menu))
>                                   "\" title=\"" (caar nav-menu) "\""
>                                   (if (string-match
>                                        (concat ".*" (cdr (car nav-menu)) "$")
>                                        cur-path-html)
>                                       " class=\"current\""
>                                     "")
>                                   ">" (caar nav-menu) "</a></li>\n"))
>                   (progn
>                     (setq html-menu
>                           (concat html-menu
>                                   "<li>" (caar nav-menu) "\n" "<ul>\n"))
>
>                     (setq nav-submenu (cdr (car nav-menu)))
>                     (while nav-submenu
>                       (setq html-menu
>                             (concat html-menu
>                                     "<li><a href=\"" (cdr (car nav-submenu))
>                                     "\" title=\"" (caar nav-submenu) "\""
>                                     (if (string-match
>                                          (concat ".*" (cdr (car nav-submenu)) "$")
>                                          cur-path-html)
>                                         " class=\"current\""
>                                       "")
>                                     ">" (caar nav-submenu) "</a></li>\n"))
>                       (setq nav-submenu (cdr nav-submenu)))
>
>                     (setq html-menu (concat html-menu "</ul>\n</li>\n"))))
>                 (setq nav-menu (cdr nav-menu))))
>             (setq html-menu (concat html-menu "</ul>"))
>             html-menu))
>
>   How can I do such a thing in Org?
>
> THANK YOU VERY MUCH for all the hints or help you can provide me with!
>
> I really want to go the Org way for all my composed stuff...
>
> Best regards,
>   Seb

-- 
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.:  +49 (0)511 - 36 58 472
Fax:   +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
Http:  www.emma-stil.de

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

* Re: Fully featured Web publishing
  2009-03-18 16:57 ` Sebastian Rose
@ 2009-03-18 21:20   ` Sébastien Vauban
  2009-03-18 22:38     ` Sebastian Rose
  0 siblings, 1 reply; 17+ messages in thread
From: Sébastien Vauban @ 2009-03-18 21:20 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Sebastian,

Sebastian Rose wrote:
> Sébastien Vauban <zthjwsqqafhv-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> I'd like to use Org exclusively for composing and then publishing my Web site.
>> I've done it so far with Emacs Muse, but I have a strong deepish attraction to
>> go the Org way, for many different reasons you must be aware of -- more than I
>> am...
>>
>>   [...]
>>
>>   The only real problem that I see (the above being nice-to-have's) is the
>>   following: I want to have a common navigation menu, but whose current
>>   page is highlighted. To do so, I just have to add the class `current' to
>>   the current entry, but this means the navigation menu is not constant
>>   between pages!
>>
>>   I did that with Muse doing so:
>>
>>   (setq nav-menu '((\"Home\" .            \"index.html\")
>>                    (\"About Me\" .        ( (\"CV\"             . \"curriculum-vitae.html\")
>>                                           (\"PGP Public Key\" . \"pgp-public-key.html\")
>>                                           (\"Contact Me\"     . \"contact-me.html\")))
>>                    (\"Resources\" .       ( (\"Ubuntu\"         . \"ubuntu.html\")
>>                                           (\"Emacs\"          . \"dot-emacs.html\")))))
>>
>>   and in the footer file:
>>
>>             <div id=\"navigation\">
>>                 <h2>Navigation</h2>
>>                 <lisp>(my-muse-generate-nav-menu)</lisp>
>>             </div>
>>
>>   with:
>>
>>         (defun my-muse-generate-nav-menu ()
>>          [...]
>>                                     (if (string-match
>>                                          (concat ".*" (cdr (car nav-submenu)) "$")
>>                                          cur-path-html)
>>                                         " class=\"current\""
>>                                       "")
>>          [...]
>>
>>   How can I do such a thing in Org?
>
> #+begin_html
>
>   your menu here
>
> #+end_html

Thanks for the other (useful) info. But, here, your answer is not adequate as
I don't want to have almost identical information duplicated in each page of
my site. Just imagine the pain it is if I want to change the structure (adding
a new page in my menu -- I have to update all my pages!).

The trick I used with Muse was to make that automatically computed:

    o   having a menu defined only once;

    o   per page, adding the `current' keyword on the adequate item --
        automatically done by the above function.

Adding a page in my Web site means just updating one variable: the menu
definition. Nothing more to do...

Is there, then, a similar solution?  Or, at least, one achieving the same
results by other means?

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: Fully featured Web publishing
  2009-03-18 21:20   ` Sébastien Vauban
@ 2009-03-18 22:38     ` Sebastian Rose
  2009-03-18 22:56       ` Rasmus Pank Roulund
  0 siblings, 1 reply; 17+ messages in thread
From: Sebastian Rose @ 2009-03-18 22:38 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Sébastien Vauban <zthjwsqqafhv@spammotel.com> writes:
> Thanks for the other (useful) info. But, here, your answer is not adequate as
> I don't want to have almost identical information duplicated in each page of
> my site. Just imagine the pain it is if I want to change the structure (adding
> a new page in my menu -- I have to update all my pages!).


I understand. Use `#+SETUPFILE' for that reason.


Automatical computing of navigations is not possible (yet).


> The trick I used with Muse was to make that automatically computed:
>
>     o   having a menu defined only once;
>
>     o   per page, adding the `current' keyword on the adequate item --
>         automatically done by the above function.
>
> Adding a page in my Web site means just updating one variable: the menu
> definition. Nothing more to do...
>
> Is there, then, a similar solution?  Or, at least, one achieving the same
> results by other means?
>
> Best regards,
>   Seb

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

* Re: Fully featured Web publishing
  2009-03-18 22:38     ` Sebastian Rose
@ 2009-03-18 22:56       ` Rasmus Pank Roulund
  2009-03-18 23:19         ` Richard Riley
  0 siblings, 1 reply; 17+ messages in thread
From: Rasmus Pank Roulund @ 2009-03-18 22:56 UTC (permalink / raw)
  To: emacs-orgmode

I have done something similar. I have a single menu file which I
include on every page. 
#+INCLUDE:    menu.org

Would that solve you problem?

-Rasmus

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

* Re: Re: Fully featured Web publishing
  2009-03-18 22:56       ` Rasmus Pank Roulund
@ 2009-03-18 23:19         ` Richard Riley
  2009-03-19  7:46           ` Rasmus Pank Roulund
  2009-03-19 10:37           ` Sebastian Rose
  0 siblings, 2 replies; 17+ messages in thread
From: Richard Riley @ 2009-03-18 23:19 UTC (permalink / raw)
  To: Rasmus Pank Roulund; +Cc: emacs-orgmode


Rasmus Pank Roulund <rasmus.pank@gmail.com> writes:

> I have done something similar. I have a single menu file which I
> include on every page. 
> #+INCLUDE:    menu.org
>
> Would that solve you problem?
>
> -Rasmus

Why not us preamble?

I'm not sure if its an approved way or not but has done for me for a site
wide addition for a while now but I must admit to not being up to date
with all latest and greatest innovations.

http://richardriley.net/projects/emacs/dotorg.html

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

* Re: Fully featured Web publishing
  2009-03-18 23:19         ` Richard Riley
@ 2009-03-19  7:46           ` Rasmus Pank Roulund
  2009-03-19  8:28             ` Richard Riley
  2009-03-19  9:43             ` Sébastien Vauban
  2009-03-19 10:37           ` Sebastian Rose
  1 sibling, 2 replies; 17+ messages in thread
From: Rasmus Pank Roulund @ 2009-03-19  7:46 UTC (permalink / raw)
  To: emacs-orgmode

> Why not us preamble?

I am not sure I understand you question, but:
Because the OP wants to include the same menu on every page. If you
input the file you will only have to update one file and the other files
will be updated. 

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

* Re: Re: Fully featured Web publishing
  2009-03-19  7:46           ` Rasmus Pank Roulund
@ 2009-03-19  8:28             ` Richard Riley
  2009-03-19  9:43             ` Sébastien Vauban
  1 sibling, 0 replies; 17+ messages in thread
From: Richard Riley @ 2009-03-19  8:28 UTC (permalink / raw)
  To: Rasmus Pank Roulund; +Cc: emacs-orgmode

Rasmus Pank Roulund <rasmus.pank@gmail.com> writes:

>> Why not us preamble?
>
> I am not sure I understand you question, but:
> Because the OP wants to include the same menu on every page. If you
> input the file you will only have to update one file and the other files
> will be updated. 

with preamble you do it across the web with one change in your project
definition and since it is across the web it seems appropriate to be
part of the org project definition.


I included a link to an example.

>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

-- 

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

* Re: Fully featured Web publishing
  2009-03-19  7:46           ` Rasmus Pank Roulund
  2009-03-19  8:28             ` Richard Riley
@ 2009-03-19  9:43             ` Sébastien Vauban
  2009-03-23 11:36               ` Sébastien Vauban
  1 sibling, 1 reply; 17+ messages in thread
From: Sébastien Vauban @ 2009-03-19  9:43 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi all,

Thanks for your input...

Rasmus Pank Roulund wrote:
>> Why not us preamble?
>
> Because the OP wants to include the same menu on every page. If you input
> the file you will only have to update one file and the other files will be
> updated.

I can't use your solutions, as the navigation menu is almost identical, but it
is not completely: the keyword `current' has to be appended to the entry the
page is about.

>>   The only real problem that I see (the above being nice-to-have's) is the
>>   following: I want to have a common navigation menu, but whose current
>>   page is highlighted. To do so, I just have to add the class `current' to
>>   the current entry, but this means the navigation menu is not constant
>>   between pages!

For example, my menu will be this one for the _home page_:

--8<---------------cut here---------------start------------->8---
<div id="navigation">
<h2>Navigation</h2>
<ul>
    <li><a href="index.html" title="Home" class="current">Home</a></li>
                                     <!-- ^^^^^^^^^^^^^^^ -->
    <li>About Me
    <ul>
        <li><a href="curriculum-vitae.html" title="CV">CV</a></li>
        <li><a href="pgp-public-key.html" title="PGP Public Key">PGP Public Key</a></li>
        <li><a href="contact-me.html" title="Contact Me">Contact Me</a></li>
    </ul>
    </li>
    <li>Resources
    <ul>
        <li><a href="freeware.html" title="Freeware">Freeware</a></li>
        <li><a href="dot-emacs.html" title="Emacs">Emacs</a></li>
    </ul>
    </li>
</ul>
</div>
--8<---------------cut here---------------end--------------->8---

and this one for my _CV_:

--8<---------------cut here---------------start------------->8---
<div id="navigation">
<h2>Navigation</h2>
<ul>
    <li><a href="index.html" title="Home" class="current">Home</a></li>
    <li>About Me
    <ul>
        <li><a href="curriculum-vitae.html" title="CV" class="current">CV</a></li>
                                                  <!-- ^^^^^^^^^^^^^^^ -->
        <li><a href="pgp-public-key.html" title="PGP Public Key">PGP Public Key</a></li>
        <li><a href="contact-me.html" title="Contact Me">Contact Me</a></li>
    </ul>
    </li>
    <li>Resources
    <ul>
        <li><a href="freeware.html" title="Freeware">Freeware</a></li>
        <li><a href="dot-emacs.html" title="Emacs">Emacs</a></li>
    </ul>
    </li>
</ul>
</div>
--8<---------------cut here---------------end--------------->8---

The skeleton is static, but the instantiated navigation menu for a specific
page should be computed automatically, when publishing...

I hope I now have clearly expressed my point. If yes, do you see any solution
for me?

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: Fully featured Web publishing
  2009-03-18 23:19         ` Richard Riley
  2009-03-19  7:46           ` Rasmus Pank Roulund
@ 2009-03-19 10:37           ` Sebastian Rose
  2009-03-19 13:38             ` Richard Riley
  1 sibling, 1 reply; 17+ messages in thread
From: Sebastian Rose @ 2009-03-19 10:37 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode, Rasmus Pank Roulund

Richard Riley <rileyrgdev@googlemail.com> writes:
> Why not us preamble?
>
> I'm not sure if its an approved way or not but has done for me for a site
> wide addition for a while now but I must admit to not being up to date
> with all latest and greatest innovations.
>
> http://richardriley.net/projects/emacs/dotorg.html

Nice trick. We have to put this into the publishing tutorial!



BTW: here is bug in the docs:

C-h v org-preamble TAB RET

   org-export-html-preamble is a variable defined in `org-exp.el'.
   Its value is nil

   Documentation:
   Preamble, to be inserted just before <body>.  Set by publishing functions.


Should be:

   org-export-html-preamble is a variable defined in `org-exp.el'.
   Its value is nil

   Documentation:
   Preamble, to be inserted just after <body>.  Set by publishing functions.





Regards,

   Sebastian

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

* Re: Re: Fully featured Web publishing
  2009-03-19 10:37           ` Sebastian Rose
@ 2009-03-19 13:38             ` Richard Riley
  2009-03-19 15:03               ` Sebastian Rose
  2009-03-19 16:12               ` Matthew Lundin
  0 siblings, 2 replies; 17+ messages in thread
From: Richard Riley @ 2009-03-19 13:38 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: emacs-orgmode, Richard Riley, Rasmus Pank Roulund

Sebastian Rose <sebastian_rose@gmx.de> writes:

> Richard Riley <rileyrgdev@googlemail.com> writes:
>> Why not us preamble?
>>
>> I'm not sure if its an approved way or not but has done for me for a site
>> wide addition for a while now but I must admit to not being up to date
>> with all latest and greatest innovations.
>>
>> http://richardriley.net/projects/emacs/dotorg.html
>
> Nice trick. We have to put this into the publishing tutorial!

Is it a trick though? It seemed the best way to do it at the time. What
is the better way? At the time I asked about a header and footer which
is fairly common and decided to use preamble and postamble to
effectively act as common header and footer components. Prior to the
"id=content" modifications (container) I also used to introduce the
"content"container using preamble and postamble too (e.preamble opening
the div and postamble closing it).

regards,

r.

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

* Re: Re: Fully featured Web publishing
  2009-03-19 13:38             ` Richard Riley
@ 2009-03-19 15:03               ` Sebastian Rose
  2009-03-19 16:12               ` Matthew Lundin
  1 sibling, 0 replies; 17+ messages in thread
From: Sebastian Rose @ 2009-03-19 15:03 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode, Rasmus Pank Roulund

Richard Riley <rileyrgdev@googlemail.com> writes:
> Is it a trick though?

Sorry, I mixed German and English here. I German a 'Trick' is primarily
a _positive_ thing.

If you want to turn it into something (slightly) negative, you say
'fauler Trick' here :)

(literally: 'lazy trick')



-- 
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.:  +49 (0)511 - 36 58 472
Fax:   +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Http:  www.emma-stil.de

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

* Re: Re: Fully featured Web publishing
  2009-03-19 13:38             ` Richard Riley
  2009-03-19 15:03               ` Sebastian Rose
@ 2009-03-19 16:12               ` Matthew Lundin
  1 sibling, 0 replies; 17+ messages in thread
From: Matthew Lundin @ 2009-03-19 16:12 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode, Rasmus Pank Roulund

Richard Riley <rileyrgdev@googlemail.com> writes:

>>> Why not us preamble?
>>>
>>> I'm not sure if its an approved way or not but has done for me for a site
>>> wide addition for a while now but I must admit to not being up to date
>>> with all latest and greatest innovations.
>>>
>>> http://richardriley.net/projects/emacs/dotorg.html

> It seemed the best way to do it at the time. What is the better way?
> At the time I asked about a header and footer which is fairly common
> and decided to use preamble and postamble to effectively act as common
> header and footer components. Prior to the "id=content" modifications
> (container) I also used to introduce the "content"container using
> preamble and postamble too (e.preamble opening the div and postamble
> closing it).

To chime in here, this is precisely how I create the menu on my website:

http://faculty.valpo.edu/mlundin/

In my org-publish-project-alist I have the following:

,----
| [snip]
| :preamble "
| <div id=\"menu\">
| <div id=\"sidemenu\">
| <a href=\"index.html\">Home</a> &#124;
| <a href=\"sitemap.html\">Site Map</a>
| </div>
| <div id=\"sidetitle\">
| Matthew Lundin
| </div>
| </div>
| <div id=\"wrapper\">"
| :postamble "</div>"
| [snip]
`----

The preamble is placed directly beneath the <body> tag.

I use to add a couple of extra wrapper divs, but with the new default
content div, I only add one. 

Obviously, one could get a lot more elaborate with this.

Best,
Matt

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

* Re: Fully featured Web publishing
  2009-03-19  9:43             ` Sébastien Vauban
@ 2009-03-23 11:36               ` Sébastien Vauban
  2009-03-23 13:50                 ` Taru Karttunen
  0 siblings, 1 reply; 17+ messages in thread
From: Sébastien Vauban @ 2009-03-23 11:36 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

>> Because the OP wants to include the same menu on every page.

To better explain my problem:

1. I would like to define my navigation menu once (as some "variable" of the
   project). For example:

--8<---------------cut here---------------start------------->8---
   (setq nav-menu '(("Home" .      "index.html")
                    ("About Me" .  ( ("CV"             . "curriculum-vitae.html")
                                     ("Contact Me"     . "contact-me.html")))
                    ("Resources" . ( ("Freeware"       . "freeware.html")
                                     ("Emacs"          . "dot-emacs.html")))))
--8<---------------cut here---------------end--------------->8---


2. I would like this to be converted to HTML for each page, but with a "mark"
   that indicates which page is generated (for the CSS to be able to
   highlight, in the navigation menu, the page that's currently displayed in
   the browser).

   For example, for my home page:

--8<---------------cut here---------------start------------->8---
   <div id="navigation">
   <h2>Navigation</h2>
   <ul>
     <li><a href="index.html" title="Home" class="current">Home</a>
     </li>                            <!-- ^^^^^^^^^^^^^^^ -->

     <li>About Me
       <ul>
         <li><a href="curriculum-vitae.html" title="CV">CV</a></li>
         <li><a href="contact-me.html" title="Contact Me">Contact Me</a></li>
       </ul>
     </li>

     <li>Resources
       <ul>
         <li><a href="freeware.html" title="Freeware">Freeware</a></li>
         <li><a href="dot-emacs.html" title="Emacs">Emacs</a></li>
       </ul>
     </li>
   </ul>
   </div>
--8<---------------cut here---------------end--------------->8---

   and for my CV:

--8<---------------cut here---------------start------------->8---
   <div id="navigation">
   <h2>Navigation</h2>
   <ul>
     <li><a href="index.html" title="Home" class="current">Home</a>
     </li>

     <li>About Me
       <ul>
         <li><a href="curriculum-vitae.html" title="CV" class="current">CV</a></li>
                                                   <!-- ^^^^^^^^^^^^^^^ -->
         <li><a href="contact-me.html" title="Contact Me">Contact Me</a></li>
       </ul>
     </li>

     <li>Resources
       <ul>
         <li><a href="freeware.html" title="Freeware">Freeware</a></li>
         <li><a href="dot-emacs.html" title="Emacs">Emacs</a></li>
       </ul>
     </li>
   </ul>
   </div>
--8<---------------cut here---------------end--------------->8---

So, the question narrows down to: is there a hook available where the correct
code could be placed to achieve such a result?

Thanks a lot,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Fully featured Web publishing
  2009-03-23 11:36               ` Sébastien Vauban
@ 2009-03-23 13:50                 ` Taru Karttunen
  0 siblings, 0 replies; 17+ messages in thread
From: Taru Karttunen @ 2009-03-23 13:50 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Hello

Here is a simple solution, have a menu like:

--8<---------------cut here---------------start------------->8---
   <div id="navigation">
   <h2>Navigation</h2>
    <p>
    <a href="index.html"            id="navigation-home">Home</a>
    <a href="curriculum-vitae.html" id="navigation-cv">CV</a>
    <a href="contact-me.html"       id="navigation-contact-me">Contact Me</a>
    </p>
   </div>
--8<---------------cut here---------------end--------------->8---

And simply have inside curriculum-vitae.org:
#+STYLE: a#navigation-cv { color: red }

inside contact-me.org:
#+STYLE: a#navigation-contact-me { color: red }

etc

Setting the correct style can also be automated with suitable
Javascript.

- Taru Karttunen

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

* Re: Re: Fully featured Web publishing
@ 2009-04-18  9:23 Tomas Hlavaty
  2009-04-18 11:04 ` Carsten Dominik
  0 siblings, 1 reply; 17+ messages in thread
From: Tomas Hlavaty @ 2009-04-18  9:23 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

thanks for the excelent org-mode;-)

> Automatical computing of navigations is not possible (yet).

There is a way of achieving this:

1. define and use function my-org-publish-org-to-html which determines
   what directory level we are on and then calls the original
   org-publish-org-to-html function

2. define and use my-org-preamble which inserts the preamble based on
   the directory level computed above

3. patch org-export-as-html so that the config parameters :style and
   :preamble can be functions as well as strings.

Here is rough code.

Configuration:

         :publishing-function my-org-publish-org-to-html
         :style my-org-style
         :preamble my-org-preamble

The "user" code:

(defun my-org-publish-org-to-html (plist filename pubdir)
  (let* ((dir (file-name-as-directory
               (file-truename (plist-get plist :base-directory))))
         (fname (file-truename filename))
         (rel (substring fname (length dir)))
         (*org-publish-level*
            (loop for x in (split-string rel "")
               count (and (stringp x) (string= "/" x)))))
    (org-publish-org-to-html plist filename pubdir)))

(defun my-org-preamble ()
  (let ((pre (apply 'concat
                (loop for i from 1 upto *org-publish-level* collect "../"))))
    (insert "
<div id=\"menu\">
<a href=\"" pre "index.html\">Home</a>
| <a href=\"" pre "sw/index.html\">Software</a>
| <a href=\"" pre "blog/index.html\">Blog</a>
| <a href=\"" pre "contact.html\">Contact</a>
| <a href=\"" pre "sitemap.html\">Site Map</a>
</div>
<div>
")))

(defun my-org-style ()
  (let ((pre (apply 'concat
                (loop for i from 1 upto *org-publish-level* collect "../"))))
    (concat "
<link rel=\"stylesheet\" href=\"" pre "style.css\" type=\"text/css\"/>
<link rel=\"icon\" href=\"" pre "favicon.ico\" type=\"image/x-icon\"/>
<link rel=\"shortcut icon\" href=\"" pre "favicon.ico\" type=\"image/x-icon\"/>")))

The "patched" code in org-export-as-html:

@@ -465,7 +465,12 @@ PUB-DIR is set, use this as the publishing directory."
 			       (org-infile-export-plist))))
 	 (style (concat (if (plist-get opt-plist :style-include-default)
 			    org-export-html-style-default)
-			(plist-get opt-plist :style)
+            ;;; THL Changed !!!
+			(let ((s (plist-get opt-plist :style)))
+              (cond
+               ((and s (stringp s)) s)
+               (s (funcall s))))
+            ;;;(plist-get opt-plist :style)
 			(plist-get opt-plist :style-extra)
 			"\n"
 			(if (plist-get opt-plist :style-include-scripts)
@@ -664,7 +669,12 @@ lang=\"%s\" xml:lang=\"%s\">
 		 date author description keywords
 		 style))
 
-	(insert (or (plist-get opt-plist :preamble) ""))
+    ;; THL Changed !!!
+    (let ((preamble (plist-get opt-plist :preamble)))
+      (cond
+       ((and preamble (stringp preamble)) (insert preamble))
+       (preamble (funcall preamble))))
+	;;(insert (or (plist-get opt-plist :preamble) ""))
 
 	(when (plist-get opt-plist :auto-preamble)
 	  (if title (insert (format org-export-html-title-format

I think that in general, the org-mode configuration
(org-publish-project-alist) would be more flexible/user programable if
the config parameters could also be functions (i.e. not limited to
strings only).  Any ideas whether and how to improve and make the
above functionality available in the official release?

Thank you,

Tomas

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

* Re: Re: Fully featured Web publishing
  2009-04-18  9:23 Tomas Hlavaty
@ 2009-04-18 11:04 ` Carsten Dominik
  0 siblings, 0 replies; 17+ messages in thread
From: Carsten Dominik @ 2009-04-18 11:04 UTC (permalink / raw)
  To: Tomas Hlavaty; +Cc: emacs-orgmode

Hi Tomas,

if you have or will sign a copyright assignment, I'd be happy to accept
a patch to this effect.

- Carsten

On Apr 18, 2009, at 11:23 AM, Tomas Hlavaty wrote:

> Hi all,
>
> thanks for the excelent org-mode;-)
>
>> Automatical computing of navigations is not possible (yet).
>
> There is a way of achieving this:
>
> 1. define and use function my-org-publish-org-to-html which determines
>   what directory level we are on and then calls the original
>   org-publish-org-to-html function
>
> 2. define and use my-org-preamble which inserts the preamble based on
>   the directory level computed above
>
> 3. patch org-export-as-html so that the config parameters :style and
>   :preamble can be functions as well as strings.
>
> Here is rough code.
>
> Configuration:
>
>         :publishing-function my-org-publish-org-to-html
>         :style my-org-style
>         :preamble my-org-preamble
>
> The "user" code:
>
> (defun my-org-publish-org-to-html (plist filename pubdir)
>  (let* ((dir (file-name-as-directory
>               (file-truename (plist-get plist :base-directory))))
>         (fname (file-truename filename))
>         (rel (substring fname (length dir)))
>         (*org-publish-level*
>            (loop for x in (split-string rel "")
>               count (and (stringp x) (string= "/" x)))))
>    (org-publish-org-to-html plist filename pubdir)))
>
> (defun my-org-preamble ()
>  (let ((pre (apply 'concat
>                (loop for i from 1 upto *org-publish-level* collect  
> "../"))))
>    (insert "
> <div id=\"menu\">
> <a href=\"" pre "index.html\">Home</a>
> | <a href=\"" pre "sw/index.html\">Software</a>
> | <a href=\"" pre "blog/index.html\">Blog</a>
> | <a href=\"" pre "contact.html\">Contact</a>
> | <a href=\"" pre "sitemap.html\">Site Map</a>
> </div>
> <div>
> ")))
>
> (defun my-org-style ()
>  (let ((pre (apply 'concat
>                (loop for i from 1 upto *org-publish-level* collect  
> "../"))))
>    (concat "
> <link rel=\"stylesheet\" href=\"" pre "style.css\" type=\"text/css\"/>
> <link rel=\"icon\" href=\"" pre "favicon.ico\" type=\"image/x-icon\"/>
> <link rel=\"shortcut icon\" href=\"" pre "favicon.ico\" type=\"image/ 
> x-icon\"/>")))
>
> The "patched" code in org-export-as-html:
>
> @@ -465,7 +465,12 @@ PUB-DIR is set, use this as the publishing  
> directory."
> 			       (org-infile-export-plist))))
> 	 (style (concat (if (plist-get opt-plist :style-include-default)
> 			    org-export-html-style-default)
> -			(plist-get opt-plist :style)
> +            ;;; THL Changed !!!
> +			(let ((s (plist-get opt-plist :style)))
> +              (cond
> +               ((and s (stringp s)) s)
> +               (s (funcall s))))
> +            ;;;(plist-get opt-plist :style)
> 			(plist-get opt-plist :style-extra)
> 			"\n"
> 			(if (plist-get opt-plist :style-include-scripts)
> @@ -664,7 +669,12 @@ lang=\"%s\" xml:lang=\"%s\">
> 		 date author description keywords
> 		 style))
>
> -	(insert (or (plist-get opt-plist :preamble) ""))
> +    ;; THL Changed !!!
> +    (let ((preamble (plist-get opt-plist :preamble)))
> +      (cond
> +       ((and preamble (stringp preamble)) (insert preamble))
> +       (preamble (funcall preamble))))
> +	;;(insert (or (plist-get opt-plist :preamble) ""))
>
> 	(when (plist-get opt-plist :auto-preamble)
> 	  (if title (insert (format org-export-html-title-format
>
> I think that in general, the org-mode configuration
> (org-publish-project-alist) would be more flexible/user programable if
> the config parameters could also be functions (i.e. not limited to
> strings only).  Any ideas whether and how to improve and make the
> above functionality available in the official release?
>
> Thank you,
>
> Tomas
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2009-04-18 11:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-18 16:04 Fully featured Web publishing Sébastien Vauban
2009-03-18 16:57 ` Sebastian Rose
2009-03-18 21:20   ` Sébastien Vauban
2009-03-18 22:38     ` Sebastian Rose
2009-03-18 22:56       ` Rasmus Pank Roulund
2009-03-18 23:19         ` Richard Riley
2009-03-19  7:46           ` Rasmus Pank Roulund
2009-03-19  8:28             ` Richard Riley
2009-03-19  9:43             ` Sébastien Vauban
2009-03-23 11:36               ` Sébastien Vauban
2009-03-23 13:50                 ` Taru Karttunen
2009-03-19 10:37           ` Sebastian Rose
2009-03-19 13:38             ` Richard Riley
2009-03-19 15:03               ` Sebastian Rose
2009-03-19 16:12               ` Matthew Lundin
  -- strict thread matches above, loose matches on Subject: below --
2009-04-18  9:23 Tomas Hlavaty
2009-04-18 11:04 ` Carsten Dominik

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