emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Babel for blogging
@ 2010-10-15 16:07 Manuel Giraud
  2010-10-15 17:07 ` Eric Schulte
  0 siblings, 1 reply; 10+ messages in thread
From: Manuel Giraud @ 2010-10-15 16:07 UTC (permalink / raw)
  To: emacs-orgmode


Hi, 

I'd like to set up a simple blog (with static page only) using emacs. So
far, I was able to use emacs-muse based on the following instructions:
http://alexott.net/en/writings/EmacsMuseMyPage.html
http://www.diale.org/muse-functions.html

Now, I'd like to give org-publish a try because it seems to provide nice
features (and i'm already using org-mode as an agenda anyway).  So far
so good I can publish entries, but I can't find a way to produce an
index of all the entries sorted by date.

With muse, i created a file with a <lisp></lisp> block to call the
function muse-index-as-string-sort-by-date and this call insert the
updated index in place.

Now I'd like to do something similar using org-mode babel feature, but
if i try this:
---8<-----
#+BEGIN_SRC emacs-lisp :results output :exports results
  (list "[[bar][1]]" "[[foo][2]]")
#+END_SRC
---8<-----

The content appears as a code snippet in the html export which is not
exactly what I want. How can I do this? Am I misleaded because
org-publish already provide this?

-- 
Manuel Giraud

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

* Re: Babel for blogging
  2010-10-15 16:07 Babel for blogging Manuel Giraud
@ 2010-10-15 17:07 ` Eric Schulte
  2010-10-15 17:44   ` Pere Quintana Seguí
  2010-10-15 23:03   ` Eric S Fraga
  0 siblings, 2 replies; 10+ messages in thread
From: Eric Schulte @ 2010-10-15 17:07 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: emacs-orgmode

Hi Manuel,

The following works for me, it creates an index of all files in the same
directory as the Org-mode file.

--8<---------------cut here---------------start------------->8---
* index

Create an index automatically with an elisp code block.

#+begin_src emacs-lisp :exports results :results raw
  (mapconcat
   (lambda (file)
     (unless (file-directory-p file)
       (format "- [[%s][%s]]" (file-name-sans-extension file) file)))
   (directory-files (or default-directory
                        (file-name-directory (buffer-file-name))))
   "\n")
#+end_src
--8<---------------cut here---------------end--------------->8---

Does this solve your requirement?

Cheers -- Eric

Manuel Giraud <manuel.giraud@univ-nantes.fr> writes:

> Hi, 
>
> I'd like to set up a simple blog (with static page only) using emacs. So
> far, I was able to use emacs-muse based on the following instructions:
> http://alexott.net/en/writings/EmacsMuseMyPage.html
> http://www.diale.org/muse-functions.html
>
> Now, I'd like to give org-publish a try because it seems to provide nice
> features (and i'm already using org-mode as an agenda anyway).  So far
> so good I can publish entries, but I can't find a way to produce an
> index of all the entries sorted by date.
>
> With muse, i created a file with a <lisp></lisp> block to call the
> function muse-index-as-string-sort-by-date and this call insert the
> updated index in place.
>
> Now I'd like to do something similar using org-mode babel feature, but
> if i try this:
> ---8<-----
> #+BEGIN_SRC emacs-lisp :results output :exports results
>   (list "[[bar][1]]" "[[foo][2]]")
> #+END_SRC
> ---8<-----
>
> The content appears as a code snippet in the html export which is not
> exactly what I want. How can I do this? Am I misleaded because
> org-publish already provide this?

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

* Re: Babel for blogging
  2010-10-15 17:07 ` Eric Schulte
@ 2010-10-15 17:44   ` Pere Quintana Seguí
  2010-10-15 20:32     ` Eric Schulte
  2010-10-15 23:03   ` Eric S Fraga
  1 sibling, 1 reply; 10+ messages in thread
From: Pere Quintana Seguí @ 2010-10-15 17:44 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2482 bytes --]

Thanks for the tip Eric, I'll use it to create a sitemap for my site,
which is made using org-mode.

Do you know if it would be possible to create an RSS file, using a
similar approach?

Thanks,

Pere

Al 15/10/10 19:07, En/na Eric Schulte ha escrit:
> Hi Manuel,
> 
> The following works for me, it creates an index of all files in the same
> directory as the Org-mode file.
> 
> --8<---------------cut here---------------start------------->8---
> * index
> 
> Create an index automatically with an elisp code block.
> 
> #+begin_src emacs-lisp :exports results :results raw
>   (mapconcat
>    (lambda (file)
>      (unless (file-directory-p file)
>        (format "- [[%s][%s]]" (file-name-sans-extension file) file)))
>    (directory-files (or default-directory
>                         (file-name-directory (buffer-file-name))))
>    "\n")
> #+end_src
> --8<---------------cut here---------------end--------------->8---
> 
> Does this solve your requirement?
> 
> Cheers -- Eric
> 
> Manuel Giraud <manuel.giraud@univ-nantes.fr> writes:
> 
>> Hi, 
>>
>> I'd like to set up a simple blog (with static page only) using emacs. So
>> far, I was able to use emacs-muse based on the following instructions:
>> http://alexott.net/en/writings/EmacsMuseMyPage.html
>> http://www.diale.org/muse-functions.html
>>
>> Now, I'd like to give org-publish a try because it seems to provide nice
>> features (and i'm already using org-mode as an agenda anyway).  So far
>> so good I can publish entries, but I can't find a way to produce an
>> index of all the entries sorted by date.
>>
>> With muse, i created a file with a <lisp></lisp> block to call the
>> function muse-index-as-string-sort-by-date and this call insert the
>> updated index in place.
>>
>> Now I'd like to do something similar using org-mode babel feature, but
>> if i try this:
>> ---8<-----
>> #+BEGIN_SRC emacs-lisp :results output :exports results
>>   (list "[[bar][1]]" "[[foo][2]]")
>> #+END_SRC
>> ---8<-----
>>
>> The content appears as a code snippet in the html export which is not
>> exactly what I want. How can I do this? Am I misleaded because
>> org-publish already provide this?
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

-- 
http://pere.quintanasegui.com


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please 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] 10+ messages in thread

* Re: Babel for blogging
  2010-10-15 17:44   ` Pere Quintana Seguí
@ 2010-10-15 20:32     ` Eric Schulte
  2010-10-15 22:13       ` Pere Quintana Seguí
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Schulte @ 2010-10-15 20:32 UTC (permalink / raw)
  To: Pere Quintana Seguí; +Cc: emacs-orgmode

this approach might be less appropriate for RSS, mainly because code
block output is most easily contained in an Org-mode file, and then
exported along with the rest of the file.  RSS files require special
headers and footers and can not be embedded in a standard html file, you
may be better off looking for an external tool to handle the generation
of RSS content.

Best -- Eric

Pere Quintana Seguí <pere@quintanasegui.com> writes:

> Thanks for the tip Eric, I'll use it to create a sitemap for my site,
> which is made using org-mode.
>
> Do you know if it would be possible to create an RSS file, using a
> similar approach?
>
> Thanks,
>
> Pere
>
> Al 15/10/10 19:07, En/na Eric Schulte ha escrit:
>> Hi Manuel,
>> 
>> The following works for me, it creates an index of all files in the same
>> directory as the Org-mode file.
>> 
>> --8<---------------cut here---------------start------------->8---
>> * index
>> 
>> Create an index automatically with an elisp code block.
>> 
>> #+begin_src emacs-lisp :exports results :results raw
>>   (mapconcat
>>    (lambda (file)
>>      (unless (file-directory-p file)
>>        (format "- [[%s][%s]]" (file-name-sans-extension file) file)))
>>    (directory-files (or default-directory
>>                         (file-name-directory (buffer-file-name))))
>>    "\n")
>> #+end_src
>> --8<---------------cut here---------------end--------------->8---
>> 
>> Does this solve your requirement?
>> 
>> Cheers -- Eric
>> 
>> Manuel Giraud <manuel.giraud@univ-nantes.fr> writes:
>> 
>>> Hi, 
>>>
>>> I'd like to set up a simple blog (with static page only) using emacs. So
>>> far, I was able to use emacs-muse based on the following instructions:
>>> http://alexott.net/en/writings/EmacsMuseMyPage.html
>>> http://www.diale.org/muse-functions.html
>>>
>>> Now, I'd like to give org-publish a try because it seems to provide nice
>>> features (and i'm already using org-mode as an agenda anyway).  So far
>>> so good I can publish entries, but I can't find a way to produce an
>>> index of all the entries sorted by date.
>>>
>>> With muse, i created a file with a <lisp></lisp> block to call the
>>> function muse-index-as-string-sort-by-date and this call insert the
>>> updated index in place.
>>>
>>> Now I'd like to do something similar using org-mode babel feature, but
>>> if i try this:
>>> ---8<-----
>>> #+BEGIN_SRC emacs-lisp :results output :exports results
>>>   (list "[[bar][1]]" "[[foo][2]]")
>>> #+END_SRC
>>> ---8<-----
>>>
>>> The content appears as a code snippet in the html export which is not
>>> exactly what I want. How can I do this? Am I misleaded because
>>> org-publish already provide this?
>> 
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please 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] 10+ messages in thread

* Re: Babel for blogging
  2010-10-15 20:32     ` Eric Schulte
@ 2010-10-15 22:13       ` Pere Quintana Seguí
  2010-10-16 17:17         ` Olivier Schwander
  0 siblings, 1 reply; 10+ messages in thread
From: Pere Quintana Seguí @ 2010-10-15 22:13 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 685 bytes --]



Al 15/10/10 22:32, En/na Eric Schulte ha escrit:
> this approach might be less appropriate for RSS, mainly because code
> block output is most easily contained in an Org-mode file, and then
> exported along with the rest of the file.  RSS files require special
> headers and footers and can not be embedded in a standard html file, you
> may be better off looking for an external tool to handle the generation
> of RSS content.

Thanks. I think I'll try to create a python script that takes the dates
of the html files in a folder and takes the title from the first line of
each .org file and then creates the RSS. It might work.

-- 
http://pere.quintanasegui.com


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please 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] 10+ messages in thread

* Re: Babel for blogging
  2010-10-15 17:07 ` Eric Schulte
  2010-10-15 17:44   ` Pere Quintana Seguí
@ 2010-10-15 23:03   ` Eric S Fraga
  2010-10-18 14:22     ` Manuel Giraud
  1 sibling, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2010-10-15 23:03 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode, Manuel Giraud

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

On Fri, 15 Oct 2010 11:07:05 -0600, "Eric Schulte" <schulte.eric@gmail.com> wrote:
> 
> Hi Manuel,
> 
> The following works for me, it creates an index of all files in the same
> directory as the Org-mode file.
> 
> --8<---------------cut here---------------start------------->8---
> * index
> 
> Create an index automatically with an elisp code block.
> 
> #+begin_src emacs-lisp :exports results :results raw
>   (mapconcat
>    (lambda (file)
>      (unless (file-directory-p file)
>        (format "- [[%s][%s]]" (file-name-sans-extension file) file)))
>    (directory-files (or default-directory
>                         (file-name-directory (buffer-file-name))))
>    "\n")
> #+end_src
> --8<---------------cut here---------------end--------------->8---

Maybe the format statement should look like this instead (swap the two
arguments to the format string around):

:   (format "- [[%s][%s]]" file (file-name-sans-extension file))))

Also, maybe change the link to include the current directory:

:   (format "- [[./%s][%s]]" file (file-name-sans-extension file))))

Just some thoughts late on a Friday night... ;-)

[-- Attachment #2: Type: text/plain, Size: 75 bytes --]

-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please 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] 10+ messages in thread

* Re: Babel for blogging
  2010-10-15 22:13       ` Pere Quintana Seguí
@ 2010-10-16 17:17         ` Olivier Schwander
  0 siblings, 0 replies; 10+ messages in thread
From: Olivier Schwander @ 2010-10-16 17:17 UTC (permalink / raw)
  To: emacs-orgmode

Le 16 Oct 2010 00:13, Pere Quintana Seguí a écrit:
> Al 15/10/10 22:32, En/na Eric Schulte ha escrit:
> > this approach might be less appropriate for RSS, mainly because code
> > block output is most easily contained in an Org-mode file, and then
> > exported along with the rest of the file.  RSS files require special
> > headers and footers and can not be embedded in a standard html file, you
> > may be better off looking for an external tool to handle the generation
> > of RSS content.
> 
> Thanks. I think I'll try to create a python script that takes the dates
> of the html files in a folder and takes the title from the first line of
> each .org file and then creates the RSS. It might work.

There is already org-atom, which is able to generate Atom feeds from an org-file :
<http://ictsoc.de/code/org-atom.html>. I use it extensively for a little
blog-like static website.

It's only for Atom, not for RSS, but I am not sure there is a point to
focus on some particular format.

Cheers,

Olivier

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

* Re: Babel for blogging
  2010-10-15 23:03   ` Eric S Fraga
@ 2010-10-18 14:22     ` Manuel Giraud
  2010-10-18 21:36       ` Sebastian Rose
  0 siblings, 1 reply; 10+ messages in thread
From: Manuel Giraud @ 2010-10-18 14:22 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Eric S Fraga <ucecesf@ucl.ac.uk> writes:

> On Fri, 15 Oct 2010 11:07:05 -0600, "Eric Schulte" <schulte.eric@gmail.com> wrote:
>> 
>> Hi Manuel,
>> 
>> The following works for me, it creates an index of all files in the same
>> directory as the Org-mode file.
>> 
>> --8<---------------cut here---------------start------------->8---
>> * index
>> 
>> Create an index automatically with an elisp code block.
>> 
>> #+begin_src emacs-lisp :exports results :results raw
>>   (mapconcat
>>    (lambda (file)
>>      (unless (file-directory-p file)
>>        (format "- [[%s][%s]]" (file-name-sans-extension file) file)))
>>    (directory-files (or default-directory
>>                         (file-name-directory (buffer-file-name))))
>>    "\n")
>> #+end_src
>> --8<---------------cut here---------------end--------------->8---
>
> Maybe the format statement should look like this instead (swap the two
> arguments to the format string around):
>
> :   (format "- [[%s][%s]]" file (file-name-sans-extension file))))
>
> Also, maybe change the link to include the current directory:
>
> :   (format "- [[./%s][%s]]" file (file-name-sans-extension file))))
>
> Just some thoughts late on a Friday night... ;-)

Thanks that does the trick. But searching the org-mode source (version
7.01trans) , I discovered that this function is already here (called
sitemap instead of index). So now, I can generate the correct sitemap
with the following project:

--8<---------------cut here---------------end--------------->8---
(setq org-publish-project-alist
      '(("orgfiles"
         :base-directory "~/org/"
         :base-extension "org"
         :publishing-directory "~/public_html/"
         :publishing-function org-publish-org-to-html
         :section-numbers nil
         :table-of-contents nil
         :auto-sitemap t
         :sitemap-title "Blog"
         :style "<link rel=\"stylesheet\"
                     href=\"blog.css\"
                     type=\"text/css\"/>")
        ("css"
         :base-directory "~/org/"
         :base-extension "css"
         :publishing-directory "~/public_html/"
         :publishing-function org-publish-attachment)
        ("blog" :components ("orgfiles" "css"))))
--8<---------------cut here---------------end--------------->8---

What's missing now is that the sitemap list is ordered alphabetically
and I'd like to have it sorted by modification time or, even better, by
there #+date tag.

-- 
Manuel Giraud

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

* Re: Babel for blogging
  2010-10-18 14:22     ` Manuel Giraud
@ 2010-10-18 21:36       ` Sebastian Rose
  2010-10-20 17:09         ` Manuel Giraud
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Rose @ 2010-10-18 21:36 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: emacs-orgmode

Manuel Giraud <manuel.giraud@univ-nantes.fr> writes:
> Eric S Fraga <ucecesf@ucl.ac.uk> writes:
>
>> On Fri, 15 Oct 2010 11:07:05 -0600, "Eric Schulte" <schulte.eric@gmail.com> wrote:
>>> 
>>> Hi Manuel,
>>> 
>>> The following works for me, it creates an index of all files in the same
>>> directory as the Org-mode file.
>>> 
>>> --8<---------------cut here---------------start------------->8---
>>> * index
>>> 
>>> Create an index automatically with an elisp code block.
>>> 
>>> #+begin_src emacs-lisp :exports results :results raw
>>>   (mapconcat
>>>    (lambda (file)
>>>      (unless (file-directory-p file)
>>>        (format "- [[%s][%s]]" (file-name-sans-extension file) file)))
>>>    (directory-files (or default-directory
>>>                         (file-name-directory (buffer-file-name))))
>>>    "\n")
>>> #+end_src
>>> --8<---------------cut here---------------end--------------->8---
>>
>> Maybe the format statement should look like this instead (swap the two
>> arguments to the format string around):
>>
>> :   (format "- [[%s][%s]]" file (file-name-sans-extension file))))
>>
>> Also, maybe change the link to include the current directory:
>>
>> :   (format "- [[./%s][%s]]" file (file-name-sans-extension file))))
>>
>> Just some thoughts late on a Friday night... ;-)
>
> Thanks that does the trick. But searching the org-mode source (version
> 7.01trans) , I discovered that this function is already here (called
> sitemap instead of index). So now, I can generate the correct sitemap
> with the following project:
>
>
> (setq org-publish-project-alist
>       '(("orgfiles"
>          :base-directory "~/org/"
>          :base-extension "org"
>          :publishing-directory "~/public_html/"
>          :publishing-function org-publish-org-to-html
>          :section-numbers nil
>          :table-of-contents nil
>          :auto-sitemap t
>          :sitemap-title "Blog"
>          :style "<link rel=\"stylesheet\"
>                      href=\"blog.css\"
>                      type=\"text/css\"/>")
>         ("css"
>          :base-directory "~/org/"
>          :base-extension "css"
>          :publishing-directory "~/public_html/"
>          :publishing-function org-publish-attachment)
>         ("blog" :components ("orgfiles" "css"))))
>
> What's missing now is that the sitemap list is ordered alphabetically
> and I'd like to have it sorted by modification time or, even better, by
> there #+date tag.


It's there, too.

See 

  C-h v org-publish-project-alist


"
    If you create a sitemap file, adjust the sorting like this:

      :sitemap-sort-folders    Where folders should appear in the
                               sitemap. Set this to `first' (default) or
                               `last' to display folders first or last,
                               respectively. Any other value will mix
                               files and folders. 
      :sitemap-alphabetically  The site map is normally sorted
                               alphabetically. Set this explicitly to
                               nil to turn off sorting. 
      :sitemap-ignore-case     Should sorting be case-sensitive?
                               Default nil. 
"



Sebastian

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

* Re: Babel for blogging
  2010-10-18 21:36       ` Sebastian Rose
@ 2010-10-20 17:09         ` Manuel Giraud
  0 siblings, 0 replies; 10+ messages in thread
From: Manuel Giraud @ 2010-10-20 17:09 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: emacs-orgmode

Sebastian Rose <sebastian_rose@gmx.de> writes:

> It's there, too.
>
> See 
>
>   C-h v org-publish-project-alist
>
>
> "
>     If you create a sitemap file, adjust the sorting like this:
>
>       :sitemap-sort-folders    Where folders should appear in the
>                                sitemap. Set this to `first' (default) or
>                                `last' to display folders first or last,
>                                respectively. Any other value will mix
>                                files and folders. 
>       :sitemap-alphabetically  The site map is normally sorted
>                                alphabetically. Set this explicitly to
>                                nil to turn off sorting. 

Yes. But if you set this to nil it doesn't sort by time. I'll look if I
can provide a patch.

-- 
Manuel Giraud

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

end of thread, other threads:[~2010-10-20 17:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-15 16:07 Babel for blogging Manuel Giraud
2010-10-15 17:07 ` Eric Schulte
2010-10-15 17:44   ` Pere Quintana Seguí
2010-10-15 20:32     ` Eric Schulte
2010-10-15 22:13       ` Pere Quintana Seguí
2010-10-16 17:17         ` Olivier Schwander
2010-10-15 23:03   ` Eric S Fraga
2010-10-18 14:22     ` Manuel Giraud
2010-10-18 21:36       ` Sebastian Rose
2010-10-20 17:09         ` Manuel Giraud

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