summaryrefslogtreecommitdiffstats
path: root/doc-publik
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2017-06-25 16:00:15 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2017-06-25 16:00:15 (GMT)
commit4e964643f94f29ef2a876eb31e904c3bc86e0420 (patch)
treee30b145e009a8a8450ee04293a858fbf22af8627 /doc-publik
parent7ab54b5153fc2b2d72d723dee190cafaf1c4c04d (diff)
downloadmisc-fred-4e964643f94f29ef2a876eb31e904c3bc86e0420.zip
misc-fred-4e964643f94f29ef2a876eb31e904c3bc86e0420.tar.gz
misc-fred-4e964643f94f29ef2a876eb31e904c3bc86e0420.tar.bz2
doc-publik: add script to update doc-publik from redmine wiki pages (#16621)
Diffstat (limited to 'doc-publik')
-rw-r--r--doc-publik/update-publik-doc-from-redmine.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc-publik/update-publik-doc-from-redmine.py b/doc-publik/update-publik-doc-from-redmine.py
new file mode 100644
index 0000000..01c1a11
--- /dev/null
+++ b/doc-publik/update-publik-doc-from-redmine.py
@@ -0,0 +1,21 @@
+from bs4 import BeautifulSoup
+import html5lib
+import requests
+
+from combo.data.models import TextCell
+
+DOCS = {
+ 'passerelle-connecteur-dev': "https://dev.entrouvert.org/projects/passerelle/wiki/D%C3%A9veloppement_d'un_connecteur.html",
+}
+
+for cell in TextCell.objects.all():
+ if not cell.slug in DOCS:
+ continue
+ resp = requests.get(DOCS[cell.slug])
+ if resp.status_code != 200:
+ continue
+ document = BeautifulSoup(resp.content, 'html5lib')
+ content = document.find('body')
+ new_content = unicode(content).replace('<body>', '').replace('</body>', '')
+ cell.text = new_content
+ cell.save()