This commit adds a new hook `org-src-mode-hook'.
The Hook run after Org switched a source code snippet to
its Emacs mode. This hook will run
- when editing a source code snippet with \"C-c '\".
- When formatting a source code snippet for export with htmlize.
You may want to use this hook for example to turn off `outline-minor-mode'
or similar things which you want to have when editing a source code file,
but which mess up the display of a snippet in Org exported files.
As the export preprocessor removes indentation from indented blocks,
this causes conflicts about interpreting indentation as list
termination. Now the original indentation is stored in a text
property, so hopefully the exporters can make use of this information
in due time.
All export commands now push the result to the kill ring by default.
This is subject to the variable `org-export-push-to-kill-ring'.
Also, this commit adds a new variable
`org-export-show-temporary-export-buffer' which can be used to turn
off the display of the temporary buffer containing the exported text.
Since this stuff is now automatically pushed onto the kill ring, some
people might prefer not to see this buffer.
There is now a new export function, `org-export-as-org', which
basically creates a copy of the Org file with things like archived
trees, commented trees, and trees deselected by export tags,
stripped.
This commit adds:
{{{date(FORMAT)}}} current date/time, formatted with
`format-time-string'
{{{modification-time(FORMAT)}}} date/time of last modification of
file, formatted with `format-time-string'
{{{input-file}}} the file name of the source Org file.
Shaun Johanson writes:
> Consider the following Org file:
>
> * Test
>
> See [[(foo)][FOOBIE]]
>
> #+BEGIN_EXAMPLE
> <foo>: blah blah (ref:foo)
> #+END_EXAMPLE
>
> Question 1)
> In Org mode the link displays as FOOBIE, in the exported HTML it
> displays as (foo). Is there any way to cause the link to use the
> description (FOOBIE) in HTML? If not would this be a useful option
> to add?
This was a bug, fixed now.
Jason Riedy writes:
> I'm trying to change org-export-latex-image-default-option
> to "width=.7\\linewidth" in a file local variable. It's set
> correctly as a buffer local variable, and it's having no
> effect on the export. My guess is that the buffer-local
> property is stopping it as soon as org-export-as-latex runs
> set-buffer.
>
> I can smuggle the value in by adding an entry to org-export-plist-vars
> referring to org-export-latex-image-default-option and pulling the value
> from the plist, but that feels incorrect.
It is actually the correct way to do this, and I have
implemented this change.
Samuel Wales writes:
> I frequently export to ascii without wanting a file to be created,
> especially not in a useful directory, as the files are temporary.
>
> Is there a way to export ascii to just a buffer?
There is now, `C-c C-e A'.
This commit also implements commands
- org-export-as-ascii-to-buffer
- org-replace-region-by-ascii
- org-export-region-as-ascii
which are similar to what is available for HTML and LaTeX.
`C-c C-e A' used to be the key for publishing all projects.
This functionality has now been moved to `C-c C-e E'.
Chris Gray had the idea to have arbitrary blocks turned in LaTeX
environments and HTML divs. These three new hooks allow
implementation has an add-on rather than a patch.
Thomas Morgan writes:
> I just tried exporting an Org file with LaTeX fragments to HTML
> on a computer that doesn't have dvipng. There were error messages
> in *Messages* ("Failed to create png file..."), but this wasn't
> obvious to me at first glance because those messages were replaced
> in the echo area by "Exporting... done" before I could see them.
>
> So I was wondering, is there a good way to make the user aware of
> those errors? Maybe by printing "Exporting... done (with errors)"?
There is now a better error message when either the latex or the
dvipng program does not exist.
Matt Lundin writes:
> If it's not too much trouble, I was wondering if I could
> request the following properties to set export options for
> subtrees:
>
> EXPORT_AUTHOR
> EXPORT_DATE
>
> In addition to specifying an EXPORT_FILE and EXPORT_TITLE
> for a subtree, I often find myself wanting to change the
> date and author lines.
Users can now define custom IDs for use in HTML export.
These IDs are stores as property CUSTOM_ID. When present, HTML will
prefer using these over automatic targets like "sec-N.M".
Some of the standard export options are now defined in backend
specific files. This commit makes sure that building the options
property list will not cause an error because of unneeded (for the
backend) undefined variables.
When exporting to a temporary buffer, images to replace LaTeX
fragments cannot be produced, because there is no useful location
where they can be put. Therefore, these images are not produced in
this case.
In verse environments, line breaks are now enforced both in LaTeX and
in HTML. Centering is now implemented using a div rather than a
paragraph, so that there may be several paragraphs in the centering
environment. Blockquotes now also may have several paragraphs.
If a link is [[#name][desc]], the href wil be exacty href="#name".
So starting a link target with # will indicate that there will be an
explicit target for this.
Hsiu-Khuern Tang writes:
> If I export the file
>
> --------------------------------------------------
> #+OPTIONS: ^:{}
>
> * test
>
> a_{\alpha}
>
> a_{foo}
> --------------------------------------------------
>
> as HTML, I get "a_{α}" but "a<sub>foo</sub>": \alpha is not
> subscripted but foo is. I was expecting both to be subscripted,
> since they are in {}.
This is a bug, fixed now.
Message-mode assigns auto-safe file names to temporary buffers, in the
draft directory. This causes problems when running message-mode in a
temporary buffer with with-temp-buffer. When the form tries to kill
the buffer, is asks for saving it....
This commit turns off the buffer-modified flag and so avoids the
query.
Patch by Nick Dokos.
uuidgen ids may start with a number and therefore are not valid names
in HTML. Therefore we now use and "ID-" prefix for such IDs when
exporting to HTML.
Before, the bibliography will exist inside the outline structure, as
part of the last section. This commit adds code to find it, cut it
out, and move it to a better location.
Links with description not create a note before the next headline that
contains the link. In the text, the description will be shown.
The new variable `org-export-ascii-links-to-notes' can be configured
to turn off this behavior, then the reference will be inserted inline
in the text. If the line becomes too long because of this, it will
be wrapped.
A line: #+MARCO: name replacement text
can be referenced by {{{name}}}. As special cases, {{{title}}} will
reference #+TITLE, and similar with similar lines.
Like TODO keywords before, now also tags each get their own CSS class,
given by the tag itself. Invalid characters in tags are all replaced
by "_" to make sure the resulting HTML remains valid.
Two new variables can be used to add a prefix to the class names for
TODO keywords and tags.
Clock lines are now by default captured into the drawer LOGBOOK. This
means that, if state notes are also captured into a drawer, they will
be mixed with notes.
Wanrong Lin writes:
Right now in the HTML export the TODO keywords have either
class="todo", or class="done". That loses all the face properties
in the original TODO keywords. I think the TODO keywords faces are
important visual aids to differentiate different types of TODO
items, so I just wonder whether it is possible to keep the faces
in the HTML.
This makes sense. This commit adds, to each TODO keyword, an
additional class named after the keyword. For example:
<span class="todo WAITING">WAITING</span>
So each todo keyword gets class "todo" or "done" depending on which
general type it is. And in addition it gets itself as class.
So go to your CSS file and configure like this:
.todo { font-weight:bold; }
.done { font-weight:bold; }
.TODO { color:red; }
.WAITING { color:orange; }
.DONE { color:green; }
Thanks to Sebastian Rose for the multiple-classes trick.
William Henney writes:
Consider a structure like this:
* first
** second
*** third
**** fourth
Currently, if I export the "third" sub-tree to html (via "C-c @
C-x C-e h"), then "third" becomes an <h1> heading, but "fourth"
becomes an <h5> heading. I would rather it were <h2>, i.e. that
all heading levels be relative to the root of the sub-tree. Is
there any way to achieve this?
This was not possible so far, but this commit measures the first
headline of the subtree and applies an offset to all level values.
The id for the footnotes div is now called "text-footnotes", not
"footnotes-text", to be more consistent with other divs used in
Org-mode.
Requested by Sebastian Rose.
There were two bugs:
1. Timestamp processing did not honor the setting of
`org-export-with-timestamps' in the text before the first
headline.
2. When `org-export-with-timestamps' was nil, time stamps were removed
even in tables. I think this is incorrect, so in tables, time
stamps are now never removed.
Two new variables, `org-export-html-inline-image-extensions' and
`org-export-latex-inline-image-extensions' now define the file
extensions that will be considered for inlining images. The default
for HTML is png, jpg, jpeg, and gif files. The default for LaTeX is
png, jpg, jpeg, and pdf, assuming processing with `pdflatex'.
For LaTeX export, this can lead to conflicts for links that point
to non-image PDF files. To avoid that such a link will be inlined by
accident, always give a description text for such a link, one that is
not equal to the path.
The special first column in some tables was not removed for LaTeX
export. This bug was probably introduces recently, while trying to
fix problems with special characters in LaTeX tables.
Export is now working again properly.
Reported by Giovanni Ridolfi.
The end of the last line of a colon example is not protected, and this
caused the time stamp removal protection to fail if a time stamp was
the last thing in such an example.
Lines preceded by a colon are treated as fixed-width examples.
This commit improves the moment when the protection of these lines
happens during preprocessing. And it enforces that a space must
follow the colon for the line to be treated in this way.
1. Export hangs during LaTeX export. That was a bug using an empty
regular expression that was defined only locally in Org files, but
not in the buffer used by the LaTeX exporter.
2. Underscores in links can get special treatment by the LaTeX
exporter. Now the link is protected from this.
When including s file in example or src markup, you can now also
specify the switches for code references and line numbering that work
also when directly adding SRC or EXAMPLE blocks.
Reported by Manish.
This commit removes some of the stuff that was specific for the LaTeX
exporter, and falls back to the default configuration that works for
all backends.
Here is what the commit does:
- The variable `org-export-latex-remove-from-headlines' is now
obsolete. Instead, also LaTeX export now responds to the settings
in the variables org-export-with-todo-keywords',
`org-export-with-priority', and `org-export-with-tags' and in the
corresponding OPTION settings.
- Removal of time stamps and related keywords now already happens in
the preprocessor, so that it will be perfectly the same for all
backends.
- The list functions have been extended to accept an additional
parameter list, to overrule the default setting for a particular
list function. This is used to make the checkbox appearance in
LaTeX configurable, through the new variable
`org-export-latex-list-parameters'.
This patch introduces more hooks for preprocessing the export buffer,
at various strategic moments. See the Changes.org file for a
description of the hooks.
Org-mode allows multiple references to the same footnote. However,
the HTML exporter cannot use the same name for all these references,
because names have to be unique. This patch appends numbers to
footnote reference names, to make sure they remain unique.
The dark side of this patch means that from the footnote definition,
there is only a single link, to the first reference of the note.
However, in a browser you can always press BACK to go back after
jumping to a footnote definition.
This patch covers the three main backends, html, latex, and ascii. It
adds the code to make sure the coderef links identified by the
preprocessing will be implemented correctly when a backend does its work.
This patch covers the much of the new line numbering and code line
referencing.
We introduce a new function with the longish name
`org-export-replace-src-segments-and-examples'. It is an extension of
the earlier `org-export-replace-src-segments'. It now also covers
EXAMPLE blocks, not only source code blocks. This was necessary to
allow line numbering also in EXAMPLE blocks.
Both clock types now accept a string with options which will be given
in the BEGIN line. Options currently recognized are -n, +n, and -r.
A bit unsatisfactory about this patch may be that LaTeX-specific code
is now defined in org-exp.el, maybe eventually we want to think of a
way to move this code back to org-export-latex.el. Really, all it
does is adding line numbers and wrapping them into a verbatim
environment.
Besides adding line numbers in a backend specific way, this patch also
adds code to search or special cookies in source code, like "((1))" or
"((name))". These are labels that can be addressed by links as
references to specific line in source code.
This patch adds a new constant with javascript functions. Each
exported HTML file will contain these definitions. Also, we add to
the default export CSS style a new class, code-highlighted, which will
be used to highlight lines in code whenever the mouse overs over a
link to this line.
Unique identifiers for entries can now be used more efficiently.
Internally, a hash array has replaced the alist used so far to
keep track of the files in which an ID is defined. This makes it
quite fast to find an entry by ID.
There is now a new link type which looks like this:
id:GLOBALLY-UNIQUE-IDENTIFIER
This link points to a specific entry. When you move the entry to
a different file, for example if you move it to an archive
file, this link will continue to work.
The file /org-id.el/ contains an API that can be used to write
code using these identifiers, including creating IDs and finding
them wherever they are.
Org has its own method to create unique identifiers, but if the
system has /uuidgen/ command installed (Mac's and Linux systems
generally do), it will be used by default. You an also select
the method by hand, using the variable =org-id-method=.
If the ID system ever gets confused about where a certain ID is,
it initiates a global scan of all agenda files with associated
archives, all files previously known containing any IDs, and all
currently visited Org-mode files to rebuild the hash. You can
also initiate this by hand: =M-x org-id-update-id-locations=.
Running this command will also dump into the =*Messages*= buffer
information about any duplicate IDs. These should not exist, but
if you /copy/ an entry with its properties, duplicate IDs will
inevitably be produced. This is unavoidable in a plain text
system that allows you to edit the text in arbitrary ways, and a
portion of care on your side is needed to keep this system clean.
The hash is stored in the file =~/.emacs.d/.org-id-locations=.
This is also a change from previous versions where the file was
=~/.org=id-locations=. Therefore, you can remove this old file
if you have it. I am not sure what will happen if the =.emacs.d=
directory does not exists in your setup, but in modern Emacsen, I
believe it should exist. If you do not want to use IDs across
files, you can avoid the overhead with tracking IDs by
customizing the variable =org-id-track-globally=. IDs can then
still be used for links inside a single file.
IDs will also be used when you create a new link to an Org-mode
buffer. If you use =org-store-link= (normally at =C-c l=) inside
en entry in an Org-mode buffer, and ID property will be created
if it does not exist, and the stored link will be an =id:= link.
If you prefer the much less secure linking to headline text, you
can configure the variable =org-link-to-org-use-id=. The default
setting for this variable is =create-if-interactive=, meaning
that an ID will be created when you store a link interactively,
but not if you happen to be in an Org-mode file while you create
a remember note (which usually has a link to the place where you
were when starting remember).
Tables, and Hyperlinks that represent inlined images, can now be
equipped with additional information that will be used during
export. The information will be taken from the following special
lines in the buffer and apply to the first following table or
link.
- #+CAPTION: :: The caption of the image or table. This string
should be processed according to the export backend, but
this is not yet done.
- #+LABEL: :: A label to identify the figure/table for cross
references. For HTML export, this string will become the
ID for the `<div class="figure">' element that encapsulates
the image tag and the caption. For LaTeX export, this
string will be used as the argument of a `\label{...}'
macro. These lables will be available for internal links
like `[[label][Table] ]'.
- #+ATTR_HTML: :: Attributes for HTML export of image, to be
added as attributes into the `<img...>' tag. This string
will not be processed, so it should have immediately the
right format.
- #+ATTR_LaTeX: :: Attributes for LaTeX export of images, to
be inserted into the optional argument of the
`\includegraphics[...]{file}' command, to specify scaling,
clipping and other options. This string will not be
processed, so it should have immediately the right
format, like `width=5cm,angle=90'
For LaTeX export, if either a caption or a label is given, the
element will be exported as a float, i.e. wrapped into a figure
or table environment.
Xerxes Folupa writes:
> I spotted a little inconsistency in the way Org strips tags when
> processing #+begin_verse ... #+end_verse, and #+begin_quote
> ... #+end_quote blocks, compared with other literal blocks that strip
> superfluous <p> tags correctly (e.g. #+html)
[...]
> Additional question: is the space before the <br/> in verse blocks a
> design decision?
This patch fixes these issues.
It seems that CSS and Java-script stuff should be quoted in a very
strange way in order to make sure that the resulting file functions
correct in current browsers *and* validates against various XHTML and
XML standards. To be honest, the quoting technique seem really
strange, but Sebastian Rose argues, that this is the way to handle
this issue.
Harri Kiiskinen suggested that it might be useful to make the LOCATION
property an inherited property during iCalendar export. In this way
you can have set the LOCATION for a whole set of items by setting it
only in the parent.
While this will slow down iCalendar export for large files, I think it
can be quite useful. This patch does implement the basic code needed
for this functionality. However, you still need to tell Org that
LOCATION should be inherited, by setting org-use-property-inheritance.
If you set it to t, beware that this may trigger a significant
slowdown when creating the match view in the agenda. So it may be
better to set this variable to
(setq org-use-property-inheritance '("LOCATION"))
instead.
This patch improves the internal handling of the large number of
export options that Org-mode has. In particular, it now defines a
single constant, `org-export-plist-vars' that contains the full list
of options, and how these can be accessed through variables, and
through the #+OPTIONS line. Before the patch, there used to be a
separate list or the OPTIONS handling, which has gotten out of sync.
This now no longer can happen.
Also, this patch adds two new variables, `org-export-with-priority',
and `org-export-with-todo-keywords', which can be used to turn the
export of TODO keywords and priority cookies on and off, so that these
can simply disappear and not be shown in the exported file. In fact,
the default for the priority cookie is to remove it.
When the export skips the text before the first headline, we now
include the comment line before the first headline, if any.
This makes sure that we can specify an anchor for this headline.
"\\" at the end of a line marks forces line breaks for HTML and LaTeX
export. ASCII export does preserve lines anyway, but these line break
indicators might still be present and need to be removed.
Reported by Rustom Mody.
A link to an image can function as the description part of a link, to
create a clickable image. The corresponding image tag was
erroneously processed like normal text. This patch protects such
descriptions from processing.
Reported by Richard Riley.
Org allows to define invisible anchors in a document in comment lines
like
If such a line is directly before or after a headline, previously this
anchor was removed, and all references to it were replaced with
references to the anchor that the headline had anyway.
Matthew Lundin pointed out that this makes it impossible to have
permanent links to headlines that can also be used from outside the
current page.
This patch changes his situation by adding the additional targets as
empty anchors to the section heading. If works by creating, during
preprocessing, an alist with targets that do have aliases. During
publishing, these aliases are looked up and converted into anchors.
In LaTeX export, these additional targets become additional labels.
This is a bugfix. When the number of headline levels was set to zero,
or if there was no heading at all in the export, the final closing
</div> should not be present.
This patch implements the possibility to translate links.
It can be useful if use both planner and Org-mode, if you sometimes
copy text from one side to the other and you do not want to worry
about link syntax. This patch allows links created with planner to
function correctly in Org-mode. I would probably be simple to
implement the reverse conversion in planner as well.
This patch is a first shot at this functionality and very likely can
be improved.
iCalendar export has now improved compliance with RFC 2445.
Now all occurrences in data fields of the double quotes are replaced
by two single quotes, and any fields containing comma, colon, or
semicolon are quoted by surrounding them with double quotes.