Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Python: New Django Fathead #673

Merged
merged 2 commits into from
Jan 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/fathead/django/fetch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

mkdir -p download
cd download
rm -f *.html

wget --quiet https://docs.djangoproject.com/en/1.10/ref/contrib/ -O contrib.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/django-admin/ -O django-admin.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/exceptions/ -O exceptions.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/forms/fields/ -O form_fields.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/forms/widgets/ -O widgets.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/templates/builtins/ -O builtins.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/settings/ -O settings.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/validators/ -O validators.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/views/ -O view.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/urlresolvers/ -O urlresolvers.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/urls/ -O urls.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/models/database-functions/ -O database-functions.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/models/fields/ -O fields.html
wget --quiet https://docs.djangoproject.com/en/1.10/ref/migration-operations/ -O migration-operations.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vigzmv this is a great start -- the structure of the Django docs clearly doesn't lend itself to being parsed for classes/methods/attributes/etc

I have another idea though, what about downloading the HTML offline docs (instead of several files) and iterating over the Index?

It seems that most entries in the index indicate if they are a class, method, attribute or function in parenthesis. By scraping those and using the css classes on the page, I think we could reliably parse out all the methods, classes, attributes and functions from the docs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally then we would have more context when creating the output and we could more cleverly create redirects to handle queries like "django AddField class", "django add method" etc.

Of course that's not necessary for Version 1, but it may help to make the Fathead more flexible

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That's a good idea. I will working to improve this fathead.

Loading