emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Machulis <kyle@nonpolynomial.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] ox-html: Fix meta tag output for properties
Date: Sat, 1 Jun 2013 15:12:00 -0700	[thread overview]
Message-ID: <CAF1EFcfkVkshBoCJf4EDmYEL0pCCLzUWatVjH6GLZmVD6=O0AQ@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 531 bytes --]

There are a few document properties (author, description, keywords) that
should automatically be made meta tags if they exist on export. These were
currently being checked as part of an and block that would evaluate both,
creating the string, then just return a newline on success, meaning the
meta tags were never added to the document (since they're part of a larger
concat that never got the string added to it). This patch wraps the needed
logic check into a when, then concats the tag creation and newline addition
to return.

[-- Attachment #1.2: Type: text/html, Size: 563 bytes --]

[-- Attachment #2: 0001-ox-html.el-Fix-output-of-meta-tags-when-properties-a.patch --]
[-- Type: application/octet-stream, Size: 2117 bytes --]

From d0a54cffe8445c2b02b6a150c38ab12c6251bcc7 Mon Sep 17 00:00:00 2001
From: Kyle Machulis <kyle@nonpolynomial.com>
Date: Sat, 1 Jun 2013 15:04:14 -0700
Subject: [PATCH] ox-html.el: Fix output of meta tags when properties are
 present

* lisp/ox-html.el (org-html--build-meta-info): Fix output of meta tags
  when properties are present

TINYCHANGE
---
 lisp/ox-html.el | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index facd84c..5e4ad7b 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1518,24 +1518,25 @@ INFO is a plist used as a communication channel."
       charset) "\n"
      (org-html-close-tag "meta" " name=\"generator\" content=\"Org-mode\"" info)
      "\n"
-     (and (org-string-nw-p author)
-	  (org-html-close-tag "meta"
-			      (format " name=\"author\" content=\"%s\""
-				      (funcall protect-string author))
-			      info)
-	  "\n")
-     (and (org-string-nw-p description)
-	  (org-html-close-tag "meta"
-			      (format " name=\"description\" content=\"%s\"\n"
-				      (funcall protect-string description))
-			      info)
-	  "\n")
-     (and (org-string-nw-p keywords)
-	  (org-html-close-tag "meta"
-			      (format " name=\"keywords\" content=\"%s\""
-				      (funcall protect-string keywords))
-			      info)
-	  "\n"))))
+
+     (when (org-string-nw-p author)
+       (concat (org-html-close-tag "meta"
+				   (format " name=\"author\" content=\"%s\""
+					   (funcall protect-string author))
+				   info)
+	       "\n"))
+     (when (org-string-nw-p description)
+       (concat (org-html-close-tag "meta"
+				   (format " name=\"description\" content=\"%s\""
+					   (funcall protect-string description))
+				   info)
+	       "\n"))
+     (when (org-string-nw-p keywords)
+       (concat (org-html-close-tag "meta"
+				   (format " name=\"keywords\" content=\"%s\""
+					   (funcall protect-string keywords))
+				   info)
+	       "\n")))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
1.8.2.3


                 reply	other threads:[~2013-06-01 22:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAF1EFcfkVkshBoCJf4EDmYEL0pCCLzUWatVjH6GLZmVD6=O0AQ@mail.gmail.com' \
    --to=kyle@nonpolynomial.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).