From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [patch] Terminating lists by indentation of #+SPECIALS too Date: Wed, 21 Apr 2010 09:59:15 +0200 Message-ID: References: <877ho4e56t.fsf@gmx.de> <87zl10co57.fsf@gmx.de> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4UqB-0001me-2v for emacs-orgmode@gnu.org; Wed, 21 Apr 2010 03:59:23 -0400 Received: from [140.186.70.92] (port=52145 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4Uq8-0001lP-Mr for emacs-orgmode@gnu.org; Wed, 21 Apr 2010 03:59:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4Uq6-0002kQ-TN for emacs-orgmode@gnu.org; Wed, 21 Apr 2010 03:59:20 -0400 Received: from mail-ew0-f214.google.com ([209.85.219.214]:57130) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4Uq6-0002k3-KC for emacs-orgmode@gnu.org; Wed, 21 Apr 2010 03:59:18 -0400 Received: by ewy6 with SMTP id 6so2329050ewy.32 for ; Wed, 21 Apr 2010 00:59:17 -0700 (PDT) In-Reply-To: <87zl10co57.fsf@gmx.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastian Rose Cc: Emacs-orgmode mailing list Hi Sebastian, I am not sure I understand this patch fully. And it looks to me that this should be taken care of in `org-export-html-close-list-maybe'. Could you take another look and check if this could be easily moved into there? I am confused why this is inside the when clause about protectedness of the line. But I may have just lost my memory of how this works.... - Carsten On Apr 19, 2010, at 1:54 AM, Sebastian Rose wrote: > Haaarrrgh --- > > > the first patch in my previous mail does not work for all cases. Hairy > stuff.... > > > Here's what did _not_ work with my previous patch: > > #+html:
> *Unsorted Patterns* > - a > - b > - c > #+HTML:
Somthing inside the last item!!! > #+HTML:
> > > > > > But this one finally works: > > > diff --git a/lisp/org-html.el b/lisp/org-html.el > index fcddd50..0174e43 100644 > --- a/lisp/org-html.el > +++ b/lisp/org-html.el > @@ -929,6 +929,17 @@ lang=\"%s\" xml:lang=\"%s\"> > > ;; Protected HTML > (when (get-text-property 0 'org-protected line) > + (when in-local-list > + (let ((ind (org-get-indentation line))) > + (while (and (car local-list-indent) (< ind (car local- > list-indent))) > + (org-close-li (car local-list-type)) > + (insert (format "\n" (car local-list-type))) > + (setq local-list-indent (cdr local-list-indent)) > + (setq local-list-type (cdr local-list-type)) > + (setq in-local-list local-list-indent)) > + (insert line "\n") > + (throw 'nextline nil))) > + > (let (par (ind (get-text-property 0 'original-indentation line))) > (when (re-search-backward > "\\(

\\)\\([ \t\r\n]*\\)\\=" (- (point) 100) t) > > > Again: If it makes things easier, I could apply the change to the > master > branch and send an appropriate patch. > > > > > > Sebastian > > > > > > > Sebastian Rose writes: >> Hello Carsten, >> >> >> there was much discussion about a terminator and I ran into a >> problem, >> that made me think we need one. But then I found we had one --- it's >> just not used on HTML export. >> >> >> Below is a little file I wrote. Thanks to the `- __' items, it >> results >> in the XHTML closely to what I wanted it to. >> But only as long as I use those _undocumented_ `- __' items. Once you >> remove them, you'll see, that the `#+html: > inside the last list item and the XHTML will not validate. >> >> >> As I looked at it, I found the most natural solution would be, to >> terminate the list by regarding the indentation of `#+WHATEVER' and >> `#+BEGIN_WHATEVER' if inside lists [fn:1]. >> >> >> >> The patch below (diffed against `remove-compatibility-code') makes >> XHTML-export honor the indentation of `#+SPECIALS'. >> >> >> >> Here's the Org-file I wrote (remove and add the `- __' list items >> to see >> the effect): >> >> >> #+OPTIONS: toc:nil >> #+STYLE: >> >> * List of design patterns >> >> #+HTML:

>> *Behavioural Patterns* >> - [[file:BatchCommand][BatchCommand]] >> - [[file:ChainOfResponsibility.org][Chain Of Responsibility]] >> - [[file:Command.org][Command]], UndoableCommand and BatchCommand >> - [[file:Interpreter.org][Interpreter]] >> - [[file:Iterator.org][Iterator]] >> - [[file:Mediator.org][Mediator]] >> - [[file:Memento.org][Memento]] >> - [[file:NullObject][NullObject]] >> - [[file:Observer.org][Observer]] >> - [[file:State.org][State]] >> - [[file:Strategy.org][Strategy]] >> - [[file:TemplateMethod.org][Template Method]] >> - [[file:Visitor.org][Visitor]] >> *Creational Patterns* >> - [[file:AbstractFactory.org][Abstract Factory]] >> - [[file:Builder.org][Builder]] >> - [[file:Factory.org][Factory]] >> - [[file:FactoryMethod.org][Factory Method]] >> - [[file:Prototype.org][Prototype]] >> - [[file:Singleton.org][Singleton]] >> - __ >> #+html:
>> #+html:
>> *Structural Patterns* >> - [[file:Adapter.org][Adapter]] >> - [[file:Composite.org][Composite]] >> - [[file::Bridge.org][Bridge]] >> - [[file:Decorator.org][Decorator]] >> - [[file:Facade.org][Facade]] >> - [[file:Flyweight.org][Flyweight]] >> - [[file:Proxy.org][Proxy]] >> *Unsorted* >> - [[file:BusinessDelegate.org][Business Delegate]] >> - [[file:DataAccessObject.org][Data Access Object]] >> - [[file:DataTransferObject.org][Data Transfer Object]] >> - [[file:DependencyInjection.org][Dependency Injection]] >> - [[file:FluentInterface.org][Fluent Interface]] >> - [[file:InversionOfControl.org][Inversion Of Control]] >> - [[file:ModelViewControler.org][Model View Controler]] >> - [[file:ModelViewPresenter.org][Model View Presenter]] >> - [[file:Plugin.org][Plugin]] >> - __ >> #+HTML:
>> >> >> >> And, finally, the patch. I would have used the function >> `org-export-html-close-lists-maybe' but that didn't work, so I wrote >> similar code just in place. >> >> Carsten: If it makes things easier for you, I could apply the >> change to >> the master branch and send an appropriate patch. >> >> >> diff --git a/lisp/org-html.el b/lisp/org-html.el >> index fcddd50..812e63c 100644 >> --- a/lisp/org-html.el >> +++ b/lisp/org-html.el >> @@ -929,6 +929,15 @@ lang=\"%s\" xml:lang=\"%s\"> >> >> ;; Protected HTML >> (when (get-text-property 0 'org-protected line) >> + (when in-local-list >> + (let ((ind (or (get-text-property 0 'original- >> indentation line) 0))) >> + (while (and (car local-list-indent) (< ind (car local- >> list-indent))) >> + (org-close-li (car local-list-type)) >> + (insert (format "\n" (car local-list-type))) >> + (setq local-list-indent (cdr local-list-indent)) >> + (setq local-list-type (cdr local-list-type)) >> + (setq in-local-list local-list-indent)))) >> + >> (let (par (ind (get-text-property 0 'original-indentation >> line))) >> (when (re-search-backward >> "\\(

\\)\\([ \t\r\n]*\\)\\=" (- (point) 100) t) >> >> >> >> >> >> Best wishes >> >> Sebastian >> >> >> >> >> Footnotes: >> >> [fn:1] `org-end-of-item' and `org-end-of-item-list' already >> consider the >> decreased indentation of the `#+html:' line the end of the >> list. >> >> You can proof that by deleting the last dot and all empty >> lines, >> so that the `#+html:' line is directly below the last list >> item. Then move point somewhere on the item and do `M-x >> org-end-of-item RET'. >> >> _______________________________________________ >> 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 > _______________________________________________ > 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 - Carsten