1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-01-20 19:24:20 +00:00

Allow one comment line before the first headline.

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.
This commit is contained in:
Carsten Dominik 2008-11-21 19:45:51 +01:00
parent 5c7609d4c7
commit 33744b0de5
3 changed files with 9 additions and 4 deletions

View File

@ -2435,9 +2435,10 @@ convenient to put them into a comment line. For example
@end example
@noindent In HTML export (@pxref{HTML export}), such targets will become
named anchors for direct access through @samp{http} links@footnote{Note
that text before the first headline is usually not exported, so the
first such target should be after the first headline.}.
named anchors for direct access through @samp{http} links@footnote{Note that
text before the first headline is usually not exported, so the first such
target should be after the first headline, or in the line directly before the
first headline.}.
If no dedicated target exists, Org will search for the words in the
link. In the above example the search would be for @samp{my target}.

View File

@ -1,5 +1,9 @@
2008-11-21 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-preprocess-string): Allow one comment
line before the first headline to always be included. This is
to not miss a commented target.
* org-mouse.el (org-mouse-insert-item): Call
`org-indent-to-column' instead of `indent-to', for XEmacs
compatibility.

View File

@ -1469,7 +1469,7 @@ on this string to produce the exported version."
;; Get the correct stuff before the first headline
(when (plist-get parameters :skip-before-1st-heading)
(goto-char (point-min))
(when (re-search-forward "^\\*+[ \t]" nil t)
(when (re-search-forward "\\(^#.*\n\\)^\\*+[ \t]" nil t)
(delete-region (point-min) (match-beginning 0))
(goto-char (point-min))
(insert "\n")))