Bug fixed when section has no text but has properties.

An error appeared when a header has no text but it has properties. For instance:
```org
* A header
:PROPERTIES:
:ID:       7159694c-0e06-41d6-a2fc-1ae3f9ba0321
:END:

* Another header
```

"A header" is processed by `org-gemini-section` and throws error when
exporting: `contents` parameter is nil instead of empty string. "Another
header" is considered a headline and not a section.
This commit is contained in:
cnngimenez 2022-01-10 15:30:46 -03:00 committed by Justin Abrahms
parent 249d2be0e0
commit 7c3300ace1

View File

@ -116,7 +116,9 @@ Note: the footer with the actual links are handled in
"Transcode a SECTION element from Org to GEMINI. "Transcode a SECTION element from Org to GEMINI.
CONTENTS is the contents of the section. INFO is a plist holding CONTENTS is the contents of the section. INFO is a plist holding
contextual information." contextual information."
(let ((links ;; CONTENTS is nil when the section has no text but it has properties setted.
(let ((contents-str (or contents "")) ;; ensure that contents is a string.
(links
(and (plist-get info :ascii-links-to-notes) (and (plist-get info :ascii-links-to-notes)
;; Take care of links in first section of the document. ;; Take care of links in first section of the document.
(not (org-element-lineage section '(headline))) (not (org-element-lineage section '(headline)))
@ -125,8 +127,8 @@ contextual information."
(org-ascii--current-text-width section info) (org-ascii--current-text-width section info)
info)))) info))))
(org-remove-indentation (org-remove-indentation
(if (not (org-string-nw-p links)) contents (if (not (org-string-nw-p links)) contents-str
(concat (org-element-normalize-string contents) "\n\n" links)) (concat (org-element-normalize-string contents-str) "\n\n" links))
;; Do not apply inner margin if parent headline is low level. ;; Do not apply inner margin if parent headline is low level.
(let ((headline (org-export-get-parent-headline section))) (let ((headline (org-export-get-parent-headline section)))
(if (or (not headline) (org-export-low-level-p headline info)) 0 (if (or (not headline) (org-export-low-level-p headline info)) 0