Browse Source

Terminating lists by indentation of #+SPECIALS too

Sebastien Rose writes:

> 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: </div...' stuff ends up
> 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: <style type="text/css">
> #+STYLE: body,p,div,td{font-size:13px;font-family:sans-serif;}
> #+STYLE: div { text-align:left; }
> #+STYLE: #content {width:550px;
> #+STYLE:     margin-left:auto;margin-right:auto;text-align:center; }
> #+STYLE: #postamble { width:550px;clear:both;border-top:1px solid black;
> #+STYLE:      margin-left:auto;margin-right:auto;text-align:center; }
> #+STYLE: </style>
>
> * List of design patterns
>
>  #+HTML: <div style="width:48%;float:left;">
>  *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: </div>
>  #+html: <div style="width:48%;float:right;">
>  *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: </div>
Carsten Dominik 15 years ago
parent
commit
816ff72306
2 changed files with 15 additions and 4 deletions
  1. 7 0
      lisp/ChangeLog
  2. 8 4
      lisp/org-html.el

+ 7 - 0
lisp/ChangeLog

@@ -1,3 +1,10 @@
+2010-04-22  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-html.el (org-export-as-html): Treat verse as open/close
+	paragraph.
+	(org-export-html-close-lists-maybe): Allow to splice raw HTML into
+	and out of lists.
+
 2010-04-21  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-src.el (org-edit-src-find-region-and-lang): Test for

+ 8 - 4
lisp/org-html.el

@@ -959,10 +959,12 @@ lang=\"%s\" xml:lang=\"%s\">
 	  (when (equal "ORG-VERSE-START" line)
 	    (org-close-par-maybe)
 	    (insert "\n<p class=\"verse\">\n")
+	    (setq org-par-open t)
 	    (setq inverse t)
 	    (throw 'nextline nil))
 	  (when (equal "ORG-VERSE-END" line)
 	    (insert "</p>\n")
+	    (setq org-par-open nil)
 	    (org-open-par)
 	    (setq inverse nil)
 	    (throw 'nextline nil))
@@ -1996,10 +1998,12 @@ If there are links in the string, don't modify these."
 (defvar local-list-indent)
 (defvar local-list-type)
 (defun org-export-html-close-lists-maybe (line)
-  (let ((ind (or (get-text-property 0 'original-indentation line)))
-;		 (and (string-match "\\S-" line)
-;		      (org-get-indentation line))))
-	didclose)
+  (let* ((rawhtml (and in-local-list
+		       (get-text-property 0 'org-protected line)))
+         (ind (if rawhtml
+		  (org-get-indentation line)
+		(or (get-text-property 0 'original-indentation line))))
+	 didclose)
     (when ind
       (while (and in-local-list
 		  (<= ind (car local-list-indent)))