From 52d8cf59cebb8eb263c6f04bb7a91b515ac55568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Mon, 14 Feb 2022 23:09:43 +0100 Subject: [PATCH] Read raw contents via key names, not positions. --- org_rw/org_rw.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/org_rw/org_rw.py b/org_rw/org_rw.py index d715151..e2d3f5a 100644 --- a/org_rw/org_rw.py +++ b/org_rw/org_rw.py @@ -550,11 +550,10 @@ class Headline: def get_contents(self, format): if format == "raw": - lines = [] - for line in self.contents: - lines.append(dump_contents(line)) - - yield from map(lambda x: x[1], sorted(lines, key=lambda x: x[0])) + yield from map( + lambda x: token_list_to_raw(x.contents), + sorted(self.contents, key=lambda x: x.linenum), + ) else: raise NotImplementedError()