emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Brett Viren <bv@bnl.gov>
To: emacs-orgmode@gnu.org
Subject: Dealing with inter-org links vs #+include
Date: Fri, 28 Apr 2023 11:09:23 -0400	[thread overview]
Message-ID: <87ttx0cacc.fsf@bnl.gov> (raw)

[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]

Hi,

I want what may be two conflicting things:

- Produce a monolithic HTML export of an main org file that #+include:'s
  other org files.

- Have links in the other org files that are valid both when the
  monolith is exported to HTML and when visiting the individual org
  files in Emacs.

Below is a simple test.  The "main.org" includes "a.org" and "b.org".
The "b.org" has two types of links.  The link:

  [[A][A by headline only]]

is valid in the HTML export of "main.org" but it is not valid for Emacs
visiting b.org (C-c C-o gives "No match - create this as a new
heading?").  And then vice versa for the link:

  [[file:a.org::*A][A by file with headline]]

I can follow that link in Emacs but it renders to an <href> with
"a.html#MissingReference".  And export fails outright if I do not
include

  #+options: broken-links:t


Is there a way I can have my cake and eat it too?  That is, how can I
make a link between "sub" org files that can be followed by Emacs and
also that produces a valid HTML link when the main.org is exported?

Thanks!
-Brett.


$ ls *.org
a.org  b.org  main.org

$ for n in *.org
      echo "=== $n ==="
      cat $n
  end
=== a.org ===
* A

This is A.
=== b.org ===
* B

This is B.  Links:
- [[file:a.org::*A][A by file with headline]].
- [[A][A by headline only]].
  
=== main.org ===
#+title: Main
#+options: broken-links:t

* Main

This is main.

* Includes

#+include: a.org
#+include: b.org

* Links

- A :: [[file:a.org]]

- B :: [[file:b.org]]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

             reply	other threads:[~2023-04-28 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 15:09 Brett Viren [this message]
2023-04-29  8:02 ` Dealing with inter-org links vs #+include Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ttx0cacc.fsf@bnl.gov \
    --to=bv@bnl.gov \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).