[GeneralDiscussion] Re: zope/plone article

[email protected] (Niall Douglas) Tue, 03 Mar 2009 01:45:10 -0800
Newsgroups gmane.comp.web.zope.zwiki
Message-ID <49ACFC1D.27130.CB76E__5991.95921463451$1236073610$gmane$org@s_sourceforge.nedprod.com>
It would appear that it ignores replies unless subscribed ...

------- Forwarded message follows -------
From:           	Niall Douglas <[email protected]>
To:             	[email protected]
Subject:        	Re: [GeneralDiscussion] Re: zope/plone article
Date sent:      	Mon, 02 Mar 2009 14:07:07 -0000

On 1 Mar 2009 at 10:25, Simon Michael wrote:

> Hi Niall.. thanks for the feedback, it is useful. I'll take this to  
> zwiki.org if you don't mind.

If you could use the s_sourceforge@ email when on public discussions 
that 
would be great. The niall@ is for non public use only (to avoid 
spam).

> > I'd personally absolutely love if the page URL showed the ZWiki page  
> > hierarchy. Much more SEO friendly in particular.
> 
> Ah, that's how most sites do it but I really dislike it (overall). It  
> becomes much less attractive to rearrange your hierarchy, because your  
> links break. And it's much harder to remember and guess urls for  
> pages. Why are deep urls more SEO friendly ?

One of the big reasons that I like Plone is that it displays a 
reasonable 
full page URL rather than a "?Content=1964" or whatever. I know it's 
a 
matter of personal taste, but when you move content within a 
hierarchy you 
*want* the link to break to indicate the new hierarchy. That's what 
301 
response codes are for - to indicate permanently moved content.

My preference isn't so much of an issue on a Zwiki-only site but 
rather 
when running from within Plone - one has a clearly obvious Plone 
hierarchy 
in the navigation pane and Plone follows a hierarchy so one is used 
to it. 
There is a *lot* going on in the default Plone view and I find that 
the 
Zwiki hierarchy information gets "lost" within all the detail. 
Therefore, I 
find myself glancing at the URL hoping for some clues and not a lot 
is to 
be found.

> > I'll tell you why I wanted the dtml ... I am trying to create a master
> > include page which defines a long list of external links to sites  
> > all over
> > the internet. I then want to include that master include page into  
> > each and
> > every Zwiki page such that they can then refer to the links without  
> > having
> > to define them in each and every page. My intent is that updating
> > masterinclude therefore updates all Zwiki links at once.
> >
> > This is effectively http://zwiki.org/IncludeOrTransclude. I had  
> > originally
> > hoped that restructured text's include:: directive would work but
> > unfortunately it has been disabled. I then got the dtml working via  
> > <dtml-
> > var "include('Masterinclude')">, but unfortunately this appears to  
> > run the
> > REST processor per included file and therefore the links don't  
> > transfer.
> >
> > Is there any way for me to accomplish what I want?
> 
> For sure. You can call any of Zwiki's public methods, so eg dtml-var  
> "pageWithName('Masterinclude').read()" would get just the text without  
> any formatting or wiki-linking. But maybe http://zwiki.org/RemoteWikiLinks 
>   will do what you want ?

No, I find RemoteWikiLinks ugly because they require a prefix before 
every 
remote wiki link. I tried embedding the remotewikilink into a RST 
link but 
they aren't parsed.

I have been ploughing through the Zwiki source and page rendition 
certainly 
looks convoluted (mostly due to Plone from what I gather).   
/portal_skins/zwiki/content.pt seems to invoke <div 
tal:replace="structure 
python:here.talsafe(options['body'])"> which as far as I can tell 
instructs 
Plone to go fetch the body of the page via main_template.

This eventually ends back up in ZWikiPage.__call__() which calls 
self.preRender() which does:

    def preRender(self, page, text=None):
        t = text or (page.document()+'\n'+MIDSECTIONMARKER+ \
                     self.preRenderMessages(page))
        t = page.applyWikiLinkLineEscapesIn(t)
        t = self.format(t)
        t = page.markLinksIn(t,urls=0)
        t = self.protectEmailAddresses(page,t)
        return t

AFAICS, dtml is passed through untouched into the prerender output 
and is 
then executed *separately* i.e. AFTER the PageTypeRst processing 
stage. 
Therefore, if I include one RST file into another via dtml, they are 
processed separately and therefore links in one cannot be used by the 

other.

Given this, the only way I can see round the problem is to have every 
page 
have no content except for a dtml directive which then glues together 
the 
RST text from another two separate pages and spits out its rendition. 
This 
obviously isn't ideal, yet I can't see much option without modifying 
the 
source code?

Is there any way to hook oneself into the prerender stage e.g. 
overload the 

PageTypeRst.format() method?

One simple and easy solution is to hack in a RST options 
file_insertion_enabled=True somehow. I think though that RST 
inclusions 
would then use the filesystem rather than the ZODB yes? That actually 

doesn't bother me - how would I insert this change from the ZMI/DTML 
rather 

than modifying source?

Thanks in advance,
Niall

------- End of forwarded message -------


--
forwarded from http://zwiki.org/GeneralDiscussion#msg49ACFC1D.27130.CB76E@s_sourceforge.nedprod.com