emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Patch] Few small fixes to html header
@ 2014-03-27 19:57 Marcin Antczak
  2014-03-28  7:59 ` Rainer M Krug
  2014-03-28 14:43 ` Rick Frankel
  0 siblings, 2 replies; 8+ messages in thread
From: Marcin Antczak @ 2014-03-27 19:57 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1094 bytes --]


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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch --]
[-- Type: text/x-diff, Size: 11402 bytes --]

From 2df844b2a14e823fa2020cc425ad5ede75f12534 Mon Sep 17 00:00:00 2001
From: Marcin Antczak <marcin.antczak@neutrico-themes.pl>
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 \"<tr class=\\\"tr-top\\\">\")
-                   (bottom-row-p \"<tr class=\\\"tr-bottom\\\">\")
-                   (t (if (= (mod row-number 2) 1)
+		   (bottom-row-p \"<tr class=\\\"tr-bottom\\\">\")
+		   (t (if (= (mod row-number 2) 1)
 			  \"<tr class=\\\"tr-odd\\\">\"
 			\"<tr class=\\\"tr-even\\\">\")))
 	    \"</tr>\"))
@@ -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
 <script type=\"text/javascript\">
 <!--/*--><![CDATA[/*><!--*/
     MathJax.Hub.Config({
-        // Only one of the two following lines, depending on user settings
-        // First allows browser-native MathML display, second forces HTML/CSS
-        :MMLYES: config: [\"MMLorHTML.js\"], jax: [\"input/TeX\"],
-        :MMLNO: jax: [\"input/TeX\", \"output/HTML-CSS\"],
-        extensions: [\"tex2jax.js\",\"TeX/AMSmath.js\",\"TeX/AMSsymbols.js\",
-                     \"TeX/noUndefined.js\"],
-        tex2jax: {
-            inlineMath: [ [\"\\\\(\",\"\\\\)\"] ],
-            displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"], [\"\\\\begin{displaymath}\",\"\\\\end{displaymath}\"] ],
-            skipTags: [\"script\",\"noscript\",\"style\",\"textarea\",\"pre\",\"code\"],
-            ignoreClass: \"tex2jax_ignore\",
-            processEscapes: false,
-            processEnvironments: true,
-            preview: \"TeX\"
-        },
-        showProcessingMessages: true,
-        displayAlign: \"%ALIGN\",
-        displayIndent: \"%INDENT\",
-
-        \"HTML-CSS\": {
-             scale: %SCALE,
-             availableFonts: [\"STIX\",\"TeX\"],
-             preferredFont: \"TeX\",
-             webFont: \"TeX\",
-             imageFont: \"TeX\",
-             showMathMenu: true,
-        },
-        MMLorHTML: {
-             prefer: {
-                 MSIE:    \"MML\",
-                 Firefox: \"MML\",
-                 Opera:   \"HTML\",
-                 other:   \"HTML\"
-             }
-        }
+	// Only one of the two following lines, depending on user settings
+	// First allows browser-native MathML display, second forces HTML/CSS
+	:MMLYES: config: [\"MMLorHTML.js\"], jax: [\"input/TeX\"],
+	:MMLNO: jax: [\"input/TeX\", \"output/HTML-CSS\"],
+	extensions: [\"tex2jax.js\",\"TeX/AMSmath.js\",\"TeX/AMSsymbols.js\",
+		     \"TeX/noUndefined.js\"],
+	tex2jax: {
+	    inlineMath: [ [\"\\\\(\",\"\\\\)\"] ],
+	    displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"], [\"\\\\begin{displaymath}\",\"\\\\end{displaymath}\"] ],
+	    skipTags: [\"script\",\"noscript\",\"style\",\"textarea\",\"pre\",\"code\"],
+	    ignoreClass: \"tex2jax_ignore\",
+	    processEscapes: false,
+	    processEnvironments: true,
+	    preview: \"TeX\"
+	},
+	showProcessingMessages: true,
+	displayAlign: \"%ALIGN\",
+	displayIndent: \"%INDENT\",
+
+	\"HTML-CSS\": {
+	     scale: %SCALE,
+	     availableFonts: [\"STIX\",\"TeX\"],
+	     preferredFont: \"TeX\",
+	     webFont: \"TeX\",
+	     imageFont: \"TeX\",
+	     showMathMenu: true,
+	},
+	MMLorHTML: {
+	     prefer: {
+		 MSIE:    \"MML\",
+		 Firefox: \"MML\",
+		 Opera:   \"HTML\",
+		 other:   \"HTML\"
+	     }
+	}
     });
 /*]]>*///-->
 </script>"
@@ -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
-                             "\"" "&quot;" (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
+			     "\"" "&quot;" (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 "<title>%s</title>\n" title)
      (when (plist-get info :time-stamp-file)
        (format-time-string
 	 (concat "<!-- " org-html-metadata-timestamp-format " -->\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 "<title>%s</title>\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
-                  "<span class=\"figure-number\">"
+		  "<span class=\"figure-number\">"
 		  (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 "<div class=\"outline-text-%d\" id=\"text-%s\">\n%s</div>"
 		class-num
 		(or (org-element-property :CUSTOM_ID parent) section-number)
@@ -3321,7 +3323,7 @@ contextual information."
 			   "<caption class=\"t-bottom\">%s</caption>")
 			 (concat
 			  "<span class=\"table-number\">"
-                          (format (org-html--translate "Table %d:" info) number)
+			  (format (org-html--translate "Table %d:" info) number)
 			  "</span> " (org-export-data caption info))))
 	       (funcall table-column-specs table info)
 	       contents)))))
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Patch] Few small fixes to html header
  2014-03-27 19:57 [Patch] Few small fixes to html header Marcin Antczak
@ 2014-03-28  7:59 ` Rainer M Krug
  2014-03-28 10:40   ` Marcin Antczak
  2014-03-28 14:43 ` Rick Frankel
  1 sibling, 1 reply; 8+ messages in thread
From: Rainer M Krug @ 2014-03-28  7:59 UTC (permalink / raw)
  To: Marcin Antczak; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

Marcin Antczak <marcin.antczak@neutrico-themes.pl> writes:

> 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
>
>

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3862 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] Few small fixes to html header
  2014-03-28  7:59 ` Rainer M Krug
@ 2014-03-28 10:40   ` Marcin Antczak
  0 siblings, 0 replies; 8+ messages in thread
From: Marcin Antczak @ 2014-03-28 10:40 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode


Rainer M Krug writes:

> Marcin Antczak <marcin.antczak@neutrico-themes.pl> writes:
>
[...]

Is your response intentionally empty or am I missing something?


Marcin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] Few small fixes to html header
  2014-03-27 19:57 [Patch] Few small fixes to html header Marcin Antczak
  2014-03-28  7:59 ` Rainer M Krug
@ 2014-03-28 14:43 ` Rick Frankel
  2014-03-28 15:16   ` Marcin Antczak
  1 sibling, 1 reply; 8+ messages in thread
From: Rick Frankel @ 2014-03-28 14:43 UTC (permalink / raw)
  To: Marcin Antczak; +Cc: emacs-orgmode

On 2014-03-27 15:57, Marcin Antczak wrote:
> 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.

Unfortunately, ox-html is indented with a combination of tabs and
spaces, you can turn on whitespace-mode to see. I'm not sure why your
saving the file has touched areas you didn't edit. Did you do a
re-indent or have a whitespace-cleanup or convert-tabs-to-spaces hook
turned on?
> 
> 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.

I believe this is the gist of your patch (bug fix?) -- putting the
content-type declaration before the title (it's hard to tell due to
all the changes in your patch)? If so, i don't see the need. Following
is a sample org file w/ a unicode character in the title. It renders
correctly on both internet explorer 9 and chrome 31.0.1650.63, the
only browsers i have available right now. I believe that the meta
content is parsed before the rendering, so the position within the
header is irrelevant.

#+BEGIN_SRC org
,#+TITLE: ☑ \gamma
,#+OPTIONS: toc:nil

,* Test utf-8 title
Put  ☑ \gamma (checkbox and gamma) unicode characters in the title.
#+END_SRC

> 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

I don't believe it's appropriate to have as a default in ox-html as
the current exporter makes no attempt at "responsive design". If you
would like your exported documents to include it, you can use the
HTML_HEAD_EXTRA property on a per-file basis, or customize the
variable `org-html-head-extra'.

> 3. Fixed unnecessary "\n" at the end of Description meta.
> 4. Removed unnecessary spaces in meta tags.

Are these bugs or simply stylistic cleanup?

rick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] Few small fixes to html header
  2014-03-28 14:43 ` Rick Frankel
@ 2014-03-28 15:16   ` Marcin Antczak
  2014-03-28 16:00     ` Rick Frankel
  0 siblings, 1 reply; 8+ messages in thread
From: Marcin Antczak @ 2014-03-28 15:16 UTC (permalink / raw)
  To: Rick Frankel; +Cc: emacs-orgmode


Rick Frankel writes:

> On 2014-03-27 15:57, Marcin Antczak wrote:
>> 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.
>
> Unfortunately, ox-html is indented with a combination of tabs and
> spaces, you can turn on whitespace-mode to see. I'm not sure why your
> saving the file has touched areas you didn't edit. Did you do a
> re-indent or have a whitespace-cleanup or convert-tabs-to-spaces hook
> turned on?

No. I didn't.

Why ox-html is indented in a way that doesn't follow guidelines
described on Emacs Lisp Coding Conventions?

Could we fix it?

>>
>> 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.
>
> I believe this is the gist of your patch (bug fix?) -- putting the
> content-type declaration before the title (it's hard to tell due to
> all the changes in your patch)? If so, i don't see the need. Following
> is a sample org file w/ a unicode character in the title. It renders
> correctly on both internet explorer 9 and chrome 31.0.1650.63, the
> only browsers i have available right now. I believe that the meta
> content is parsed before the rendering, so the position within the
> header is irrelevant.
>
> #+BEGIN_SRC org
> ,#+TITLE: ☑ \gamma
> ,#+OPTIONS: toc:nil
>
> ,* Test utf-8 title
> Put  ☑ \gamma (checkbox and gamma) unicode characters in the title.
> #+END_SRC

But it's still bug.

1. Most modern browsers fallback to UTF-8 currently.
2. Charset is often set by server content type.

So, this is why you can see your example rendered correctly.
But there could be a case where it will not render properly.

From logical point of view - charset should be first. And it's in most
html frameworks such as HTML5 Boilerplate, Twitter Bootstrap 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
>
> I don't believe it's appropriate to have as a default in ox-html as
> the current exporter makes no attempt at "responsive design". If you
> would like your exported documents to include it, you can use the
> HTML_HEAD_EXTRA property on a per-file basis, or customize the
> variable `org-html-head-extra'.

Ok.

I'm working on some exporter that outputs HTML with Twitter Bootstrap.
I'll implement this 'viewport' there.

>
>> 3. Fixed unnecessary "\n" at the end of Description meta.
>> 4. Removed unnecessary spaces in meta tags.
>
> Are these bugs or simply stylistic cleanup?

3. This is a bug for me. Meta shouldn't render closing > in new line.
4. Stylistics.

Marcin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] Few small fixes to html header
  2014-03-28 15:16   ` Marcin Antczak
@ 2014-03-28 16:00     ` Rick Frankel
  2014-03-28 18:02       ` Marcin Antczak
  0 siblings, 1 reply; 8+ messages in thread
From: Rick Frankel @ 2014-03-28 16:00 UTC (permalink / raw)
  To: Marcin Antczak; +Cc: Bastien, emacs-orgmode

On 2014-03-28 11:16, Marcin Antczak wrote:
> Rick Frankel writes:
> 
> On 2014-03-27 15:57, Marcin Antczak wrote:
> 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.
> 
> Unfortunately, ox-html is indented with a combination of tabs and
> spaces, you can turn on whitespace-mode to see. I'm not sure why your
> saving the file has touched areas you didn't edit. Did you do a
> re-indent or have a whitespace-cleanup or convert-tabs-to-spaces hook
> turned on?
> 
> Why ox-html is indented in a way that doesn't follow guidelines
> described on Emacs Lisp Coding Conventions?

good question. I think because it's actually a very old file.

> Could we fix it?

Another good question. Bastien- Do you think it makes sense to do a
whitespace cleanup only commit of ox-html to master?

> 
> 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.
> 
> But it's still bug.
> 
> 1. Most modern browsers fallback to UTF-8 currently.
> 2. Charset is often set by server content type.
> 
> So, this is why you can see your example rendered correctly.
> But there could be a case where it will not render properly.

Not true. This file renders incorrectly when opened from the file
system in ie 9 and chrome:

#+BEGIN_SRC html
<html>
<head>
<title>☑</title>
</head>
<body>
<p>☑ checkbox</p>
</body>
</html>
#+END_SRC

But this one renders correctly:
#+BEGIN_SRC html
<html>
<head>
<title>☑</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<p>☑ checkbox</p>
</body>
</html>
#+END_SRC

> From logical point of view - charset should be first. And it's in most
> html frameworks such as HTML5 Boilerplate, Twitter Bootstrap etc.

That may be, but it's a stylistic issue, not a bug. My read of the
html dtd does not specify the order of elements in the head. Can you
show me an example where the order of the elements causes incorrect
display of the title?

> 
> 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
> 
> I don't believe it's appropriate to have as a default in ox-html as
> the current exporter makes no attempt at "responsive design". If you
> would like your exported documents to include it, you can use the
> HTML_HEAD_EXTRA property on a per-file basis, or customize the
> variable `org-html-head-extra'.
> 
> Ok.
> 
> 3. Fixed unnecessary "\n" at the end of Description meta.
> 4. Removed unnecessary spaces in meta tags.
> 
> Are these bugs or simply stylistic cleanup?
> 
> 3. This is a bug for me. Meta shouldn't render closing > in new
> line.

Does it cause output which is incorrectly displayed? Otherwise it's
not really a bug, but i will look at changing it the next time i need
to touch the file.

I'm worried about touching (4) w/o tests, as sometimes attributes are
concatenated, and removing a leading whitespace could cause breakage.

While source whitespace and output formatting are annoying, our
approach to modifications of this (quite old) file has been to not
make changes which don't materially affect functionality or fix bugs
(the rule of least damage :).

rick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] Few small fixes to html header
  2014-03-28 16:00     ` Rick Frankel
@ 2014-03-28 18:02       ` Marcin Antczak
  2014-04-16 14:50         ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Marcin Antczak @ 2014-03-28 18:02 UTC (permalink / raw)
  To: Rick Frankel; +Cc: Bastien, emacs-orgmode


Rick Frankel writes:

> On 2014-03-28 11:16, Marcin Antczak wrote:
>> Rick Frankel writes:
>>
>> On 2014-03-27 15:57, Marcin Antczak wrote:
>> 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.
>>
>> Unfortunately, ox-html is indented with a combination of tabs and
>> spaces, you can turn on whitespace-mode to see. I'm not sure why your
>> saving the file has touched areas you didn't edit. Did you do a
>> re-indent or have a whitespace-cleanup or convert-tabs-to-spaces hook
>> turned on?
>>
>> Why ox-html is indented in a way that doesn't follow guidelines
>> described on Emacs Lisp Coding Conventions?
>
> good question. I think because it's actually a very old file.
>
>> Could we fix it?
>
> Another good question. Bastien- Do you think it makes sense to do a
> whitespace cleanup only commit of ox-html to master?

+1 from me.

> That may be, but it's a stylistic issue, not a bug. My read of the
> html dtd does not specify the order of elements in the head. Can you
> show me an example where the order of the elements causes incorrect
> display of the title?

Cannot reproduce this right now.
I had a lot of various problems with Polish Latin-2 ISO-8859-2
characters, but to be honest these were in pre-UTF era.

> Does it cause output which is incorrectly displayed? Otherwise it's
> not really a bug, but i will look at changing it the next time i need
> to touch the file.

There is no output from META tag. So, no.

But, w3c html-markup syntax documentation says:

"end tags consist of the following parts, in exactly the following order:

    A "<" character.
    A "/" character
    The element’s tag name.
    Optionally, one or more space characters.
    A ">" character.
"

They don't mention any newline character.

>
> I'm worried about touching (4) w/o tests, as sometimes attributes are
> concatenated, and removing a leading whitespace could cause breakage.

It shouldn't.
Meta tag can only have two attributes. There is no reason to concatenate
anything else.

> While source whitespace and output formatting are annoying, our
> approach to modifications of this (quite old) file has been to not
> make changes which don't materially affect functionality or fix bugs
> (the rule of least damage :).

I agree. But code really should be valid and IMHO little improvements
and code cleanups are ok.


Marcin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] Few small fixes to html header
  2014-03-28 18:02       ` Marcin Antczak
@ 2014-04-16 14:50         ` Bastien
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2014-04-16 14:50 UTC (permalink / raw)
  To: Marcin Antczak; +Cc: Rick Frankel, emacs-orgmode

Hi Marcin and Rick,

Marcin Antczak <marcin.antczak@neutrico-themes.pl> writes:

>> Another good question. Bastien- Do you think it makes sense to do a
>> whitespace cleanup only commit of ox-html to master?
>
> +1 from me.

The practice I've seen on Emacs is to not do whitespace commits,
but the cleanup whitespace when there is another real change.

Let's do it that way.

>> While source whitespace and output formatting are annoying, our
>> approach to modifications of this (quite old) file has been to not
>> make changes which don't materially affect functionality or fix bugs
>> (the rule of least damage :).
>
> I agree. But code really should be valid and IMHO little improvements
> and code cleanups are ok.

Agreed.  Can you submit a patch for the small enhancement you are
suggesting?  Then you can also do the whitespace cleanup.

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-16 16:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-27 19:57 [Patch] Few small fixes to html header Marcin Antczak
2014-03-28  7:59 ` Rainer M Krug
2014-03-28 10:40   ` Marcin Antczak
2014-03-28 14:43 ` Rick Frankel
2014-03-28 15:16   ` Marcin Antczak
2014-03-28 16:00     ` Rick Frankel
2014-03-28 18:02       ` Marcin Antczak
2014-04-16 14:50         ` Bastien

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).