Compare commits

..

No commits in common. "7e944bcb3d0f837bf7fb8ce4ead5acdcc8257163" and "6943ebad7c881f1ff8fc5d0a0a87b1174ea7360b" have entirely different histories.

4 changed files with 10 additions and 35 deletions

View File

@ -99,8 +99,6 @@ def get_tokens(value):
return value.contents return value.contents
if isinstance(value, RawLine): if isinstance(value, RawLine):
return [value.line] return [value.line]
if isinstance(value, list):
return value
raise Exception("Unknown how to get tokens from: {}".format(value)) raise Exception("Unknown how to get tokens from: {}".format(value))
@ -363,10 +361,6 @@ class Headline:
for content in self.contents: for content in self.contents:
yield from get_links_from_content(content) yield from get_links_from_content(content)
for lst in self.getLists():
for item in lst:
yield from get_links_from_content(item.content)
def get_lines_between(self, start, end): def get_lines_between(self, start, end):
for line in self.contents: for line in self.contents:
if start <= line.linenum < end: if start <= line.linenum < end:
@ -1557,9 +1551,7 @@ class OrgDocReader:
match.group("checkbox_value"), match.group("checkbox_value"),
match.group("tag_indentation"), match.group("tag_indentation"),
match.group("tag"), match.group("tag"),
parse_content_block( match.group("content"),
[RawLine(linenum=linenum, line=match.group("content"))]
).contents,
) )
if len(self.headline_hierarchy) == 0: if len(self.headline_hierarchy) == 0:

View File

@ -1,10 +0,0 @@
#!/bin/sh
set -eu
cd "`dirname $0`"
cd ..
python setup.py sdist
twine upload --verbose dist/*

View File

@ -2,7 +2,7 @@ from setuptools import setup
setup( setup(
name="org-rw", name="org-rw",
version="0.0.1.dev1", version="0.0.1",
description="Library to de/serialize org-files and manipulate them.", description="Library to de/serialize org-files and manipulate them.",
author="kenkeiras", author="kenkeiras",
author_email="kenkeiras@codigoparallevar.com", author_email="kenkeiras@codigoparallevar.com",

View File

@ -4,7 +4,7 @@ import unittest
from datetime import date from datetime import date
from datetime import datetime as DT from datetime import datetime as DT
from org_rw import MarkerToken, MarkerType, Timestamp, dumps, load, loads from org_rw import Timestamp, dumps, load, loads
from utils.assertions import (BOLD, CODE, HL, ITALIC, SPAN, STRIKE, UNDERLINED, from utils.assertions import (BOLD, CODE, HL, ITALIC, SPAN, STRIKE, UNDERLINED,
VERBATIM, WEB_LINK, Doc, Tokens) VERBATIM, WEB_LINK, Doc, Tokens)
@ -459,20 +459,13 @@ class TestSerde(unittest.TestCase):
# ... # ...
lists = hl.getLists() lists = hl.getLists()
self.assertEqual(len(lists), 3) self.assertEqual(len(lists), 3)
self.assertEqual(lists[0][0].content, [" This is a simple list."]) self.assertEqual(lists[0][0].content, " This is a simple list.")
self.assertEqual(lists[0][0].bullet, "-") self.assertEqual(lists[0][0].bullet, "-")
self.assertEqual( self.assertEqual(
lists[0][1].content, lists[0][1].content, " This list has multiple elements, with _markup_."
[
" This list has multiple elements, with ",
MarkerToken(closing=False, tok_type=MarkerType.UNDERLINED_MODE),
"markup",
MarkerToken(closing=True, tok_type=MarkerType.UNDERLINED_MODE),
".",
],
) )
self.assertEqual(lists[1][0].content, [" This is a simple list."]) self.assertEqual(lists[1][0].content, " This is a simple list.")
self.assertEqual(lists[1][0].bullet, "+") self.assertEqual(lists[1][0].bullet, "+")
hl2 = doc.getTopHeadlines()[1] hl2 = doc.getTopHeadlines()[1]
@ -480,19 +473,19 @@ class TestSerde(unittest.TestCase):
lists2 = hl2.getLists() lists2 = hl2.getLists()
self.assertEqual(len(lists2), 2) self.assertEqual(len(lists2), 2)
self.assertEqual(lists2[0][0].content, [" First element"]) self.assertEqual(lists2[0][0].content, " First element")
self.assertEqual(lists2[0][0].counter, "1") self.assertEqual(lists2[0][0].counter, "1")
self.assertEqual(lists2[0][0].counter_sep, ".") self.assertEqual(lists2[0][0].counter_sep, ".")
self.assertEqual(lists2[0][1].content, [" Second element"]) self.assertEqual(lists2[0][1].content, " Second element")
self.assertEqual(lists2[0][1].counter, "2") self.assertEqual(lists2[0][1].counter, "2")
self.assertEqual(lists2[0][1].counter_sep, ".") self.assertEqual(lists2[0][1].counter_sep, ".")
self.assertEqual(lists2[1][0].content, [" First element"]) self.assertEqual(lists2[1][0].content, " First element")
self.assertEqual(lists2[1][0].counter, "1") self.assertEqual(lists2[1][0].counter, "1")
self.assertEqual(lists2[1][0].counter_sep, ")") self.assertEqual(lists2[1][0].counter_sep, ")")
self.assertEqual(lists2[1][1].content, [" Second element"]) self.assertEqual(lists2[1][1].content, " Second element")
self.assertEqual(lists2[1][1].counter, "2") self.assertEqual(lists2[1][1].counter, "2")
self.assertEqual(lists2[1][1].counter_sep, ")") self.assertEqual(lists2[1][1].counter_sep, ")")