Sorry to bother the list again about this topic, but there is a bug in the 
function I posted.  The function should read:

(defun my-muse-publish-muse-links-map ()
  "Map every link target with a \".muse\"
file extension contained in a muse link to a link target with a
\".html\" extension.  The function applies to the current buffer."
  (goto-char (point-min))
  (while (search-forward ".muse][" nil t)
    (replace-match ".html][" t t nil nil))

  (goto-char (point-min))
  (while (search-forward ".muse]]" nil t)
    (replace-match ".html]]" t t nil nil))

  (goto-char (point-min))
  (while (search-forward ".muse#"  nil t)
    (replace-match ".html#" t t nil nil)))

In the original version the second "(goto-char (point-min))" was missing.

Kind regards Stefan

--- On Tue, 2/9/10, Stefan Schlee <[email protected]> wrote:

> From: Stefan Schlee <[email protected]>
> Subject: Re: [Muse-el-discuss] multiple publish directory problem
> To: [email protected], "Discussion and help for Emacs Muse" 
> <[email protected]>
> Date: Tuesday, February 9, 2010, 4:59 PM
> Hello!
> 
> I experienced a similar problem last summer and I was just
> about to reply to your problem.  
> 
> In my project all my links contain the file extension
> ".muse".  I have not found a setting that would
> accomplish a correct publishing for this case.  To
> generate correct links to html-files I explicitly rewrite
> all the links before publishing .    I added a
> somewhat crude hack to my project file
> (`my-muse-publish-muse-links-map) which performs this
> task.   This hack may be polished up by using
> a somewhat more specific regular expression.  But it
> works for me for the time being.  
> 
> As far as I understand the solution that I apply is
> somewhat more general purpose, because the code works for
> any directory structure withouth modification.
> 
> When I have enough time I will look into the muse code to
> provide a more pleasant way to deal with this issue.
> 
> The test project that demonstrates the hack is contained in
> the attached tar.gz-file.  Proceed as described in
> "test-init.el" file.
> 
> Kind regards Stefan
> 
> --- On Tue, 2/9/10, Baranyi Péter <[email protected]>
> wrote:
> 
> > From: Baranyi Péter <[email protected]>
> > Subject: Re: [Muse-el-discuss] multiple publish
> directory problem
> > To: "Discussion and help for Emacs Muse" <[email protected]>
> > Date: Tuesday, February 9, 2010, 11:34 AM
> > Hi again, 
> > 
> > and thanks for your help, but I found it easier to
> just
> > write a
> > before-end publish hook, which rewrites html links in
> the
> > second
> > directory. Problem solved.
> > 
> > (muse-derive-style "html-one" "html"
> >                
> >    :maintainer "[email protected]")
> > 
> > (muse-derive-style "html-two" "html"
> >                
> >    :maintainer "[email protected]"
> >        
> >    :before-end
> >
> 'my-muse-rewrite-html-links-to-point-to-same-directory
> > )
> > 
> > (defun
> > my-muse-rewrite-html-links-to-point-to-same-directory
> ()
> >   "rewrite links in current buffer: <a
> > href=\"../one/PageOne.html\"> -> <a
> > href=\"PageOne.html\">"
> >   (goto-char (point-min))
> >   (while
> >       (re-search-forward "<a
> > href=\"../one/" nil t)
> >     (replace-match "")
> >     (muse-insert-markup "<a href=\"")
> > ))
> > 
> > 
> > 
> > On Mon, 2010-02-08 at 08:27 +0100, Alex Ott wrote:
> > > Hello
> > > 
> > > Baranyi Péter  at "Sun, 07 Feb 2010 23:37:18
> > +0100" wrote:
> > >  BP> Thank you for your comments but
> > unfortunately this does not work for me.
> > >  BP> I changed the index page to:
> > > 
> > >  BP>  - [[PageOne]]
> > >  BP>  - [[PageTwo]]
> > >  BP>  - [[./PageOne]]
> > >  BP>  - [[./PageTwo]]
> > > 
> > >  BP> and all links still point to the one
> > directory:
> > > 
> > >  BP> <a
> > href="../one/PageOne.html">./PageOne</a>
> > > 
> > >  BP> But interestingly, if i use a
> > [[./PageOne]] to a muse source file that
> > >  BP> is in another directory, then the
> result
> > is:
> > > 
> > >  BP> <a
> > href="./PageOne">./PageOne</a>
> > > 
> > >  BP> So it works in this case but the file
> > extension is missing. Any help
> > >  BP> please?
> > > 
> > > The main idea, that you should use relative file
> > names, instead of just
> > > page names.  For example, to point to file in
> > other directory, you need to
> > > put name like [[../other-dir/File]], etc.  You
> > can look to sources of my
> > > site - http://alexott.net, if you'll replace .html with
> .muse,
> > then you'll
> > > see source code of it
> > > 
> > -- 
> > Baranyi Péter <[email protected]>
> > 
> > 
> > _______________________________________________
> > Muse-el-discuss mailing list
> > [email protected]
> > https://mail.gna.org/listinfo/muse-el-discuss
> >
> 
> 
>       
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> Muse-el-discuss mailing list
> [email protected]
> https://mail.gna.org/listinfo/muse-el-discuss
> 


      

_______________________________________________
Muse-el-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/muse-el-discuss

Reply via email to