Re: [O] HTML/images zipped?

2015-06-29 Thread Vaidheeswaran C
On Friday 26 June 2015 06:40 PM, Peter Davis wrote:
> Is there any way to export HTML with all references images,
> etc. packaged in a ZIP file?

This is EPUB format (more or less).




Re: [O] Time-zone in dates

2015-06-29 Thread Nick Dokos
Eric S Fraga  writes:

> On Friday, 26 Jun 2015 at 21:57, franc...@avalenn.eu wrote:
>
> [...]
>
>> It is really simpler programmatically to deal with time offsets
>> instead. The downside is that you cannot manage DST and other similar
>> peculiarities but the API is much simpler to write.
>
> Time offsets are not sufficient.  My Australia experience involved me
> living in South Australia while working with colleagues in the UK.  The
> time difference throughout the year was one of 8.5 hours, 9.5 hours or
> 10.5 hours, depending on the various switches to and from daylight
> savings.  Very annoying and confusing to manage...
>
> To be effective and usable, org will need to incorporate time zone
> information.

The only reliable way of doing that is to use UTC as the "internal"
representation and translate to/from local time on external
display/input *only*.  In the case of org mode, the "internal"
representation is user-visible, so that can cause confusion and some
head-scratching. But *any* other method is going to be a nightmare
(damhikt).

-- 
Nick




Re: [O] org-log-reschedule: inactive time-stamp instead

2015-06-29 Thread Nicolas Goaziou
M  writes:

> thanks a lot for your explanations!
> If the timestamp would automatically be converted to an inactive one, hat
> would be perfect from my point of view.

Done in 304f84530b276b72272c37aa3e4dfded4584d709. Thank you.


Regards,



Re: [O] problem with ox-pandoc export

2015-06-29 Thread Nicolas Goaziou
Alan Schmitt  writes:

> There is an `org-pandoc-template' already, it just does not deal with
> the metadata used in `org-org-template'. I was thinking of reusing
> `org-org-template' directly, but if I understand your suggestion, we
> should just copy that code in `org-pandoc-template'. Is this correct?

Correct.

Also, I don't think you need /exactly/ `org-org-template', since pandoc
probably uses another syntax for meta-data, doesn't it?


Regards,



Re: [O] problem with ox-pandoc export

2015-06-29 Thread Alan Schmitt
On 2015-06-29 14:19, Nicolas Goaziou  writes:

> Alan Schmitt  writes:
>
>> Is there a way to support both the master and the maint branch for
>> ox-pandoc?
>
> Since you are going to override it anyway, how does it matter? Just
> define `org-pandoc-template' and associate it to `template' context in
> "ox-pandoc.el". Am I mistaken?

There is an `org-pandoc-template' already, it just does not deal with
the metadata used in `org-org-template'. I was thinking of reusing
`org-org-template' directly, but if I understand your suggestion, we
should just copy that code in `org-pandoc-template'. Is this correct?

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm


signature.asc
Description: PGP signature


Re: [O] Time-zone in dates

2015-06-29 Thread Eric S Fraga
On Friday, 26 Jun 2015 at 21:57, franc...@avalenn.eu wrote:

[...]

> It is really simpler programmatically to deal with time offsets
> instead. The downside is that you cannot manage DST and other similar
> peculiarities but the API is much simpler to write.

Time offsets are not sufficient.  My Australia experience involved me
living in South Australia while working with colleagues in the UK.  The
time difference throughout the year was one of 8.5 hours, 9.5 hours or
10.5 hours, depending on the various switches to and from daylight
savings.  Very annoying and confusing to manage...

To be effective and usable, org will need to incorporate time zone
information.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1253-gaa9c4b



Re: [O] problem with ox-pandoc export

2015-06-29 Thread Nicolas Goaziou
Alan Schmitt  writes:

> It seems that (org-org-template) is not available in the currently
> released version (I looked into the maint branch and could not see
> it).

Correct.

> Is there a way to support both the master and the maint branch for
> ox-pandoc?

Since you are going to override it anyway, how does it matter? Just
define `org-pandoc-template' and associate it to `template' context in
"ox-pandoc.el". Am I mistaken?

Regards,



Re: [O] org-log-reschedule: inactive time-stamp instead

2015-06-29 Thread Daimrod
Nicolas Goaziou  writes:

> Hello,
>
> M  writes:
>
>> I wonder if I get something wrong, but in the variable org-log-note-headings
>> I see
>>
>>   Heading when rescheduling
>>   String: Rescheduled from %S on %t
>> Shouldn't the %S represent a TODO state (which makes no sense)?
>
> %S represents the last "state". If you change a TODO keyword, is also
> a TODO keyword (or lack thereof). If you alter a timestamp, it is that
> timestamp.
>
>> Can I replace it by an inactive timestamp?
>
> Is there any use case for an active timestamp at this location anyway?
> If there is not, we could automatically convert it to an inactive
> timestamp.
>
> WDYT?

I don't have any use for an active location here. IMO it clutters the agenda
with senseless entries.

Best,

-- 
Daimrod/Greg


signature.asc
Description: PGP signature


Re: [O] HTML/images zipped?

2015-06-29 Thread Rasmus
Hi Robert,

Robert Klein  writes:

> please find an experimental htmlzip exporter attached.

Cool!

I don't know if you indent to make this an extension to org or for this to
be a quick hack to solve a particular issue.

If the former: Shouldn't this rather be something that is configurable
from via a keyword in ox-html or more logically via ox-publish (which can
consist of several files)?  If so, you could store the list of files in
the info communication channel rather than org-htmlzip--image-list.

The command used for compression should be configurable.

Also, if the point is to produce an offline version, you should also
include scripts and css files.

Thanks,
Rasmus

-- 
A clever person solves a problem. A wise person avoids it




Re: [O] problem with ox-pandoc export

2015-06-29 Thread Alan Schmitt
Hello Nicolas,

On 2015-06-27 12:26, Nicolas Goaziou  writes:

> "ox-org" inserts meta-data in its template function (org-org-template).
> Since you're overriding it in the `mytest' back-end, you need to take
> care of that.

It seems that (org-org-template) is not available in the currently
released version (I looked into the maint branch and could not see it).
Is there a way to support both the master and the maint branch for
ox-pandoc?

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm


signature.asc
Description: PGP signature


Re: [O] HTML/images zipped?

2015-06-29 Thread Robert Klein
Hello,

please find an experimental htmlzip exporter attached.

Publishing doesn't work, yet (and would, as I began to write it,
export to individual zip files -- one per published org file --
instead of a single zip file).

It is a derived HTML exporter.  I took a lot of stuff from the
corresponding functions in the HTML and LaTeX exporter.

I'm putting an advice on org-html--format-image during "zip" export to
get a list of inline images, so I can put them together with the html
in the zip file.  (Another possibility would be to `rewrite' the
functions org-html-latex-environment, org-html-latex-fragment, and
org-html-link as translate functions for the new exporter (with the
only purpose to run a org-htmlzip--image-list instead of
org-html--image-list).

Best regards
Robert



On Fri, 26 Jun 2015 09:10:25 -0400
Peter Davis  wrote:

> 
> Is there any way to export HTML with all references images,
> etc. packaged in a ZIP file?
> 
> Thank you.
> 
> -pd
> 
> 

;;; ox-htmlzip.el --- Zipped HTML Back-End for Org Export Engine

;; Copyright (C) 2015 Free Software Foundation, Inc.

;; Author: Robert Klein 
;; Keywords: HTML, zip

;; This file is not part of GNU Emacs.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see .

;;; Commentary:

;; This library implements an zip-addon for the HTML back-end for the
;; Org generic exporter.

;;; Code:

;;; Dependencies

(require 'ox)
(require 'ox-html)  ;; in turn requires ox-publish and ox.

;;; Define Derived Back-End
(org-export-define-derived-backend 'htmlzip 'html
  :menu-entry
  '(?h "Export to HTML"
   ((?z "To zipped file" org-htmlzip-export-to-htmlzip)
	))
  :options-alist
  '()
  :translate-alist
  '())

;;; Internal variables

(defvar org-htmlzip--image-list nil
  "Images to upload/change URL in buffer.")


;;; Internal Functions

(defun org-htmlzip--add-image (source attributes info)
  "Add image file name org-htmlzip--image-list.

Used as an advice for org-html--image-format during htmlzip
export."
  (add-to-list 'org-htmlzip--image-list source))
  

;;; helper functions for export


;;; End-user functions

;;;###autoload
(defun org-htmlzip-export-to-htmlzip
  (&optional async subtreep visible-only body-only ext-plist)
  "Export current buffer to a HTML file.

If narrowing is active in the current buffer, only export its
narrowed part.

If a region is active, export that region.

A non-nil optional argument ASYNC means the process should happen
asynchronously.  The resulting file should be accessible through
the `org-export-stack' interface.

When optional argument SUBTREEP is non-nil, export the sub-tree
at point, extracting information from the headline properties
first.

When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements.

When optional argument BODY-ONLY is non-nil, only write code
between \"\" and \"\" tags.

EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to
file-local settings.

Return output file's name."
  (interactive)
  (advice-add 'org-html--format-image :before #'org-htmlzip--add-image)
  (setq org-htmlzip--image-list nil)
  (let* ((extension (concat "." (or (plist-get ext-plist :html-extension)
org-html-extension
"html")))
	 (file (org-export-output-file-name extension subtreep))
	 (org-export-coding-system org-html-coding-system)
 (zipfile (org-export-to-file 'html file
async subtreep visible-only body-only ext-plist
(lambda (file) (org-htmlzip--zip file)
(setq org-htmlzip--image-list nil)
(advice-remove 'org-html--format-image #'org-htmlzip--add-image)
zipfile))

(defun org-htmlzip--zip (htmlfile)
  " Zip a HTML file.

HTMLFILE is the name of the exported HTML file being zipped.
Inline image file names are taken from the global variable
or-html--image-list.

Return ZIP file name."
  (let* ((base-name (file-name-sans-extension (file-name-nondirectory htmlfile)))
	 (full-name (file-truename htmlfile))
	 (out-dir (file-name-directory htmlfile))
 (zip-file (concat base-name ".zip"))
	 ;; Properly set working directory for compilation.
	 (default-directory (if (file-name-absolute-p htmlfile)
(file-name-directory full-name)
			  default-directory)))
;; delete zip file if it exists
(when (file-exists-p zip-file)
  (delete-file zip-file))
;; zip n

Re: [O] contrib/lisp/ox-taskjuggler.el patch

2015-06-29 Thread Nicolas Goaziou
Hello,

Глеб Бородуля  writes:

> I want to pull some changes in contrib/lisp/ox-taskjuggler.el file
> There is patch in attach, created with git format-patch
> Manually written change log here:

Thank you for the patch. Comments follow.

> ox-taskjuggler.el: Minor enhancements in taskjuggler export

It would be better to split these enhancements into as many patches.

> * contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el
> (org-taskjuggler--build-project): added new custom variable
> `org-taskjuggler-default-project-configuration' that can be used to
> configure additional project fields.

You need to capitalize the sentence. Also, it looks like you're using an
outdated "ox-taskjuggler.el". See below.

> (org-taskjuggler-get-end): added support for `end' property instead
> only standard org deadline value.

Ditto.

> (org-taskjuggler--build-task): added support for multiple allocations,
> specified by separators.

Not sure about the usefulness of this one. According to
,

  allocate task1, task2, task3

is valid. There's apparently no need to split the task list.

> -(and deadline (org-timestamp-format deadline "%Y-%02m-%02d"
> +(or
> + (and deadline (org-timestamp-format deadline "%Y-%02m-%02d"))
> + (and (memq 'end org-taskjuggler-valid-task-attributes)
> +   (org-element-property :END item)

You don't need to check `org-taskjuggler-valid-task-attributes' here
since you're not applying it to a task.

>  channel.  If no start date is specified, start today.  If no end
>  date is specified, end `org-taskjuggler-default-project-duration'
>  days from now."
> -  (format "project %s \"%s\" \"%s\" %s %s {\n}\n"
> +  (format "project %s \"%s\" \"%s\" %s %s {%s\n}\n"
>(org-taskjuggler-get-id project info)
>(org-taskjuggler-get-name project)
>;; Version is obtained through :TASKJUGGLER_VERSION:
> @@ -726,7 +734,10 @@ days from now."
>(format-time-string "%Y-%m-%d"))
>(let ((end (org-taskjuggler-get-end project)))
>  (or (and end (format "- %s" end))
> -(format "+%sd" org-taskjuggler-default-project-duration)
> +(format "+%sd" org-taskjuggler-default-project-duration)))
> +   (mapconcat
> +'org-element-normalize-string
> +org-taskjuggler-default-project-configuration "")))

Current definition for org-taskjuggler--build-project is

  (concat
 ;; Opening project.
 (format "project %s \"%s\" \"%s\" %s %s {\n"
   (org-taskjuggler-get-id project info)
   (org-taskjuggler-get-name project)
   ;; Version is obtained through :TASKJUGGLER_VERSION:
   ;; property or `org-taskjuggler-default-project-version'.
   (or (org-element-property :VERSION project)
   org-taskjuggler-default-project-version)
   (or (org-taskjuggler-get-start project)
   (format-time-string "%Y-%m-%d"))
   (let ((end (org-taskjuggler-get-end project)))
 (or (and end (format "- %s" end))
 (format "+%sd"
 org-taskjuggler-default-project-duration
 ;; Add attributes.
 (org-taskjuggler--indent-string
  (org-taskjuggler--build-attributes
   project org-taskjuggler-valid-project-attributes))
 ;; Closing project.
 "}\n")

Is `org-taskjuggler-default-project-configuration' needed considering
the attributes part above?

> -  (format "  purge %s\n  allocate %s\n"
> -  ;; Compatibility for previous TaskJuggler versions.
> -  (if (>= org-taskjuggler-target-version 3.0) "allocate"
> -"allocations")
> -  allocate))
> +   (concat (format "  purge %s\n"
> +;; Compatibility for previous TaskJuggler versions.
> +(if (>= org-taskjuggler-target-version 3.0) "allocate"
> +  "allocations"))
> +;;support for several allocations divided by separator
> +(mapconcat #'(lambda (allocation)
> +   (format "  allocate %s\n" allocation))
> +   (org-split-string allocate "[ ,]* +")
> +   "")))

Is it really useful? Also, there's no need for #' in front of a lambda.


Regards,

-- 
Nicolas Goaziou