Improvements on importer and small bug fixes #4

Closed
ArneTR wants to merge 1 commits from master into master
+2 -5
View File
@@ -24,7 +24,6 @@ final_file = '''
'''
tag_notes_links = {}
# first we build the tag hash
for key, item in enumerate(data['items']):
if item['content_type'] == 'Tag':
for inner_key, reference in enumerate(item['content']['references']):
@@ -44,18 +43,16 @@ counter = 0
for key, item in enumerate(data['items']):
if item['content_type'] == 'Note':
# if 'title' in item['content'] and 'text' in item['content']: # tís this if really needed?
if 'title' in item['content']:
title = item['content']['title']
title = html.escape(title)
# title = re.sub(r'\\([^\w])', r'\1', title) # if you have mal-imported notes from earliner in SN, then this de-escaping may help you
title = re.sub(r'\\([^\w])', r'\1', title) # if you have mal-imported notes from earliner in SN, then this de-escaping may help you
else:
title = "empty title"
text = item['content']['text']
tanrax commented 2020-06-03 17:08:20 +02:00 (Migrated from github.com)
Review

There's bad indentation.

There's bad indentation.
ArneTR commented 2020-06-04 15:55:24 +02:00 (Migrated from github.com)
Review

unclear what you mean by bad indentation ....? Maybe your editor got it wrong? Looks fine to me ...?

Anyhow, I closed the request and send you an new one.

Please have a look at it.

Also you can accept the pull-request and modify it afterwards if you want to have the code differently in your repo. Just wanted you to get the credit and keep it centralised

unclear what you mean by bad indentation ....? Maybe your editor got it wrong? Looks fine to me ...? Anyhow, I closed the request and send you an new one. Please have a look at it. Also you can accept the pull-request and modify it afterwards if you want to have the code differently in your repo. Just wanted you to get the credit and keep it centralised
ArneTR commented 2020-06-04 16:01:30 +02:00 (Migrated from github.com)
Review

sry, my bad. Saw it was just one space instead of usually 4. fixed

sry, my bad. Saw it was just one space instead of usually 4. fixed
text = text_from_html(title, text)
#text = re.sub(r'\\([^\w])', r'\1', text) # if you have mal-imported notes from earliner in SN, then this de-escaping may help you
text = re.sub(r'\\([^\w])', r'\1', text) # if you have mal-imported notes from earliner in SN, then this de-escaping may help you
if item['uuid'] not in tag_notes_links:
print(f"Whoops .... {title} had no tag ... if this is expected, then safely ignore ... Setting tag: 'Missing-Standard-Notes-Tag'.")