Compare commits
1 Commits
75e80c5993
...
cc86aa1d6d
Author | SHA1 | Date | |
---|---|---|---|
|
cc86aa1d6d |
@ -545,6 +545,8 @@ if __name__ == "__main__":
|
|||||||
tl, tc, tg = get_posts(p, cfg["post"], new_posts)
|
tl, tc, tg = get_posts(p, cfg["post"], new_posts)
|
||||||
if tl == []:
|
if tl == []:
|
||||||
return
|
return
|
||||||
|
if "rss" in cfg and "post" in cfg:
|
||||||
|
cfg["rss"]["trailing_punctuation"] = cfg["post"]["trailing_punctuation"]
|
||||||
# main timeline
|
# main timeline
|
||||||
updated = []
|
updated = []
|
||||||
updated += writepage(tpl, tl, tc, cfg["page"],
|
updated += writepage(tpl, tl, tc, cfg["page"],
|
||||||
|
@ -11,7 +11,7 @@ except ImportError:
|
|||||||
print("\trss disabled - missing dependency", file=sys.stderr)
|
print("\trss disabled - missing dependency", file=sys.stderr)
|
||||||
print("\tYour microblog still may have been generated.", file=sys.stderr)
|
print("\tYour microblog still may have been generated.", file=sys.stderr)
|
||||||
|
|
||||||
def line2words(lines, limit):
|
def line2words(lines, limit, trailing_punctuation):
|
||||||
output = []
|
output = []
|
||||||
char_count = 0
|
char_count = 0
|
||||||
break_outer_loop = False
|
break_outer_loop = False
|
||||||
@ -29,8 +29,7 @@ def line2words(lines, limit):
|
|||||||
# last char of last word
|
# last char of last word
|
||||||
last_char = output[-1].strip()[-1]
|
last_char = output[-1].strip()[-1]
|
||||||
# print(output[-1], file=sys.stderr)
|
# print(output[-1], file=sys.stderr)
|
||||||
punctuation = [".", ")", ",", "!", "?", ">", ']']
|
if last_char not in trailing_punctuation:
|
||||||
if last_char not in punctuation:
|
|
||||||
output.append("...")
|
output.append("...")
|
||||||
return output
|
return output
|
||||||
|
|
||||||
@ -99,7 +98,7 @@ def write_feed(posts, filename, params, tagname=None):
|
|||||||
# len of post.message is number of lines
|
# len of post.message is number of lines
|
||||||
msg = post.message
|
msg = post.message
|
||||||
ti = " ".join(
|
ti = " ".join(
|
||||||
line2words(msg,TITLE_LEN_LIMIT))
|
line2words(msg, TITLE_LEN_LIMIT, params["trailing_punctuation"]))
|
||||||
if params["use_atom"]:
|
if params["use_atom"]:
|
||||||
de = " ".join(
|
de = " ".join(
|
||||||
enrich_msg(
|
enrich_msg(
|
||||||
@ -110,7 +109,7 @@ def write_feed(posts, filename, params, tagname=None):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
de = " ".join(
|
de = " ".join(
|
||||||
line2words(msg,DESC_LEN_LIMIT))
|
line2words(msg, DESC_LEN_LIMIT, params["trailing_punctuation"]))
|
||||||
li = base_url + ("#%i" % post.num)
|
li = base_url + ("#%i" % post.num)
|
||||||
p = dateutil.parser.parse(post.timestamp)
|
p = dateutil.parser.parse(post.timestamp)
|
||||||
if params["use_atom"]:
|
if params["use_atom"]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user