From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Antczak Subject: [Patch] Few small fixes to html header Date: Thu, 27 Mar 2014 20:57:01 +0100 Message-ID: <87vbuz1kky.fsf@neutrico-themes.pl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTGRP-0001Io-P5 for emacs-orgmode@gnu.org; Thu, 27 Mar 2014 15:58:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTGRI-0001mw-Px for emacs-orgmode@gnu.org; Thu, 27 Mar 2014 15:58:19 -0400 Received: from 1.mo69.mail-out.ovh.net ([178.33.251.173]:53331 helo=mo69.mail-out.ovh.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTGRI-0001m0-C6 for emacs-orgmode@gnu.org; Thu, 27 Mar 2014 15:58:12 -0400 Received: from mail174.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo69.mail-out.ovh.net (Postfix) with SMTP id 2A36D100CDEE for ; Thu, 27 Mar 2014 20:58:05 +0100 (CET) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain I've attached patch below, but I'm affraid that there is something wrong with indentation. I'm not sure if there is problem with my settings or just entire ox-html.el is indented badly. I've been trying to indent file with the default parameters. I started Emacs with -Q parameter and as I can see there is a .dir-locals.el in org-mode repo. So, everything should be ok. Unfortunately there are some differences related to indentation in my patch. Please review and accept this patch, or enlighten me how to set indentation properly. My patch fixes HTML meta data produced on export by ox-html.el 1. Meta charset definition should be set before title as document title can contain some unicode symbols etc. 2. Added viewport declaration as described here: https://github.com/h5bp/html5-boilerplate/blob/v4.3.0/doc/html.md here: https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html 3. Fixed unnecessary "\n" at the end of Description meta. 4. Removed unnecessary spaces in meta tags. Marcin --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Few-small-fixes-to-html-header.patch Content-Description: Patch >From 2df844b2a14e823fa2020cc425ad5ede75f12534 Mon Sep 17 00:00:00 2001 From: Marcin Antczak Date: Thu, 27 Mar 2014 19:29:41 +0100 Subject: [PATCH] Few small fixes to html header. * ox-html.el: Few small fixes to meta tags defined by org-html--build-meta-info function. 1. Meta charset should be set before title of html document. 2. Added meta viewport declaration. 3. Fixed unnecessary "\n" at the end of Description meta. 4. Removed unnecessary spaces in meta tags. --- lisp/ox-html.el | 130 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 66 insertions(+), 64 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index a843441..39967e1 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -235,7 +235,7 @@ for the JavaScript code in this tag. .todo { font-family: monospace; color: red; } .done { color: green; } .tag { background-color: #eee; font-family: monospace; - padding: 2px; font-size: 80%; font-weight: normal; } + padding: 2px; font-size: 80%; font-weight: normal; } .timestamp { color: #bebebe; } .timestamp-kwd { color: #5f9ea0; } .right { margin-left: auto; margin-right: 0px; text-align: right; } @@ -686,11 +686,11 @@ e.g. \"tex:mathjax\". Allowed values are: nil Ignore math snippets. `verbatim' Keep everything in verbatim `dvipng' Process the LaTeX fragments to images. This will also - include processing of non-math environments. + include processing of non-math environments. `imagemagick' Convert the LaTeX fragments to pdf files and use - imagemagick to convert pdf files to png files. + imagemagick to convert pdf files to png files. `mathjax' Do MathJax preprocessing and arrange for MathJax.js to - be loaded. + be loaded. t Synonym for `mathjax'." :group 'org-export-html :version "24.4" @@ -826,15 +826,15 @@ you can reuse them: `rowgroup-number': group number of current row `start-rowgroup-p': non-nil means the row starts a group `end-rowgroup-p': non-nil means the row ends a group - `top-row-p': non-nil means this is the top row + `top-row-p': non-nil means this is the top row `bottom-row-p': non-nil means this is the bottom row For example: \(setq org-html-table-row-tags (cons '(cond (top-row-p \"\") - (bottom-row-p \"\") - (t (if (= (mod row-number 2) 1) + (bottom-row-p \"\") + (t (if (= (mod row-number 2) 1) \"\" \"\"))) \"\")) @@ -1033,9 +1033,9 @@ scale Scaling for the HTML-CSS backend, usually between 100 and 133 align How to align display math: left, center, or right indent If align is not center, how far from the left/right side? mathml Should a MathML player be used if available? - This is faster and reduces bandwidth use, but currently - sometimes has lower spacing quality. Therefore, the default is - nil. When browsers get better, this switch can be flipped. + This is faster and reduces bandwidth use, but currently + sometimes has lower spacing quality. Therefore, the default is + nil. When browsers get better, this switch can be flipped. You can also customize this for each buffer, using something like @@ -1058,41 +1058,41 @@ You can also customize this for each buffer, using something like " @@ -1371,11 +1371,11 @@ attributes with a nil value will be omitted from the result." (let (output) (dolist (item attributes (mapconcat 'identity (nreverse output) " ")) (cond ((null item) (pop output)) - ((symbolp item) (push (substring (symbol-name item) 1) output)) - (t (let ((key (car output)) - (value (replace-regexp-in-string - "\"" """ (org-html-encode-plain-text item)))) - (setcar output (format "%s=\"%s\"" key value)))))))) + ((symbolp item) (push (substring (symbol-name item) 1) output)) + (t (let ((key (car output)) + (value (replace-regexp-in-string + "\"" """ (org-html-encode-plain-text item)))) + (setcar output (format "%s=\"%s\"" key value)))))))) (defun org-html--wrap-image (contents info &optional caption label) "Wrap CONTENTS string within an appropriate environment for images. @@ -1585,37 +1585,39 @@ INFO is a plist used as a communication channel." 'mime-charset)) "iso-8859-1"))) (concat - (format "%s\n" title) (when (plist-get info :time-stamp-file) (format-time-string (concat "\n"))) (format (if (org-html-html5-p info) - (org-html-close-tag "meta" " charset=\"%s\"" info) + (org-html-close-tag "meta" "charset=\"%s\"" info) (org-html-close-tag "meta" " http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"" info)) charset) "\n" - (org-html-close-tag "meta" " name=\"generator\" content=\"Org-mode\"" info) + (format "%s\n" title) + (org-html-close-tag "meta" "name=\"viewport\" content=\"width=device-width, initial-scale=1\"" info) + "\n" + (org-html-close-tag "meta" "name=\"generator\" content=\"Org-mode\"" info) "\n" (and (org-string-nw-p author) (concat (org-html-close-tag "meta" - (format " name=\"author\" content=\"%s\"" + (format "name=\"author\" content=\"%s\"" (funcall protect-string author)) info) "\n")) (and (org-string-nw-p description) (concat (org-html-close-tag "meta" - (format " name=\"description\" content=\"%s\"\n" + (format "name=\"description\" content=\"%s\"" (funcall protect-string description)) info) "\n")) (and (org-string-nw-p keywords) (concat (org-html-close-tag "meta" - (format " name=\"keywords\" content=\"%s\"" + (format "name=\"keywords\" content=\"%s\"" (funcall protect-string keywords)) info) "\n"))))) @@ -2653,7 +2655,7 @@ if its description is a single link targeting an image file." (not (org-export-inline-image-p obj org-html-inline-image-rules)))) (otherwise t))) - info t))))) + info t))))) (defvar org-html-standalone-image-predicate) (defun org-html-standalone-image-p (element info) @@ -2706,7 +2708,7 @@ INFO is a plist holding contextual information. See (function (lambda (raw-path info) "Treat links to `file.org' as links to `file.html', if needed. - See `org-html-link-org-files-as-html'." + See `org-html-link-org-files-as-html'." (cond ((and org-html-link-org-files-as-html (string= ".org" @@ -2886,9 +2888,9 @@ INFO is a plist holding contextual information. See CONTENTS is nil. INFO is a plist holding contextual information." (format "%s:%s" - (org-element-property :key node-property) - (let ((value (org-element-property :value node-property))) - (if value (concat " " value) "")))) + (org-element-property :key node-property) + (let ((value (org-element-property :value node-property))) + (if value (concat " " value) "")))) ;;;; Paragraph @@ -2915,7 +2917,7 @@ the plist used as a communication channel." 'org-html--has-caption-p)) (if (not (org-string-nw-p raw)) raw (concat - "" + "" (format (org-html--translate "Figure %d:" info) (org-export-get-ordinal (org-element-map paragraph 'link @@ -3067,7 +3069,7 @@ holding contextual information." (mapconcat 'number-to-string (org-export-get-headline-number parent info) "-"))) - ;; Build return value. + ;; Build return value. (format "
\n%s
" class-num (or (org-element-property :CUSTOM_ID parent) section-number) @@ -3321,7 +3323,7 @@ contextual information." "%s") (concat "" - (format (org-html--translate "Table %d:" info) number) + (format (org-html--translate "Table %d:" info) number) " " (org-export-data caption info)))) (funcall table-column-specs table info) contents))))) -- 1.9.1 --=-=-=--