summaryrefslogtreecommitdiffstats
path: root/doc-publik
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2017-06-25 15:53:01 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2017-06-25 15:53:53 (GMT)
commit7ab54b5153fc2b2d72d723dee190cafaf1c4c04d (patch)
treecbab187155677c515204f440f9fd1117bd1edbb5 /doc-publik
parent85820cbaea272bf21cbfbe46374bf0812cd64891 (diff)
downloadmisc-fred-7ab54b5153fc2b2d72d723dee190cafaf1c4c04d.zip
misc-fred-7ab54b5153fc2b2d72d723dee190cafaf1c4c04d.tar.gz
misc-fred-7ab54b5153fc2b2d72d723dee190cafaf1c4c04d.tar.bz2
doc-publik: add script to update doc-publik from mallard pages
Diffstat (limited to 'doc-publik')
-rw-r--r--doc-publik/update-publik-doc-from-mallard.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc-publik/update-publik-doc-from-mallard.py b/doc-publik/update-publik-doc-from-mallard.py
new file mode 100644
index 0000000..6a19c92
--- /dev/null
+++ b/doc-publik/update-publik-doc-from-mallard.py
@@ -0,0 +1,20 @@
+from bs4 import BeautifulSoup
+import html5lib
+import requests
+
+from combo.data.models import TextCell
+
+for cell in TextCell.objects.all():
+ if not cell.slug.startswith('mallard-'):
+ continue
+ mallard_page = cell.slug.split('-', 1)[1]
+ for module in ('wcs', 'publik-base-theme'):
+ resp = requests.get('https://doc.entrouvert.org/%s/dev/%s.html' % (module, mallard_page))
+ if resp.status_code != 200:
+ continue
+ document = BeautifulSoup(resp.content, 'html5lib')
+ content = document.find('div', 'body')
+ more_info = document.find('div', 'sect sect-links')
+ new_content = unicode(content).replace(unicode(more_info), '')
+ cell.text = new_content
+ cell.save()