From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Reuleaux Subject: aligning images, html attributes ignored when exporting to html (longish, sorry) Date: Sat, 21 Apr 2018 16:14:50 +0100 Message-ID: <87muxwvbf9.fsf@a-rx.info> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9xkk-0000jD-Fd for emacs-orgmode@gnu.org; Sat, 21 Apr 2018 15:00:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f9xkf-0000CZ-C6 for emacs-orgmode@gnu.org; Sat, 21 Apr 2018 15:00:54 -0400 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21111) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f9xkf-00007u-3Y for emacs-orgmode@gnu.org; Sat, 21 Apr 2018 15:00:49 -0400 Received: from rx by dell with local (Exim 4.90_1) (envelope-from ) id 1f9uDy-0007Gm-5M for emacs-orgmode@gnu.org; Sat, 21 Apr 2018 16:14:50 +0100 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" To: emacs-orgmode@gnu.org Hi, following this tutorial https://orgmode.org/worg/org-tutorials/images-and-xhtml-export.html I am trying to export some sample.org file to html, and have the images floated to the right, with no success however. to that end ATTR_HTML is used in the tutorial and in my sample.org: ----- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. #+ATTR_HTML: style="float:right;" [[./img/org-mode-unicorn.png]] Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. #+ATTR_HTML: style="float:right;" [[./img/org-mode-unicorn.png]] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Elementum eu facilisis sed odio morbi quis. ----- but no matter how I export this sample.org snippet, the html attributes (ATTR_HTML) are ignored. - below is an emacs bash script that I use for the export (making my results reproducible hopefully). all I get is the plain html image tags, no style attributes: --- ....

org-mode-unicorn.png Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

org-mode-unicorn.png Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Elementum eu facilisis sed odio morbi quis.

... --- I have no idea why these attributes are ignored, or how to make them appear: - attr_html seems a fairly standard mechanism, and works for everybody but me ?, cf eg. https://linevi.ch/en/org-link-extra-attrs.html - I have tried with different export options, but of course there are endless possibilies / combinations, and I have no clue here. I have tried to keep my export script below simple, but have kept a few lines as comments (or not) to more easily experiment with different export setting, like (setq org-html-head-include-default-style nil) (setq org-html-head-include-scripts nil) (setq org-html-doctype "html5") (setq org-html-html-fancy t) ;; (setq org-html-htmlize-output-type 'css) with no impact for the export of my html attributes however. - maybe the org mode syntax / behaviour has changed ? - however I have tried both: - org version 9.1.9 - as comes with my debian elpa-org package - and org version 8.2.10 - as comes with my emacs 25.2.2 on debian buster. I can can choose either one be commenting / uncommenting the first few lines in my export script below ---- (let ((package-dir (car (file-expand-wildcards (concat "/usr/share/" ;; emacs25 (symbol-name debian-emacs-flavor) "/site-lisp/elpa/org-*"))) )) (when (file-directory-p package-dir) (add-to-list 'load-path package-dir) (add-to-list 'auto-mode-alist '("\\.org\\(-mode\\)?\\'" . org-mode)) ) ) ---- ie. I try to load from "/usr/share/emacs25/site-lisp/elpa/org-*" if not commented out. the script will respond by printing either org mode version: org version 8.2.10 org version 9.1.9 - I *can* have extra style config added at the beginning of my export with ---- #+html_head: ---- but in general don't want *all* my images floated to the right: I want to be able to assign attributes to individual images: one image floated to the right, say, another one to the left. and of course I may want to assign other attributes (besides float) as well. OK, thanks in advance. Find my export script below, and call with $ ./exporthtml.el sample.org sample.html or $ ./exporthtml.el sample.org that way either org-html-export-as-html or org-html-export-to-html gets used. -Andreas exporthtml.el ----- :;exec /usr/bin/env emacs -batch -Q -l "$0" -f main "$@" (let ((package-dir (car (file-expand-wildcards (concat "/usr/share/" ;; emacs25 (symbol-name debian-emacs-flavor) "/site-lisp/elpa/org-*"))) )) (when (file-directory-p package-dir) (add-to-list 'load-path package-dir) (add-to-list 'auto-mode-alist '("\\.org\\(-mode\\)?\\'" . org-mode)) ) ) (require 'cl) (toggle-debug-on-error) ;; (require 'cask "~/cfg/emacs/cask/cask.el") ;; (cask-initialize) (defun main () (interactive) (destructuring-bind (org-file &optional outfile) command-line-args-left (progn (setq make-backup-files nil) (require 'org) (require 'ox-html) (message "org version %s" (org-version)) (when (file-exists-p org-file) (process-org-file org-file outfile) ) ) ) ) (defun process-org-file (orgfile &optional outfile) (interactive) (progn ;; (defvar my-extra-head "") ;; (setq org-html-head-extra my-extra-head) (setq org-html-head-include-default-style nil) (setq org-html-head-include-scripts nil) (setq org-html-doctype "html5") (setq org-html-html-fancy t) ;; (setq org-html-htmlize-output-type 'css) ;; (setq org-html-htmlize-font-prefix "org-") (if (eq nil outfile) (progn (message "no outfile given") (find-file org-file) (org-html-export-to-html) ) (progn (message "outfile is %s" outfile) (find-file org-file) (org-html-export-as-html) (write-file outfile) ) ) ) )