org-to-xml icon indicating copy to clipboard operation
org-to-xml copied to clipboard

Headings with only links doesn't expand

Open twilight1794 opened this issue 4 years ago • 2 comments

When I write

** [[http://foo.com][bar]]            :tag:

in the XML output is written:

<headline raw-value="[[http://foo.com][bar]]" level="2"/>

But without the link

** Bar       :tag:

the complete set of tags are written to the output:

<headline raw-value="Bar" level="2">
<tags>tag</tags>
<title>Bar</title>

twilight1794 avatar Mar 30 '21 02:03 twilight1794

That's not consistent with what I'm seeing. Given:

#+title: This is a test

** [[http://foo.com][bar]]            :tag:

A heading with a link.

** Bar       :tag:

And a heading without.

The output I get is:

<?xml version="1.0"?>
<!-- Converted from org-mode to XML by om-to-xml version 0.0.7 -->
<!-- See https://github.com/ndw/org-to-xml -->
<document xmlns="https://nwalsh.com/ns/org-to-xml">
<keyword key="TITLE" value="This is a test"/> 
<headline raw-value="[[http://foo.com][bar]]" level="2"><tags>tag</tags><title><link type="http" path="//foo.com" format="bracket" raw-link="http://foo.com">bar</link></title>
<section>
<paragraph>A heading with a link.
</paragraph>
</section> 
</headline> 
<headline raw-value="Bar" level="2"><tags>tag</tags><title>Bar</title>
<section>
<paragraph>And a heading without.
</paragraph>
</section> 
</headline> </document>

Can you provide a complete example where it doesn't work?

ndw avatar Jul 28 '21 08:07 ndw

From this file:

#+title: My bookmarks

* Desktop Bookmarks
** [[http://foo.com][bar]]                                             :work:
A bookmark description
** [[http://google.com][baz]]                                          :home:
** [[http://bing.com][let]]                                            :home:

I get this XML:

<?xml version="1.0"?>
<!-- Converted from org-mode to XML by om-to-xml version 0.0.7 -->
<!-- See https://github.com/ndw/org-to-xml -->
<document xmlns="https://nwalsh.com/ns/org-to-xml">
<keyword key="TITLE" value="My bookmarks"/> 
<headline raw-value="Desktop Bookmarks" level="1"><title>Desktop Bookmarks</title>
<headline raw-value="[[http://foo.com][bar]]" level="2"><tags>work</tags><title><link type="http" path="//foo.com" format="bracket" raw-link="http://foo.com">bar</link></title>
<section>
<paragraph>A bookmark description
</paragraph>
</section>
</headline>
<headline raw-value="[[http://google.com][baz]]" level="2"/>
<headline raw-value="[[http://bing.com][let]]" level="2"/>
</headline></document>

I saw that the bug only occurs on headlines without any content: If I add a property or some text...:

#+title: My bookmarks

* Desktop Bookmarks
** [[http://foo.com][bar]]                                             :work:
A bookmark description
** [[http://google.com][baz]]                                          :home:
** [[http://bing.com][let]]                                            :home:
   :PROPERTIES:
   :icon:     moz-icon
   :END:

I get this:

<?xml version="1.0"?>
<!-- Converted from org-mode to XML by om-to-xml version 0.0.7 -->
<!-- See https://github.com/ndw/org-to-xml -->
<document xmlns="https://nwalsh.com/ns/org-to-xml">
<keyword key="TITLE" value="My bookmarks"/> 
<headline raw-value="Desktop Bookmarks" level="1"><title>Desktop Bookmarks</title>
<headline raw-value="[[http://foo.com][bar]]" level="2"><tags>work</tags><title><link type="http" path="//foo.com" format="bracket" raw-link="http://foo.com">bar</link></title>
<section>
<paragraph>A bookmark description
</paragraph>
</section>
</headline>
<headline raw-value="[[http://google.com][baz]]" level="2"/>
<headline raw-value="[[http://bing.com][let]]" level="2"><tags>home</tags><title><link type="http" path="//bing.com" format="bracket" raw-link="http://bing.com">let</link></title>
<section>
<property-drawer>
<node-property key="icon" value="moz-icon"/>
</property-drawer>
</section>
</headline>
</headline></document>

twilight1794 avatar Sep 09 '21 00:09 twilight1794