From e2258b08fa38c83d0e2eaba423d147a873eaabf3 Mon Sep 17 00:00:00 2001 From: Thomas Baruchel Date: Sat, 5 Nov 2022 12:22:32 +0100 Subject: [PATCH] Update --- rst2atom.py | 52 ++++++++++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/rst2atom.py b/rst2atom.py index 5ad4941..abafa0e 100644 --- a/rst2atom.py +++ b/rst2atom.py @@ -69,30 +69,35 @@ def build_entry(d): """ Print on stdout an Atom section built from the
. """ + # Get the date + mydate = "" + try: + mydate = find_date(d) + except dateutil.parser.ParserError: + pass print(""" - Atom-Powered Robots Run Amok - - - + %s urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a - 2003-11-09T17:23:02Z - -
-

This is the entry content.

-
-
- - John Doe - johndoe@example.com - -
- """) + %s + +
+

This is the entry content.

+
+
+ + """ % ( + d.find("h1").text, + mydate + )) docinfos = extract_docinfos(html) meta = extract_meta(html) +soup2 = bs4.BeautifulSoup(html["body"], 'html.parser') +divs = soup2.select("div") + print(""" %s @@ -118,22 +123,9 @@ print(""" generator_uri, generator_name )) - -soup2 = bs4.BeautifulSoup(html["body"], 'html.parser') -divs = soup2.select("div") - for d in divs: # don't handle subsections if d.find_parent("div"): continue - - print("="*40) - print(d) - try: - print(find_date(d)) - except dateutil.parser.ParserError: - pass - - - + build_entry(d) print("")