Re: [O] parameterizing keyword values during a #+call
Gary Oberbrunner writes: > I've been having the same issue (exporting to HTML and PDF, and need all my > graphics filenames to adjust automatically). > > I mostly don't use #+CALL though; I just have src blocks. > > #+BEGIN_SRC python :session UDpython :exports results :results file > do_hbar('/tmp/machines-by-os.pdf', (8,1.5), data) > #+END_SRC > > Is there any way of interpolating the elisp value into the middle of a src > block? I guess I can add another #+HEADER line: > > #+HEADER: :var filename=(ext "/tmp/machines-by-os") > #+BEGIN_SRC python :session UDpython :exports results :results file > do_hbar(filename, (8,1.5), data) > #+END_SRC > > Is that the recommended method? > It looks to me like it should work just fine. > > Org-mode macros that got expanded in the middle of babel source block > text would be cool. Just saying. > I don't see the benefit of a macro expansion over the use of variables as you demonstrate above. Cheers, > > > > On Tue, Apr 30, 2013 at 10:40 AM, Greg Minshall wrote: > >> Eric, >> >> just for completeness, and in case this may be of use to other people, >> below is the result of my question + your suggestions. the following >> illustrates org-mode plus asymptote producing a .svg file during html >> export, and a pdf file during any other (presumably, latex) export. >> >> thanks again, Greg >> >> # trying to get graphics that works for both latex/beamer and for html >> >> # here's a suggestion from Eric Schulte >> # http://article.gmane.org/gmane.emacs.orgmode/71301 >> # with this clarification >> # http://article.gmane.org/gmane.emacs.orgmode/71393 >> # which produced the following >> >> # we define an emacs lisp macro ext that produces a file extension >> # of "svg" or "pdf" depending on whether we are exporting to html or >> # to some other source. this macro is called when computing the >> # output file name argument in a call to an asymptote routine as in: >> # >> # #+call: rectangle[:file (ext twod-1)](TSIZE=1.0) :results file >> # >> # which calls an asymptote routine (defined in our file) called >> # rectangle to produce a file called twod-1.svg or twod-1.pdf. >> >> # define the ext emacs lisp macro (i think in the following you *need* >> # ":exports results" -- instead of ":exports none" -- to make sure the >> # code is executed during export; the ":results silent" keeps any >> # output -- or nil -- from showing up in the output file.) >> >> #+begin_src emacs-lisp :exports results :results silent >> (defmacro ext (base) >> (format "%s.%s" base >> (if (and (boundp 'backend) (equal backend 'html)) "svg" >> "pdf"))) >> #+end_src >> >> >> # follows an example use of the above macro >> >> # first, define a asymptote function (org-named "rectangle") that >> # draws a rectangle >> #+name: rectangle >> #+begin_src asymptote :var TSIZE=1.0 :exports none >> import trembling; >> size(100); >> int off = 2, width = 100, height = 30; >> string tsize = format("%g", TSIZE); >> tremble tr0=tremble(angle=0); // no trembling >> tremble tr10=tremble(angle=10,frequency=0.1,random=50,fuzz=1); >> >> picture rectangle(pair sw, pair ne, int offset, string text, tremble tr) >> { >> picture pic; >> path g = >> >> (sw.x+offset,sw.y+offset)--(ne.x-offset,sw.y+offset)--(ne.x-offset,ne.y-offset)--(sw.x+offset,ne.y-offset)--cycle; >> label(pic, text, ((sw.x+ne.x)/2, (sw.y+ne.y)/2)); >> draw(pic, tr.deform(g)); >> return pic; >> } >> >> add(rectangle((0,0),(width,height),0, "", tr0)); >> add(rectangle((0,0),(width,height),off, tsize, tr10)); >> #+end_src >> >> # now, invoke the above asymptote function, producing a file called >> # either twod-1.svg or twod-1.pdf: >> >> #+call: rectangle[:file (ext twod-1)](TSIZE=1.0) :results file >> >> # now, you can C-c C-e l o or C-c C-e h o and see the image in the >> # two formats >> >> # $Id: parameterizing.org,v 1.2 2013/04/30 14:37:29 minshall Exp $ >> >> -- Eric Schulte http://cs.unm.edu/~eschulte
Re: [O] org-blog 0.9 release
On Wed, May 1, 2013 at 8:35 AM, Rafael wrote: > Michael Alan Dorman writes: > >> I've just tagged version 0.90 of my org-blog minor mode on github[1]. >> >> This is intended to be a simple but powerful assistant to using Org for >> writing blog posts---there's only two commands at this point, and I >> don't anticipate that number going beyond three anytime soon (though I >> do have that third one planned! ;) >> >> At the moment it only supports WordPress blogs, but the design is very >> modular, and adding support for other back-ends (including, I hope, >> static publishing back-ends) should be relatively painless. If it's >> not, I would be happy to change things to make it so, once I understand >> the issues. > > Thanks a lot for your work! I just tried it and it worked for me, to > post a basic org-mode file. Are you aware of > https://github.com/punchagan/org2blog? It also has the purpose to post > to wordpress from org, however its author has been busy lately, and > apparently major work is going to be needed to make all its features to > work with the new exporter. Or, if it seems reasonable, we could club the two projects into a single one to give the users something that's better than a sum of the parts! Cheers! Puneeth (aka punchagan)
Re: [O] [PATCH] export to various flavors of (X)HTML
Rick Frankel writes: > Whoops. Wrong key. Patch actually attached to this email... > rick Great, I'll consolidate all these -- would it be better to mush them into one big patch, or to keep them separate (I suppose for ease of rollback, if something goes wrong)? E
Re: [O] org-blog 0.9 release
Michael Alan Dorman writes: > I've just tagged version 0.90 of my org-blog minor mode on github[1]. > > This is intended to be a simple but powerful assistant to using Org for > writing blog posts---there's only two commands at this point, and I > don't anticipate that number going beyond three anytime soon (though I > do have that third one planned! ;) > > At the moment it only supports WordPress blogs, but the design is very > modular, and adding support for other back-ends (including, I hope, > static publishing back-ends) should be relatively painless. If it's > not, I would be happy to change things to make it so, once I understand > the issues. Thanks a lot for your work! I just tried it and it worked for me, to post a basic org-mode file. Are you aware of https://github.com/punchagan/org2blog? It also has the purpose to post to wordpress from org, however its author has been busy lately, and apparently major work is going to be needed to make all its features to work with the new exporter. I hope that you could find the time and motivation to make your package deal with: - inclusion of image files - matematical symbols (that is, wordpress can display LaTeX stuff like $latex a^2+b^2=c^2$ nicely. - syntax code highlighting, native to wordpress. See for example http://thread.gmane.org/gmane.emacs.orgmode/29178/, where some of these feature requests were done for org2blog, and for example my post: http://graphtheoryinlatex.wordpress.com/2012/06/02/a-cayley-graph/ to see these features in action. Rafael
[O] [PATCH] Agenda: Fortnight time span
Agenda: Add fortnight as a time span * lisp/org-agenda.el (org-agenda-custom-commands-local-options): Add fortnight as a choice for org-agenda-span. (org-agenda-span): Add fortnight as a choice for customising org-agenda-span. (): Add 'Fortnight View' to the org-agenda-menu (org-agenda-list): If number of days is 14, start the agenda on weekday (as done for week-long agendas). (org-agenda-ndays-to-span): Return 14 for 'fortnight'. (org-agenda-span-to-ndays): Return 'fortnight' for a 14-day span (org-agenda-later): Go forward 14 days for a fortnight. (org-agenda-view-mode-dispatch): Add 't' for fortnight view. (org-agenda-fortnight-view): New function; similar to org-agenda-week-view. (org-agenda-change-time-span): Recognise 'fortnight' as a span. (org-agenda-compute-starting-span): Recognise 'fortnight' as a span. I find it convenient to use org-agenda to look two weeks ahead; others may also. --- lisp/org-agenda.el | 32 ++-- 1 files changed, 26 insertions(+), 6 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index fe2c743..1d3b323 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -328,6 +328,7 @@ the daily/weekly agenda, see `org-agenda-skip-function'.") (const org-agenda-span) (choice (const :tag "Day" 'day) (const :tag "Week" 'week) +(const :tag "Fortnight" 'fortnight) (const :tag "Month" 'month) (const :tag "Year" 'year) (integer :tag "Custom"))) @@ -1135,6 +1136,7 @@ Custom commands can set this variable in the options section." :group 'org-agenda-daily/weekly :type '(choice (const :tag "Day" day) (const :tag "Week" week) +(const :tag "Fortnight" fortnight) (const :tag "Month" month) (const :tag "Year" year) (integer :tag "Custom"))) @@ -2334,7 +2336,11 @@ The following commands are available: ["Week View" org-agenda-week-view :active (org-agenda-check-type nil 'agenda) :style radio :selected (eq org-agenda-current-span 'week) - :keys "v w (or just w)"] + :keys "v w"] + ["Fortnight View" org-agenda-fortnight-view + :active (org-agenda-check-type nil 'agenda) + :style radio :selected (eq org-agenda-current-span 'fortnight) + :keys "v f"] ["Month View" org-agenda-month-view :active (org-agenda-check-type nil 'agenda) :style radio :selected (eq org-agenda-current-span 'month) @@ -4170,7 +4176,7 @@ items if they have an hour specification like [h]h:mm." (sd (or start-day today)) (ndays (org-agenda-span-to-ndays span sd)) (org-agenda-start-on-weekday - (if (eq ndays 7) + (if (or (eq ndays 7) (eq ndays 14)) org-agenda-start-on-weekday)) (thefiles (org-agenda-files nil 'ifmode)) (files thefiles) @@ -4339,6 +4345,7 @@ items if they have an hour specification like [h]h:mm." (cond ((symbolp n) n) ((= n 1) 'day) ((= n 7) 'week) + ((= n 14) 'fortnight) (t n))) (defun org-agenda-span-to-ndays (span &optional start-day) @@ -4347,6 +4354,7 @@ START-DAY is an absolute time value." (cond ((numberp span) span) ((eq span 'day) 1) ((eq span 'week) 7) + ((eq span 'fortnight) 14) ((eq span 'month) (let ((date (calendar-gregorian-from-absolute start-day))) (calendar-last-day-of-month (car date) (caddr date @@ -7825,6 +7833,8 @@ With prefix ARG, go forward that many times the current span." (setq sd (+ arg sd))) ((eq span 'week) (setq sd (+ (* 7 arg) sd))) + ((eq span 'fortnight) + (setq sd (+ (* 14 arg) sd))) ((eq span 'month) (setq greg2 (list (+ (car greg) arg) (nth 1 greg) (nth 2 greg)) sd (calendar-absolute-from-gregorian greg2)) @@ -7854,7 +7864,7 @@ With prefix ARG, go backward that many times the current span." (defun org-agenda-view-mode-dispatch () "Call one of the view mode commands." (interactive) - (message "View: [d]ay[w]eek [m]onth [y]ear [SPC]reset [q]uit/abort + (message "View: [d]ay[w]eek for[t]night [m]onth [y]ear [SPC]reset [q]uit/abort time[G]rid [[]inactive [f]ollow [l]og[L]og-all [c]lockcheck [a]rch-trees [A]rch-files clock[R]eport include[D]iary [E]ntryText") (let ((a (read-char-exclusive))) @@ -7862,6 +7872,7 @@ With prefix ARG, go backward that many times the current span." (?\ (call-interactively 'org-agenda-reset-view)) (?d (call-interactively 'org-agenda-day-view)) (?w (call-interactively 'org-agenda-week-view)) + (?t (call-interactively 'org-agenda-fortnight-view)) (?m (call-interactively 'org-agenda-month-
[O] Number formatting in tables for LaTeX export
I have a table representing a memory map, something like this: | Start | End | Purpose| |---+--+| | | 1E08 | Bootloader | | 1E09 | 1FFF | Unused (Bootloader expansion) | | 2000 | 3F39 | Application| When I export to LaTeX, '1E08' and '1E09' are interpreted as decimal exponent numbers, and are exported as '1(08)' and '1(09)'. The only way I've found to prevent this is to include the line: #+ATTR_LaTeX: :mode verbatim which produces a rather ugly fixed-font table. Is there an existing solution to this? If not, any ideas for addressing it? Kind Regards, Mike Gauland
Re: [O] how to best make characters invisible in a org-derived mode
On Fri, Apr 26, 2013 at 10:29 PM, Christian Wittern wrote: > Hi orgers, > > In a mode derived from org-mode, I would like to hide some characters with a > special function to make the display cleaner. There are two cases: > - special characters that should be always invisible > - strings matched by a regex that should be invisible > > I would be glad for any pointers or ideas on how to implement this, either > by piggy-packing on org-mode code or by using generic Emacs features. Meant to respond to this earlier. Reading this brought to mind the setting =org-hide-leading-stars=. See this for more: - http://orgmode.org/manual/Clean-view.html Perhaps check out some of those variables, or at least the hiding of leading stars, as it might at least give you some ideas of how this is implemented in Org. I'm no elisper, so that's about the best I can provide and I have no idea of Org's implementation will match your goals, but it was worth a shot. Best regards, John > > All the best, > > Christian > > -- > Christian Wittern, Kyoto > >
Re: [O] parameterizing keyword values during a #+call
I've been having the same issue (exporting to HTML and PDF, and need all my graphics filenames to adjust automatically). I mostly don't use #+CALL though; I just have src blocks. #+BEGIN_SRC python :session UDpython :exports results :results file do_hbar('/tmp/machines-by-os.pdf', (8,1.5), data) #+END_SRC Is there any way of interpolating the elisp value into the middle of a src block? I guess I can add another #+HEADER line: #+HEADER: :var filename=(ext "/tmp/machines-by-os") #+BEGIN_SRC python :session UDpython :exports results :results file do_hbar(filename, (8,1.5), data) #+END_SRC Is that the recommended method? Org-mode macros that got expanded in the middle of babel source block text would be cool. Just saying. On Tue, Apr 30, 2013 at 10:40 AM, Greg Minshall wrote: > Eric, > > just for completeness, and in case this may be of use to other people, > below is the result of my question + your suggestions. the following > illustrates org-mode plus asymptote producing a .svg file during html > export, and a pdf file during any other (presumably, latex) export. > > thanks again, Greg > > # trying to get graphics that works for both latex/beamer and for html > > # here's a suggestion from Eric Schulte > # http://article.gmane.org/gmane.emacs.orgmode/71301 > # with this clarification > # http://article.gmane.org/gmane.emacs.orgmode/71393 > # which produced the following > > # we define an emacs lisp macro ext that produces a file extension > # of "svg" or "pdf" depending on whether we are exporting to html or > # to some other source. this macro is called when computing the > # output file name argument in a call to an asymptote routine as in: > # > # #+call: rectangle[:file (ext twod-1)](TSIZE=1.0) :results file > # > # which calls an asymptote routine (defined in our file) called > # rectangle to produce a file called twod-1.svg or twod-1.pdf. > > # define the ext emacs lisp macro (i think in the following you *need* > # ":exports results" -- instead of ":exports none" -- to make sure the > # code is executed during export; the ":results silent" keeps any > # output -- or nil -- from showing up in the output file.) > > #+begin_src emacs-lisp :exports results :results silent > (defmacro ext (base) > (format "%s.%s" base > (if (and (boundp 'backend) (equal backend 'html)) "svg" > "pdf"))) > #+end_src > > > # follows an example use of the above macro > > # first, define a asymptote function (org-named "rectangle") that > # draws a rectangle > #+name: rectangle > #+begin_src asymptote :var TSIZE=1.0 :exports none > import trembling; > size(100); > int off = 2, width = 100, height = 30; > string tsize = format("%g", TSIZE); > tremble tr0=tremble(angle=0); // no trembling > tremble tr10=tremble(angle=10,frequency=0.1,random=50,fuzz=1); > > picture rectangle(pair sw, pair ne, int offset, string text, tremble tr) > { > picture pic; > path g = > > (sw.x+offset,sw.y+offset)--(ne.x-offset,sw.y+offset)--(ne.x-offset,ne.y-offset)--(sw.x+offset,ne.y-offset)--cycle; > label(pic, text, ((sw.x+ne.x)/2, (sw.y+ne.y)/2)); > draw(pic, tr.deform(g)); > return pic; > } > > add(rectangle((0,0),(width,height),0, "", tr0)); > add(rectangle((0,0),(width,height),off, tsize, tr10)); > #+end_src > > # now, invoke the above asymptote function, producing a file called > # either twod-1.svg or twod-1.pdf: > > #+call: rectangle[:file (ext twod-1)](TSIZE=1.0) :results file > > # now, you can C-c C-e l o or C-c C-e h o and see the image in the > # two formats > > # $Id: parameterizing.org,v 1.2 2013/04/30 14:37:29 minshall Exp $ > > -- Gary
Re: [O] [new exporter] how can I export drawers?
Hi Eric, I haven't been following closely, so I'm just checking that you're aware of a new variable org-export-allow-bind-keywords, which could play a role in the behavior you are seeing. hth, Tom Eric S Fraga writes: > Nicolas, > > further on this: I got my original document working. I had a d:nil line > hidden away in the document which took precedence over my other attempts > to ask for drawers to be exported. Sorry about bothering everybody with > this. > > However, I am still having some strange random behaviour to do with BIND > and multiple invocations of export. I use BIND to change the formatting > for active and inactive time stamps on latex export and it works > sometimes but is ignored other times. I've not figured out a > deterministic recipe to have this consistently repeatable yet but, if > and when I do, I will post here. > > Thanks again, > eric -- Thomas S. Dye http://www.tsdye.com
Re: [O] Collaborating with TODO lists and clocks.
Hi Richard, Thanks for those suggestions - they're definitely helpful. I'll have a bit more of a think, and if I come up with a "more optimal" idea, I'll post again. Cheers, Gareth. Richard Lawrence writes: > Hi Gareth, > > Gareth Smith writes: > >> I hadn't thought of using :tags on a clock table. I still worry if we'll >> find ourselves in a situation where more than one of us has clocked in >> some time on the same task. > > Yes, I agree this might not be optimal, for that case in particular. > One nice thing about this use of tags is that you have a representation > of when more than one person is working on a task, but that makes the > clock less useful, as it can no longer represent an individual's working > time without some effort to separate the clocks of the different owners. > >> For example, often I clock into a task while I do the work of >> sub-dividing it into smaller tasks. And often when I'm actively working >> on a task, I'll create a sub-task of my current-clocked-task on the >> fly. It seems to me that if I continue with this sort of working >> practice, and attempt to collaborate with others who work similarly, >> then we might quickly find that it's not easy to describe a given task >> (or even subtask) as being "owned" by a single person. > > So one problem case is where you "own" a task, but someone else owns one > of its subtasks, e.g.: > > == > * Clock tables > #+BEGIN: clocktable :maxlevel 2 :scope file :tags "+gareth" > #+CAPTION: Clock summary at [2013-04-29 Mon 18:25] > | Headline | Time | | > |++--| > | *Total time* | *3:05* | | > |++--| > | TODO Task 1| 3:05 | | > | \__ TODO Subtask 1 || 1:05 | > | \__ TODO Subtask 2 || 1:00 | > #+END: > #+BEGIN: clocktable :maxlevel 2 :scope file :tags "+john" > #+CAPTION: Clock summary at [2013-04-29 Mon 18:17] > | Headline | Time | | > |++--| > | *Total time* | *1:05* | | > |++--| > | TODO Task 1| 1:05 | | > | \__ TODO Subtask 1 || 1:05 | > #+END: > > * TODO Task 1 :gareth: > CLOCK: [2013-04-29 Mon 18:15]--[2013-04-29 Mon 19:15] => 1:00 > ** TODO Subtask 1:john: >CLOCK: [2013-04-29 Mon 18:15]--[2013-04-29 Mon 19:20] => 1:05 > ** TODO Subtask 2 :gareth: >CLOCK: [2013-04-29 Mon 16:16]--[2013-04-29 Mon 17:16] => 1:00 > == > > Notice that Gareth gets credit for John's time on Subtask 1, because > Gareth owns Task 1. > > You can avoid this particular gotcha in (at least) two ways: > > 1) Remove the :gareth: tag on task 1 and move the clock time to subtask > 2 (more generally, "ownership" tags and clock times should only appear > at the lowest level of the task tree). Maybe this makes the most sense, > but it slows down the worflow a bit and is hard to enforce, etc. > > 2) Use a tag filter like "+gareth-john" to build the clock table (more > generally, the clock table for each person should exclude tags for all > the others). This prevents double counting and is easy to enforce, but > if any tasks have more than one owner, no one will get credit for their > clock times. > >> Again, perhaps my workflow is at fault, and I should be organising >> myself in a more principled way. And perhaps in practice I'll find that >> tasks do tend to be owned by just one person anyway. > > Yeah, it's a hard problem with no general solution that I can see. The > best thing is just to figure out what constraints you're willing to put > on your workflow, given what Org allows you to do. > > Hope that's helpful! > > Best, > Richard
Re: [O] Exporting an article to a (very) specific formatting template
James Harkins writes: [...] > Ok, based on this and Marcin's comments, I'll do it the LaTeX way (which was > my first choice anyway). I think this is a good choice. It's what I try to do whenever possible. And for cases where the submission is meant to be "camera ready", the latex produced papers always stand out because they just simply look better! -- : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D : in Emacs 24.3.50.1 and Org release_8.0-alpha-307-g3a0e55.dirty
Re: [O] [new exporter] how can I export drawers?
Nicolas, further on this: I got my original document working. I had a d:nil line hidden away in the document which took precedence over my other attempts to ask for drawers to be exported. Sorry about bothering everybody with this. However, I am still having some strange random behaviour to do with BIND and multiple invocations of export. I use BIND to change the formatting for active and inactive time stamps on latex export and it works sometimes but is ignored other times. I've not figured out a deterministic recipe to have this consistently repeatable yet but, if and when I do, I will post here. Thanks again, eric -- : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D : in Emacs 24.3.50.1 and Org release_8.0-alpha-307-g3a0e55.dirty
[O] [Bug] org-startup-with-inline-images
`org-startup-with-inline-images' is a customizable variable. The problem is that if an org file is visited in a non-graphics buffer (or batch), `org-display-inline-images' is called an throws an error ("Non-X frame used"). This problem also occurs when e.g., `org-babel-after-execute-hook' is set to 'org-display-inline-images (which can be mitigated by not setting the hook in a non-x frame). Since the startup variable is a customization, and causes problems if not set programatically, IMHO, the best solution would be to wrap the `org-display-inline-images' function in a test so that is is a no-op on non graphic displays: (defun org-display-inline-images (&optional include-linked refresh beg end) "..." (interactive "P") (when (display-graphic-p) [...]) rick
[O] clocktable for 15-day period, + use as input to source block
Hi, I'm looking for a way to produce a clock-table covering entries in a datetree buffer for a 15-day period (well, actually from 1st-14th & 15th-28/30/31 of the month, but 15 days will do) Also, is there a way to 'name' a clock-tree block so it's output can be used as input to a source code block for some literate programming work? TIA! Subhan -- Subhan Michael Tindall | Software Developer | s...@rentrakmail.com RENTRAK | www.rentrak.com | NASDAQ: RENT
Re: [O] Exporting an article to a (very) specific formatting template
Dnia 2013-04-30, o godz. 01:57:51 James Harkins < jamshar...@gmail.com> napisał(a): > Ok, based on this and Marcin's comments, I'll do it the LaTeX way > (which was my first choice anyway). Now I'll feel responsible for your LaTeX problems;). Seriously, though: should you run into LaTeX problems, feel free to email me. I'm a long-time (ca half of my life) TeX and LaTeX addict. > Naturally, I'm using org to keep a TODO list of the formatting > details I need to match... > > Thanks. > hjh Happy TeXing -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University
Re: [O] [PATCH] export to various flavors of (X)HTML
Whoops. Wrong key. Patch actually attached to this email... rick From d95a365f547fdc681c530c9088f775b30a37d9aa Mon Sep 17 00:00:00 2001 From: Rick Frankel Date: Tue, 30 Apr 2013 10:35:14 -0400 Subject: [PATCH] Modify processing of xhtml declaration. * lisp/ox-html.el (org-html-template): If `org-html-xml-declaration' is nil or an empty string, don't output a blank line at the head of the document. Also, don't ouput the declaration if the document type is xhtml5. --- lisp/ox-html.el | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index e7cae1a..05b99bf 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1692,19 +1692,21 @@ holding export options." CONTENTS is the transcoded contents string. INFO is a plist holding export options." (concat - (when (org-html-xhtml-p info) - (format "%s\n" - (format (or (and (stringp org-html-xml-declaration) + (when (and (not (org-html-html5-p info)) (org-html-xhtml-p info)) + (let ((decl (or (and (stringp org-html-xml-declaration) org-html-xml-declaration) (cdr (assoc (plist-get info :html-extension) org-html-xml-declaration)) (cdr (assoc "html" org-html-xml-declaration)) - "") - (or (and org-html-coding-system - (fboundp 'coding-system-get) - (coding-system-get org-html-coding-system 'mime-charset)) - "iso-8859-1" + ""))) + (when (not (or (eq nil decl) (string= "" decl))) + (format "%s\n" + (format decl + (or (and org-html-coding-system + (fboundp 'coding-system-get) + (coding-system-get org-html-coding-system 'mime-charset)) + "iso-8859-1")) (let* ((dt (plist-get info :html-doctype)) (dt-cons (assoc dt org-html-doctype-alist))) (if dt-cons -- 1.8.0
Re: [O] parameterizing keyword values during a #+call
Eric, just for completeness, and in case this may be of use to other people, below is the result of my question + your suggestions. the following illustrates org-mode plus asymptote producing a .svg file during html export, and a pdf file during any other (presumably, latex) export. thanks again, Greg # trying to get graphics that works for both latex/beamer and for html # here's a suggestion from Eric Schulte # http://article.gmane.org/gmane.emacs.orgmode/71301 # with this clarification # http://article.gmane.org/gmane.emacs.orgmode/71393 # which produced the following # we define an emacs lisp macro ext that produces a file extension # of "svg" or "pdf" depending on whether we are exporting to html or # to some other source. this macro is called when computing the # output file name argument in a call to an asymptote routine as in: # # #+call: rectangle[:file (ext twod-1)](TSIZE=1.0) :results file # # which calls an asymptote routine (defined in our file) called # rectangle to produce a file called twod-1.svg or twod-1.pdf. # define the ext emacs lisp macro (i think in the following you *need* # ":exports results" -- instead of ":exports none" -- to make sure the # code is executed during export; the ":results silent" keeps any # output -- or nil -- from showing up in the output file.) #+begin_src emacs-lisp :exports results :results silent (defmacro ext (base) (format "%s.%s" base (if (and (boundp 'backend) (equal backend 'html)) "svg" "pdf"))) #+end_src # follows an example use of the above macro # first, define a asymptote function (org-named "rectangle") that # draws a rectangle #+name: rectangle #+begin_src asymptote :var TSIZE=1.0 :exports none import trembling; size(100); int off = 2, width = 100, height = 30; string tsize = format("%g", TSIZE); tremble tr0=tremble(angle=0); // no trembling tremble tr10=tremble(angle=10,frequency=0.1,random=50,fuzz=1); picture rectangle(pair sw, pair ne, int offset, string text, tremble tr) { picture pic; path g = (sw.x+offset,sw.y+offset)--(ne.x-offset,sw.y+offset)--(ne.x-offset,ne.y-offset)--(sw.x+offset,ne.y-offset)--cycle; label(pic, text, ((sw.x+ne.x)/2, (sw.y+ne.y)/2)); draw(pic, tr.deform(g)); return pic; } add(rectangle((0,0),(width,height),0, "", tr0)); add(rectangle((0,0),(width,height),off, tsize, tr10)); #+end_src # now, invoke the above asymptote function, producing a file called # either twod-1.svg or twod-1.pdf: #+call: rectangle[:file (ext twod-1)](TSIZE=1.0) :results file # now, you can C-c C-e l o or C-c C-e h o and see the image in the # two formats # $Id: parameterizing.org,v 1.2 2013/04/30 14:37:29 minshall Exp $
Re: [O] [PATCH] export to various flavors of (X)HTML
On 29.04.2013 02:02, Eric Abrahamsen wrote: Rick Frankel writes: On Fri, Apr 26, 2013 at 10:14:17AM -0700, Eric Abrahamsen wrote: Rick Frankel writes: > See the discussions of polyglot markup @ > http://en.wikipedia.org/wiki/Polyglot_markup > and > http://www.w3.org/TR/2011/WD-html-polyglot-20110405/#dfn-polyglot-markup > for the rationale. Ah, those were interesting links, I hadn't considered those issues. Luckily, your second option was a three-line change to the existing patch: using "xhtml5" now produces the same output as "html5", except that self-closing tags are self-closed, and there's a xmlns declaration in the element. Best of all worlds, I hope. Overall, works well. A couple of things related to `org-html-xml-declaration': - It should not be added by default for xhtml5 (from http://www.w3.org/TR/2011/WD-html-polyglot-20110405/#PI-and-xml): #+BEGIN_QUOTE 2. Processing Instructions and the XML Declaration Processing Instructions and the XML Declaration are both forbidden in polyglot markup. #+END_QUOTE - If `org-html-xml-declaration' is set to nil or the empty string, a blank first line is placed in the document prior to the DOCTYPE declaration. If the above fix is added (so it is not generated for xhtml5) that should solve the immediate problem, but i think that the formatting code in org-html-html-template should check that the inner format (line #1697). A patch is attached to fix both issues. 1. There's a new export option, org-html-html5-fancy/HTML_HTML5_FANCY, which defaults to 'nil, making most of the following opt-in only. Very nice. 5. It's generally accepted that one should use some variety of the html5shiv[1] to make IE <9 render new HTML5 elements correctly. I've dropped a note to this effect in the docstring of `org-html-html5-fancy', but I suppose it's possible we could take a more interventionist stance, perhaps including hosting a version of the shiv on orgmode.org, and linking to it automatically. I guess I'm in favor of leaving it to the user, though. I agree that we should comment and leave it to the user. I believe the owner of html5shiv is against CDN hosting the javascript and feels that it should always be downloaded and included locally. Tangential coding question: I've noticed that setting HTML_HTML5_FANCY to nil at the top of the export file results in `(plist-get info :html-html5-fancy)' returning the string "nil", ie true. Not right, obviously, and it makes it impossible to set it to 'nil per-file if the global value is 't. Am I handling this wrong? I believe Nicolas answered the is a previous email, but the solution is use "'()" and not nil. rick
Re: [O] About indentation when the src block is under a list
Thanks! :) Charles Berry writes: > zwz gmail.com> writes: > > >> Here is an example: >> >> * array >> ** search >>- example >> #+BEGIN_SRC c >> /* find score in scores >>,* return the index if found or -1 */ >> int search(int scores[], int n, int score){ >> int i = 0; >> for(; i> return -1; >> } >> #+END_SRC >> >> >>- test >> > > If you want a manual fix, put point in the begin_src line then use > > C-c ' C-c ' > > that's org-metaright, next-line, org-edit-special, org-edit-src-exit > > HTH,
Re: [O] [new exporter] how can I export drawers?
Nicolas Goaziou writes: [...] > I don't understand your problem. Drawers are correctly exported here. > Could you provided an ECM? Arggghhh. An ECM I just created works just fine. There's obviously something obscurely wrong in my long document that prevents drawers from being exported. I will play around more... sorry for the noise. thanks, eric -- : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D : in Emacs 24.3.50.1 and Org release_8.0.1-60-gcb6284
Re: [O] [Patch] phone links...
Michael Strey writes: > Greg, > > Here are the reworked patches. > > 0390: fixes two typos > 0391: contains all the changes from my last patch and your corrections > 0392: introduces a constant for the default value of separators Excellent. > On Sat, Apr 20, 2013 at 05:59:39PM +0200, Daimrod wrote: >> Michael Strey writes: > >> > Oh =:-|, another struggle with Git. I'm still learning and will do my >> > best. >> >> If you're not already using magit[1] I highly recommend it to you. You >> can use it to commit only a portion of the changes (you can also do it >> with "git commit --interactive" but I find it easier with magit). > > Thanks for the hint. It helped a lot. Merged & pulled. Thanks! -- Daimrod/Greg pgpTZPr3RPNGv.pgp Description: PGP signature
Re: [O] [new exporter] how can I export drawers?
Nicolas Goaziou writes: > Thorsten Jolitz writes: > >> I would like to be able to export drawers to ASCII too, although, as >> Nicolas mentioned in an earlier thread, the ascii exporter currently >> does not handle this. > > Did I say that? > > AFAICT, drawers are correctly exported in ASCII export. You are right, that thread was about property-drawers, drawers are actually exported to ASCII with '#+OPTIONS: d:t'. -- cheers, Thorsten
Re: [O] [new exporter] how can I export drawers?
Hello, Thorsten Jolitz writes: > I would like to be able to export drawers to ASCII too, although, as > Nicolas mentioned in an earlier thread, the ascii exporter currently > does not handle this. Did I say that? AFAICT, drawers are correctly exported in ASCII export. Regards, -- Nicolas Goaziou
Re: [O] [new exporter] how can I export drawers?
Hello, Eric S Fraga writes: > I am going a little crazy here! I have an org document which I need to > export to PDF using latex. Everything works just fine with the new > exporter except for one thing: I cannot get it to export drawers. I > have set org-export-with-drawers to t, I have set "d:t" in the OPTIONS > line, I have defined org-latex-format-drawer-function as described in > the documentation. None of this has made any difference. > > Now, having looked at the code, it almost seems that there is no such > functionality? Grepping for org-export-with-drawers only brings up > three lines in all of lisp/*.el, none of which does anything with this > variable. > > Is there any way to export drawers (LOGBOOK in my case)? I don't understand your problem. Drawers are correctly exported here. Could you provided an ECM? Regards, -- Nicolas Goaziou
Re: [O] Problems with agenda search and restiction enabled
Hi Bastien, · Bastien wrote: > Thomas Holst writes: > >> I want to perform an agenda search with a restriction to a subtree. ...snip... > This is now fixed in the maint branch of the Git repository. > > Thanks for reporting this! thank you for the quick fix. It will be a few days till I have time to test the fix. -- Bis neulich ... Thomas