Browse Source

Export: New in-buffer options to set content of meta tag data

New in-buffer options #+DESCRIPTION and #+KEYWORDS can be used to set
the corresponding meta tag entries in XHTML export.
Carsten Dominik 16 years ago
parent
commit
cd244078a0
4 changed files with 54 additions and 12 deletions
  1. 5 0
      doc/ChangeLog
  2. 15 10
      doc/org.texi
  3. 8 0
      lisp/ChangeLog
  4. 26 2
      lisp/org-exp.el

+ 5 - 0
doc/ChangeLog

@@ -1,3 +1,8 @@
+2009-03-08  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.texi (Export options, Export options, In-buffer settings):
+	Document the new keywords.
+
 2009-03-03  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.texi (Matching tags and properties): Collect all

+ 15 - 10
doc/org.texi

@@ -8109,6 +8109,8 @@ Insert template with export options, see example below.
 @cindex #+AUTHOR:
 @cindex #+DATE:
 @cindex #+EMAIL:
+@cindex #+DESCRIPTION:
+@cindex #+KEYWORDS:
 @cindex #+LANGUAGE:
 @cindex #+TEXT:
 @cindex #+OPTIONS:
@@ -8121,16 +8123,18 @@ Insert template with export options, see example below.
 @vindex user-mail-address
 @vindex org-export-default-language
 @example
-#+TITLE:     the title to be shown (default is the buffer name)
-#+AUTHOR:    the author (default taken from @code{user-full-name})
-#+DATE:      A date, fixed, of a format string for @code{format-time-string}
-#+EMAIL:     his/her email address (default from @code{user-mail-address})
-#+LANGUAGE:  language for HTML, e.g. @samp{en} (@code{org-export-default-language})
-#+TEXT:      Some descriptive text to be inserted at the beginning.
-#+TEXT:      Several lines may be given.
-#+OPTIONS:   H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
-#+LINK_UP:   the ``up'' link of an exported page
-#+LINK_HOME: the ``home'' link of an exported page
+#+TITLE:       the title to be shown (default is the buffer name)
+#+AUTHOR:      the author (default taken from @code{user-full-name})
+#+DATE:        a date, fixed, of a format string for @code{format-time-string}
+#+EMAIL:       his/her email address (default from @code{user-mail-address})
+#+DESCRIPTION: the page description, e.g. for the XHTML meta tag
+#+KEYWORDS:    the page keywords, e.g. for the XHTML meta tag
+#+LANGUAGE:    language for HTML, e.g. @samp{en} (@code{org-export-default-language})
+#+TEXT:        Some descriptive text to be inserted at the beginning.
+#+TEXT:        Several lines may be given.
+#+OPTIONS:     H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
+#+LINK_UP:     the ``up'' link of an exported page
+#+LINK_HOME:   the ``home'' link of an exported page
 #+LATEX_HEADER: extra line(s) for the LaTeX header, like \usepackage@{xyz@}
 #+EXPORT_SELECT_TAGS:   Tags that select a tree for export
 #+EXPORT_EXCLUDE_TAGS:  Tags that exclude a tree from export
@@ -9529,6 +9533,7 @@ keys.  The corresponding variable is @code{org-tag-alist}.
 @item #+TBLFM:
 This line contains the formulas for the table directly above the line.
 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:,
+@itemx #+DESCRIPTION:, #+KEYWORDS:
 @itemx #+LATEX_HEADER:, #+STYLE:, #+LINK_UP:, #+LINK_HOME:, 
 @itemx #+EXPORT_SELECT_TAGS:, #+EXPORT_EXCLUDE_TAGS:
 These lines provide settings for exporting files.  For more details see

+ 8 - 0
lisp/ChangeLog

@@ -1,5 +1,13 @@
 2009-03-08  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-exp.el (org-export-page-description)
+	(org-export-page-keywords): New variables.
+	(org-export-plist-vars): Add entries for :keywords and
+	:description.
+	(org-infile-export-plist): Parse for new keywords.
+	(org-get-current-options): Add new keywords
+	(org-export-as-html): Publish description and keywords.
+
 	* org-agenda.el (org-agenda-add-entry-text-descriptive-links): New
 	option.
 	(org-agenda-add-entry-text): Honor

+ 26 - 2
lisp/org-exp.el

@@ -137,6 +137,16 @@ This should have an association in `org-export-language-setup'."
   :group 'org-export-general
   :type 'string)
 
+(defvar org-export-page-description ""
+  "The page description, for the XHTML meta tag.
+This is best set with the #+DESCRIPTION line in a file, it does not make
+sense to set this globally.")
+
+(defvar org-export-page-keywords ""
+  "The page description, for the XHTML meta tag.
+This is best set with the #+KEYWORDS line in a file, it does not make
+sense to set this globally.")
+
 (defcustom org-export-skip-text-before-1st-heading nil
   "Non-nil means, skip all text before the first headline when exporting.
 When nil, that text is exported as well."
@@ -925,6 +935,8 @@ or if they are only using it locally."
   '((:link-up		      nil	  org-export-html-link-up)
     (:link-home		      nil	  org-export-html-link-home)
     (:language		      nil	  org-export-default-language)
+    (:keywords		      nil	  org-export-page-keywords)
+    (:description             nil	  org-export-page-description)
     (:customtime	      nil	  org-display-custom-times)
     (:headline-levels	      "H"	  org-export-headline-levels)
     (:section-numbers	      "num"	  org-export-with-section-numbers)
@@ -1015,7 +1027,8 @@ modified) list.")
 		 (append
 		  '("TITLE" "AUTHOR" "DATE" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"
 		    "LINK_UP" "LINK_HOME" "SETUPFILE" "STYLE" "LATEX_HEADER"
-		    "EXPORT_SELECT_TAGS" "EXPORT_EXCLUDE_TAGS")
+		    "EXPORT_SELECT_TAGS" "EXPORT_EXCLUDE_TAGS"
+		    "KEYWORDS" "DESCRIPTION")
 		  (mapcar 'car org-export-inbuffer-options-extra))))
 	    p key val text options a pr style
 	    latex-header
@@ -1035,6 +1048,9 @@ modified) list.")
 	   ((string-equal key "AUTHOR")(setq p (plist-put p :author val)))
 	   ((string-equal key "EMAIL") (setq p (plist-put p :email val)))
 	   ((string-equal key "DATE") (setq p (plist-put p :date val)))
+	   ((string-equal key "KEYWORDS") (setq p (plist-put p :keywords val)))
+	   ((string-equal key "DESCRIPTION")
+	    (setq p (plist-put p :description val)))
 	   ((string-equal key "LANGUAGE") (setq p (plist-put p :language val)))
 	   ((string-equal key "STYLE")
 	    (setq style (concat style "\n" val)))
@@ -3124,6 +3140,8 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
 #+AUTHOR:    %s
 #+EMAIL:     %s
 #+DATE:      %s
+#+DESCRIPTION: 
+#+KEYWORDS: 
 #+LANGUAGE:  %s
 #+OPTIONS:   H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s -:%s f:%s *:%s <:%s
 #+OPTIONS:   TeX:%s LaTeX:%s skip:%s d:%s todo:%s pri:%s tags:%s
@@ -3424,6 +3442,8 @@ PUB-DIR is set, use this as the publishing directory."
 	 (llt org-plain-list-ordered-item-terminator)
 	 (email       (plist-get opt-plist :email))
 	 (language    (plist-get opt-plist :language))
+	 (keywords    (plist-get opt-plist :keywords))
+	 (description (plist-get opt-plist :description))
 	 (lang-words  nil)
 	 (head-count  0) cnt
 	 (start       0)
@@ -3528,13 +3548,17 @@ lang=\"%s\" xml:lang=\"%s\">
 <meta name=\"generator\" content=\"Org-mode\"/>
 <meta name=\"generated\" content=\"%s\"/>
 <meta name=\"author\" content=\"%s\"/>
+<meta name=\"description\" content=\"%s\"/>
+<meta name=\"keywords\" content=\"%s\"/>
 %s
 </head>
 <body>
 <div id=\"content\">
 "
 		 language language (org-html-expand title)
-		 (or charset "iso-8859-1") date author style))
+		 (or charset "iso-8859-1")
+		 date author description keywords
+		 style))
 
 	(insert (or (plist-get opt-plist :preamble) ""))