Re: [O] Bug: HTML export is broken when there are document level headings (TITLE, AUTHOR etc.) [8.3.4 (8.3.4-elpa @ /media/home/neutrico/.emacs.d/elpa/org-20160222/)]

2016-02-29 Thread Marcin Antczak



W dniu 02/29/2016 o 10:15 PM, Nicolas Goaziou pisze:

Hello,

neutrico  writes:


Steps to reproduce:

1. Create org document hello.org :

#+BEGIN_SRC org

#TITLE: Hello

** World

#+END_SRC

2. M-x org-html-export-as-html

Returns:

apply: Wrong type argument: listp, #("HELLO" 0 5 (:parent (#0)))


When I remove TITLE then it's exported propely.

You probably have a mixed installation. This problem has been reported
a few times already and the solution is always to reinstall Org properly
(i.e., before built-in Org is loaded).


Yes, I know about mixed installations.
However my 'org-version is showing that everything is ok.

[8.3.4 (8.3.4-elpa @ /media/home/neutrico/.emacs.d/elpa/org-20160222/)]

1. Is this possible to remove org-mode from Emacs distribution?
As org is available as ELPA package than builtin version causes 
unnecessary trouble.


2. Is this possible to improve 'org-reload function to fix problems with 
mixed installation?


Regards,
Marcin




[O] [Feature request] org-babel-tangle-file add an option to tangle if target-file is older than file.

2014-09-18 Thread Marcin Antczak


As in topic.

I think that if both parameters 'file' and 'target-file' are set and 
'target-file' exists, 'org-babel-tangle-file' should tangle only if 
'target-file' is older.



Marcin



[O] org-babel-load-file misleading function name, wrong behavior

2014-09-18 Thread Marcin Antczak

Hi,

I would like to suggest changing the name to 'org-babel-load-lisp' as 
current name of this function doesn't emphasise that it can tangle and 
load "emacs-lisp" code blocks only.


Another problem is that currently 'compile' option is performed every time.
Which is plain wrong.

Compile option is supposed to improve load time and should be performed 
only when it's neccessary.



Marcin




[O] [Feature Request / Bug] Remove statistic cookies from refile candidates

2014-08-13 Thread Marcin Antczak
I set up my refile targets and this is what I get when I'm trying to 
refile something from notes.org.


```
Refile subtre "Test" to (default devel.org/Project): devel.org/[0\0][0%] 
Project

```

Is this possible to remove automatically these statistics cookies from 
completion candidates list?


I know that I could write some custom function to list refile targets 
but this option could be available by default.



Regards,
Marcin



[O] How to capture to... null

2014-08-11 Thread Marcin Antczak

Hi list,


I would like to use org-capture to create entries on my Gitlab host via 
API and then I would like to make template dissapear and not write 
output data anywhere.


I know that I can use function as target for my capture template.
But when I set template as follows:

(setq org-capture-templates
'(("i"
"issue"
plain
(function
(lambda() ))
:immediate-finish t)))

Then I get this error message:

byte-code: Capture abort: (buffer-read-only #)

Is this possible to tell org-capture to not to try to write output anywhere?


Regards,
Marcin



[O] org-capture-after-finalize-hook not covered by documentation

2014-08-08 Thread Marcin Antczak

As in topic.

org-capture-before-finalize-hook is mentioned, after-finalize is not.


http://orgmode.org/tmp/worg/org-configs/org-hooks.html


From ChangeLog:

2010-12-11  Allen S. Rout(tiny change)

* org-capture.el (org-capture-after-finalize-hook): New hook.
(org-capture-finalize): Run the new hook.



Regards,
Marcin





[O] How to programmatically use/edit data provided on capture

2014-08-02 Thread Marcin Antczak

Hi all!

I got capture template with prompts to collect some properties:

#+BEGIN_SRC
* TODO %\1 / Some task description
   :PROPERTIES:
   :NAME: %^{NAME}
   :END:
#+END_SRC

My question is: How to get information on user input data to transform 
this data before capture finalize.


For example: I got variable NAME and would like to use function like 
(s-dashed-words string) from s.el to make sure that my NAME is valid and 
converted to dashed syntax.


Let's say that my input is: New random project

I would like to have:

#+begin_src
* TODO new-random-project / Some task description
   :PROPERTIES:
   :NAME: "New random project"
   :END:
#+end_src

While currently I got:

#+begin_src
* TODO New random project / Some task description
   :PROPERTIES:
   :NAME: "New random project"
   :END:
#+end_src

I have been trying:

#+BEGIN_SRC
* TODO %(custom-dashify-function %\1) / Some task description
   :PROPERTIES:
   :NAME: %^{NAME}
   :END:
#+END_SRC

or

#+BEGIN_SRC
* TODO %(custom-dashify-function %\\1) / Some task description
   :PROPERTIES:
   :NAME: %^{NAME}
   :END:
#+END_SRC

But apparently function is executed before %\1 is replaced by my data 
and it dodesn't work.
Could someone help me to write function that would get data I provided 
for property NAME, convert using s-dashed-words and return to template 
before finalize?



Marcin







[O] How to properly convert duration to time?

2014-04-06 Thread Marcin Antczak

Hi List,

I would like to export CLOCK with  html5 tag.

I can output :duration as for example: 1:23 (1 hour 23
minutes)

This format is not valid according to w3org specification.
http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#valid-duration-string


How to convert duration to valid time string?



Regards,
Marcin



Re: [O] How to export drawer?

2014-04-04 Thread Marcin Antczak

Nicolas Goaziou writes:

> Marcin Antczak  writes:
>
>> Yes. I want to hard-code these drawers and ignore them in default
>> export.
>
> OK, I get it. You want to move some drawers (relatively to the flow of
> the document) and ignore others.
>

Exactly.

I want to append LOGBOOK and CLOCKTABLE to task headline while any other
drawer should go to content as usual.

>> In this way I could attach HTML code with CLOCKTABLE drawer to headline.
>> Unfortunately as I mentioned before I don't know how to achieve this
>> without recursion. My code returns all CLOCKTABLE drawers in child
>> tasks.
>>
>> org-element-map has optional argument 'no-recursion' but I don't know
>> how to set it up properly.
>
> You can set it to `headline', like you did, but you must skip the
> current headline or `org-element-map' will never enter it:
>
>   (org-element-map (org-element-contents headline) 'drawer #'identity
>   info nil 'headline)


AWESOME!

Thank you very, very much.
Now I need to understand this code. But it works!


Regards,

--
Marcin



Re: [O] How to export drawer?

2014-04-04 Thread Marcin Antczak

Nicolas Goaziou writes:

> Hello,
>
> Marcin Antczak  writes:
>
>> I would like to export some org to html with custom backend based on
>> 'html.
>>
>> What I need is to override function org-html-headline from ox-html.el
>
> OK. But this isn't related to drawers, is it? If you want to alter
> drawers export, you need to override `org-html-drawer' too.

Unfortunately you misunderstood me.

What I want to do is to override drawers export to exclude some
predefined drawers. Let's say: LOGBOOK and CLOCKTABLE.

Then I want to attach these drawers to headline(!)
This is why I want to add a piece of code to return drawer in org-html-headline.

>
>> I just want to export drawer with some specific name. For example
>> LOGBOOK or CLOCKTABLE.
>
> You can set `org-export-with-drawers'. You can also hard-code the list
> into `org-mybackend-drawer':
>
>   (defun org-mybackend-drawer (drawer contents info)
> (when (member-ignore-case (org-element-property :drawer-name drawer)
>   '("LOGBOOK" "CLOCKTABLE"))
>   (org-export-data-with-backend drawer 'html info)))

Yes. I want to hard-code these drawers and ignore them in default export.

Anyway thing is that I want to export drawer with specific name while
I'm in org-html-headline function.

(defun org-html-headline (headline contents info)
  "Transcode a HEADLINE element from Org to HTML.
CONTENTS holds the contents of the headline.  INFO is a plist
holding contextual information."
  ;; Empty contents?
  (setq contents (or contents ""))
  (let* ((numberedp (org-export-numbered-headline-p headline info))
 (level (org-export-get-relative-level headline info))

 And here I wan't to add:

 (clocktable (and (plist-get info :with-drawers)
  (let* ((drawers (org-element-map headline 'drawer 'identity 
info nil 'headline)))
(mapconcat (lambda (d)
 (when (string= (org-element-property 
:drawer-name d) "CLOCKTABLE")
   (org-export-data-with-backend d 'html info)))
   drawers ""


In this way I could attach HTML code with CLOCKTABLE drawer to headline.
Unfortunately as I mentioned before I don't know how to achieve this
without recursion. My code returns all CLOCKTABLE drawers in child
tasks.

org-element-map has optional argument 'no-recursion' but I don't know
how to set it up properly.


Regards,

--
Marcin



[O] How to export drawer?

2014-04-04 Thread Marcin Antczak

Hi List,

I got a problem which is blocker for me and this is why I have to ask
here for help.

I would like to export some org to html with custom backend based on
'html.

What I need is to override function org-html-headline from ox-html.el

I just want to export drawer with some specific name. For example
LOGBOOK or CLOCKTABLE.

So, I got this piece of code

#+BEGIN_SRC el
(let* (clocktable (and (plist-get info :with-drawers)
  (let* ((drawers (org-element-map headline 'drawer 'identity 
info nil 'headline)))
(mapconcat (lambda (d)
 (when (string= (org-element-property 
:drawer-name d) "CLOCKTABLE")
   (org-export-data-with-backend d 'html info)))
   drawers "")
#+END_SRC

And this does what I need well not exactly.

This code returns drawer in html format.
Unfortunately it returns drawers recursively.

If my org file is flat then everything is ok.

If my org file is like this:

#+BEGIN_SRC
* TODO  No clocktable here
  Task with no clocktable
** TODO First clocktable
   :CLOCKTABLE:
   CLOCK: [2014-04-04 pią 02:45]--[2014-04-04 pią 02:45] =>  0:00
   CLOCK: [2014-04-04 pią 02:45]--[2014-04-04 pią 02:45] =>  0:00
   :END:
   Placeholder
*** DONE First SUB clocktable
:CLOCKTABLE:
CLOCK: [2014-04-04 pią 02:45]--[2014-04-04 pią 05:45] =>  3:00
:END:
Sub clocktable here
** TODO Second clocktable
   :CLOCKTABLE:
   CLOCK: [2014-04-04 pią 02:45]--[2014-04-04 pią 03:45] =>  1:00
   :END:
   Second clocktable
#+END_SRC

Then in my task "No clocktable here " I can see all CLOCKTABLES from
children tasks.

Could someone help me to disable this recursion properly?


Cheers,
Marcin



Re: [O] How to get headline title without statistic cookies.

2014-03-30 Thread Marcin Antczak

Nick Dokos writes:

> Marcin Antczak  writes:
>
>> Hi,
>>
>> As in topic.
>> I got some headline with statistic cookies. For example:
>>
>> * My example headline [3/6][50%]
>>
>> How could I output headline text without cookies?
>>
>> (org-element-property :title headline)
>>
>> returns entire title string with cookies.
>>
>> Is there any easy way to avoid them in output?
>>
>>
>
> Do you mean output when exporting?

Yes... and no.
Yes, I did mean output when exporting.

But I forgot to explain that more clearly.
I just needed to filter out statistic cookies in specific part of
export. In my case: in TOC headlines.

>If so, the manual says
>
> #+OPTIONS: stat:nil
>
> should work. See
>
>   (info "(org) Export settings")

Yes. I know that. This should work.

But as I mentioned before. With this option you can enable or
disable statistics cookies in entire document.

While I would like to have these cookies in normal headlines.
But they are unnecessary for me in TOC.

In ox-html.el there is 'org-html--format-toc-headline' function.

After some time I finally have found solution by adding (selective-cookies . 
ignore) option to
:transcoders list.


Thank you anyway,
Marcin



[O] How to get headline title without statistic cookies.

2014-03-30 Thread Marcin Antczak

Hi,

As in topic.
I got some headline with statistic cookies. For example:

* My example headline [3/6][50%]

How could I output headline text without cookies?

(org-element-property :title headline)

returns entire title string with cookies.

Is there any easy way to avoid them in output?


Regards,
Marcin



Re: [O] [Patch] Few small fixes to html header

2014-03-28 Thread Marcin Antczak

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



Re: [O] [Patch] Few small fixes to html header

2014-03-28 Thread Marcin Antczak

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



Re: [O] [Patch] Few small fixes to html header

2014-03-28 Thread Marcin Antczak

Rainer M Krug writes:

> Marcin Antczak  writes:
>
[...]

Is your response intentionally empty or am I missing something?


Marcin



[O] [Patch] Few small fixes to html header

2014-03-27 Thread Marcin Antczak

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

>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:
 nilIgnore 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
 
 <!--/*--><![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: [\"MMLorHT