-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[draft] import_page: support file scheme and use bs4 to workaround missing 'body' element #456
base: master
Are you sure you want to change the base?
Conversation
v8/import_page/import_page.py
Outdated
document = doc_template.format( | ||
title=title, | ||
slug=slug, | ||
content=node.prettify() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we leave the HTML as it is? If it is 'article' should I just get 'article' content (mostly likely the website template would already have 'article' element) ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to add a functionality for this topic, see ab15bed .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should remove the wrapper element (e.g. <article>
) by default.
8c15716
to
ab15bed
Compare
while args: | ||
arg = args.pop(0) | ||
if arg == "-s" and args: | ||
selector = args.pop(0) | ||
elif arg == "-e" and args: | ||
extractor = args.pop(0) | ||
else: | ||
urls.append(arg) # Assume it's a page URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don’t need to parse args yourself, you should use the built-in support in doit. See just about any command plugin for an example.
args = sys.argv[1:] | ||
selector = None # 'body' | ||
extractor = None # 'lambda node: BeautifulSoup(node.decode_contents(), "html.parser").prettify()' | ||
urls = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used?
|
||
doc_template = '''<!-- | ||
.. title: {title} | ||
.. slug: {slug} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider also adding date
(defaulting to now is fine).
Support file scheme and use bs4 to workaround missing 'body' element