Browse Source

Merge branch 'master' of orgmode.org:org-mode

Bastien Guerry 12 years ago
parent
commit
4757c5c8dd
5 changed files with 105 additions and 70 deletions
  1. 39 40
      doc/org.texi
  2. 20 14
      lisp/ob-perl.el
  3. 2 0
      lisp/org.el
  4. 37 10
      lisp/ox-latex.el
  5. 7 6
      lisp/ox-org.el

+ 39 - 40
doc/org.texi

@@ -10470,14 +10470,18 @@ A date or a time-stamp@footnote{The variable
 exported.}.
 
 @item DESCRIPTION
-The page description, e.g., for the XHTML meta tag.
+The document description.  Back-ends handle it as they see fit (e.g., for the
+XHTML meta tag), if at all.  You can use several such keywords for long
+descriptions.
 
 @item EMAIL
 @vindex user-mail-address
 The email address (@var{user-mail-address}).
 
 @item KEYWORDS
-The keywords defining the contents, e.g., for the XHTML meta tag.
+The keywords defining the contents of the document.  Back-ends handle it as
+they see fit (e.g., for the XHTML meta tag), if at all.  You can use several
+such keywords if the list is long.
 
 @item LANGUAGE
 @vindex org-export-default-language
@@ -10500,7 +10504,8 @@ tag will be unconditionally excluded from the export, even if they have an
 @code{:export:} tag.
 
 @item TITLE
-The title to be shown (otherwise derived from buffer's name).
+The title to be shown (otherwise derived from buffer's name).  You can use
+several such keywords for long titles.
 @end table
 
 The @code{#+OPTIONS} keyword is a compact@footnote{If you want to configure
@@ -10581,7 +10586,8 @@ Toggle the inclusion of footnotes (@var{org-export-with-footnotes}).
 @item H:
 @vindex org-export-headline-levels
 Set the number of headline levels for export
-(@var{org-export-headline-levels}).
+(@var{org-export-headline-levels}).  Below that level, headlines are treated
+differently.  In most back-ends, they become list items.
 
 @item inline:
 @vindex org-export-with-inlinetasks
@@ -10589,7 +10595,9 @@ Toggle inclusion of inlinetasks (@var{org-export-with-inlinetasks}).
 
 @item num:
 @vindex org-export-with-section-numbers
-Toggle section-numbers (@var{org-export-with-section-numbers}).
+Toggle section-numbers (@var{org-export-with-section-numbers}).  It can also
+be set to a number @samp{n}, so only headlines at that level or above will be
+numbered.
 
 @item p:
 @vindex org-export-with-planning
@@ -10599,7 +10607,7 @@ Toggle export of planning information (@var{org-export-with-planning}).
 
 @item pri:
 @vindex org-export-with-priority
-Toggle priority cookies (@var{org-export-with-priority}).
+Toggle inclusion of priority cookies (@var{org-export-with-priority}).
 
 @item stat:
 @vindex org-export-with-statistics-cookies
@@ -10642,21 +10650,22 @@ Toggle inclusion of TODO keywords into exported text
 Toggle inclusion of tables (@var{org-export-with-tables}).
 @end table
 
+@cindex property, EXPORT_FILE_NAME
+When exporting only a subtree, each of the previous keywords@footnote{With
+the exception of @samp{SETUPFILE}.} can be overriden locally by special node
+properties.  These begin with @samp{EXPORT_}, followed by the name of the
+keyword they supplant.  For example, @samp{DATE} and @samp{OPTIONS} keywords
+become, respectively, @samp{EXPORT_DATE} and @samp{EXPORT_OPTIONS}
+properties.  Subtree export also supports the self-explicit
+@samp{EXPORT_FILE_NAME} property@footnote{There is no buffer-wide equivalent
+for this property.  The file name in this case is derived from the file
+associated to the buffer, if possible, or asked to the user otherwise.}.
+
 @cindex #+BIND
-A more general mechanism is also provided.  Indeed, Emacs variables can
-become buffer-local during export by using the BIND keyword.  Its syntax is
-@samp{#+BIND: variable value}.  This is particularly useful for in-buffer
-settings that cannot be changed using specific keywords.
-
-These settings affect all buffer's export processes.  Though, it is possible
-to override them locally when exporting only a subtree.  This is done by
-adding a headline property named after the keyword with the @samp{EXPORT_}
-prefix.  For example, @samp{DATE} and @samp{OPTIONS} keywords become,
-respectively @samp{EXPORT_DATE} and @samp{EXPORT_OPTIONS} properties.
-Subtree export also supports the self-explicit @samp{EXPORT_FILE_NAME}
-property@footnote{There is no buffer-wide equivalent for this property.  The
-file name in this case is derived from the file associated to the buffer, if
-possible, or asked to the user otherwise.}.
+Eventually, Emacs variables can become buffer-local during export by using
+the BIND keyword.  Its syntax is @samp{#+BIND: variable value}.  This is
+particularly useful for in-buffer settings that cannot be changed using
+specific keywords.
 
 @node ASCII/Latin-1/UTF-8 export, Beamer export, Export settings, Exporting
 @section ASCII/Latin-1/UTF-8 export
@@ -10961,26 +10970,15 @@ language, but with additional support for tables.
 @node HTML Export commands, HTML preamble and postamble, HTML export, HTML export
 @subsection HTML export commands
 
-@cindex region, active
-@cindex active region
-@cindex transient-mark-mode
 @table @kbd
 @orgcmd{C-c C-e h h,org-html-export-to-html}
-@cindex property, EXPORT_FILE_NAME
 Export as a HTML file.  For an Org file @file{myfile.org},
 the HTML file will be @file{myfile.html}.  The file will be overwritten
-without warning.  If there is an active region@footnote{This requires
-@var{transient-mark-mode} be turned on.}, only the region will be
-exported.  If the selected region is a single tree@footnote{To select the
-current subtree, use @kbd{C-c @@}.}, the tree head will become the document
-title.  If the tree head entry has, or inherits, an @code{EXPORT_FILE_NAME}
-property, that name will be used for the export.
+without warning.
 @kbd{C-c C-e h o}
 Export as a HTML file and immediately open it with a browser.
 @orgcmd{C-c C-e h H,org-html-export-as-html}
 Export to a temporary buffer.  Do not create a file.
-@item C-c C-e C-v h H/h h/h o
-Export only the visible part of the document.
 @end table
 
 @c FIXME Exporting sublevels
@@ -11170,7 +11168,7 @@ method requires that the @file{dvipng} program is available on your system.
 You can still get this processing with
 
 @example
-#+OPTIONS: LaTeX:dvipng
+#+OPTIONS: tex:dvipng
 @end example
 
 @node Text areas in HTML export, CSS support, Math formatting in HTML export, HTML export
@@ -11179,15 +11177,16 @@ You can still get this processing with
 @cindex text areas, in HTML
 An alternative way to publish literal code examples in HTML is to use text
 areas, where the example can even be edited before pasting it into an
-application.  It is triggered by a @code{-t} switch at an @code{example} or
-@code{src} block.  Using this switch disables any options for syntax and
-label highlighting, and line numbering, which may be present.  You may also
-use @code{-h} and @code{-w} switches to specify the height and width of the
-text area, which default to the number of lines in the example, and 80,
-respectively.  For example
+application.  It is triggered by @code{:textarea} attribute at an
+@code{example} or @code{src} block.
+
+You may also use @code{:height} and @code{:width} attributes to specify the
+height and width of the text area, which default to the number of lines in
+the example, and 80, respectively.  For example
 
 @example
-#+BEGIN_EXAMPLE -t -w 40
+#+ATTR_HTML: :textarea t :width 40
+#+BEGIN_EXAMPLE
   (defun org-xor (a b)
      "Exclusive or."
      (if a (not b) b))

+ 20 - 14
lisp/ob-perl.el

@@ -101,9 +101,9 @@ specifying a var of the same value."
         %s
     };
     open my $BOH, qq(>%s) or die qq(Perl: Could not open output file.$/);
-    select $BOH;
     my $rv = &$babel_sub();
     my $rt = ref $rv;
+    select $BOH;
     if (qq(ARRAY) eq $rt) {
         local $\\=$/;
         local $,=qq(\t);
@@ -131,19 +131,25 @@ If RESULT-TYPE equals 'output then return a list of the outputs
 of the statements in BODY, if RESULT-TYPE equals 'value then
 return the value of the last statement in BODY, as elisp."
   (when session (error "Sessions are not supported for Perl"))
-  (let ((body (concat org-babel-perl-preface ibody)))
-    (case result-type
-      (output (org-babel-eval org-babel-perl-command body))
-      (value (let ((tmp-file (org-babel-temp-file "perl-")))
-	       (org-babel-eval
-		org-babel-perl-command
-		(format org-babel-perl-wrapper-method body
-			(org-babel-process-file-name tmp-file 'noquote)))
-	       	(org-babel-result-cond result-params
-		  (with-temp-buffer
-		    (insert-file-contents tmp-file)
-		    (buffer-string))
-		  (org-babel-import-elisp-from-file tmp-file '(16))))))))
+  (let* ((body (concat org-babel-perl-preface ibody))
+	 (tmp-file (org-babel-temp-file "perl-"))
+	 (tmp-babel-file (org-babel-process-file-name
+			  tmp-file 'noquote)))
+    ((lambda (results)
+       (when results
+	 (org-babel-result-cond result-params
+	   (org-babel-eval-read-file tmp-file)
+	   (org-babel-import-elisp-from-file tmp-file '(16)))))
+     (case result-type
+       (output
+	(with-temp-file tmp-file
+	  (insert
+	   (org-babel-eval org-babel-perl-command body))
+	  (buffer-string)))
+       (value
+	(org-babel-eval org-babel-perl-command
+			(format org-babel-perl-wrapper-method
+				body tmp-babel-file)))))))
 
 (provide 'ob-perl)
 

+ 2 - 0
lisp/org.el

@@ -3810,6 +3810,7 @@ header, or they will be appended."
     (""     "wasysym"   t)
     (""     "latexsym"  t)
     (""     "amssymb"   t)
+    (""     "amstext"   nil)
     (""     "hyperref"  nil)
     "\\tolerance=1000")
   "Alist of default packages to be inserted in the header.
@@ -3821,6 +3822,7 @@ The packages in this list are needed by one part or another of
 Org mode to function properly:
 
 - inputenc, fontenc:  for basic font and character selection
+- amstext: for subscript and superscript
 - textcomp, marvosymb, wasysym, latexsym, amssym: for various
   symbols used for interpreting the entities in `org-entities'.
   You can skip some of these packages if you don't use any of the

+ 37 - 10
lisp/ox-latex.el

@@ -2205,7 +2205,18 @@ holding contextual information."
   "Transcode a subscript or superscript object.
 OBJECT is an Org object.  INFO is a plist used as a communication
 channel."
-  (let ((output ""))
+  (let ((in-script-p
+	 ;; Non-nil if object is already in a sub/superscript.
+	 (let ((parent object))
+	   (catch 'exit
+	     (while (setq parent (org-export-get-parent parent))
+	       (let ((type (org-element-type parent)))
+		 (cond ((memq type '(subscript superscript))
+			(throw 'exit t))
+		       ((memq type org-element-all-elements)
+			(throw 'exit nil))))))))
+	(type (org-element-type object))
+	(output ""))
     (org-element-map (org-element-contents object)
 	(cons 'plain-text org-element-all-objects)
       (lambda (obj)
@@ -2222,12 +2233,7 @@ channel."
 			     (and blank (> blank 0) "\\ "))))))
 	  (plain-text
 	   (setq output
-		 (format "%s\\mathrm{%s}"
-			 output
-			 ;; \mathrm command doesn't handle spaces, so
-			 ;; we have to enforce them.
-			 (replace-regexp-in-string
-			  " " "\\\\ " (org-export-data obj info)))))
+		 (format "%s\\text{%s}" output (org-export-data obj info))))
 	  (otherwise
 	   (setq output
 		 (concat output
@@ -2235,10 +2241,31 @@ channel."
 			 (let ((blank (org-element-property :post-blank obj)))
 			   (and blank (> blank 0) "\\ ")))))))
       info nil org-element-recursive-objects)
-    ;; Result.
-    (format (if (= (length output) 1) "$%s%s$" "$%s{%s}$")
+    ;; Result.  Do not wrap into math mode if already in a subscript
+    ;; or superscript.  Do not wrap into curly brackets if OUTPUT is
+    ;; a single character.  Also merge consecutive subscript and
+    ;; superscript into the same math snippet.
+    (concat (and (not in-script-p)
+		 (let ((prev (org-export-get-previous-element object info)))
+		   (or (not prev)
+		       (not (eq (org-element-type prev)
+				(if (eq type 'subscript) 'superscript
+				  'subscript)))
+		       (let ((blank (org-element-property :post-blank prev)))
+			 (and blank (> blank 0)))))
+		 "$")
 	    (if (eq (org-element-type object) 'subscript) "_" "^")
-	    output)))
+	    (and (> (length output) 1) "{")
+	    output
+	    (and (> (length output) 1) "}")
+	    (and (not in-script-p)
+		 (or (let ((blank (org-element-property :post-blank object)))
+		       (and blank (> blank 0)))
+		     (not (eq (org-element-type
+			       (org-export-get-next-element object info))
+			      (if (eq type 'subscript) 'superscript
+				'subscript))))
+		 "$"))))
 
 (defun org-latex-subscript (subscript contents info)
   "Transcode a SUBSCRIPT object from Org to LaTeX.

+ 7 - 6
lisp/ox-org.el

@@ -117,13 +117,13 @@ setting of `org-html-htmlize-output-type' is 'css."
 		(org-open-file (org-org-export-to-org nil s v b))))))))
 
 (defun org-org-identity (blob contents info)
-  "Transcode BLOB element or object back into Org syntax."
-  (funcall
-   (intern (format "org-element-%s-interpreter" (org-element-type blob)))
-   blob contents))
+  "Transcode BLOB element or object back into Org syntax.
+CONTENTS is its contents, as a string or nil.  INFO is ignored."
+  (org-export-expand blob contents))
 
 (defun org-org-headline (headline contents info)
-  "Transcode HEADLINE element back into Org syntax."
+  "Transcode HEADLINE element back into Org syntax.
+CONTENTS is its contents, as a string or nil.  INFO is ignored."
   (unless (plist-get info :with-todo-keywords)
     (org-element-put-property headline :todo-keyword nil))
   (unless (plist-get info :with-tags)
@@ -134,7 +134,8 @@ setting of `org-html-htmlize-output-type' is 'css."
 
 (defun org-org-keyword (keyword contents info)
   "Transcode KEYWORD element back into Org syntax.
-Ignore keywords targeted at other export back-ends."
+CONTENTS is nil.  INFO is ignored.  This function ignores
+keywords targeted at other export back-ends."
   (unless (member (org-element-property :key keyword)
 		  (mapcar
 		   (lambda (block-cons)