summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2021-05-05 06:31:53 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2021-05-05 06:32:14 (GMT)
commit7ecbc33621a038796ef8eb0f9cae7475ffd844d7 (patch)
treec63ff05a384998e1e157d2663dedbb554f6988b3
parentb025f6b4c2e22eaf08fa866ff682ec70cbe5d9bc (diff)
downloadmisc-fred-main.zip
misc-fred-main.tar.gz
misc-fred-main.tar.bz2
remove documentation scripts (moved into puppet repository)HEADmain
-rw-r--r--doc-publik/update-publik-doc-from-mallard.py41
-rw-r--r--doc-publik/update-publik-doc-from-redmine.py37
2 files changed, 0 insertions, 78 deletions
diff --git a/doc-publik/update-publik-doc-from-mallard.py b/doc-publik/update-publik-doc-from-mallard.py
deleted file mode 100644
index 8088f69..0000000
--- a/doc-publik/update-publik-doc-from-mallard.py
+++ /dev/null
@@ -1,41 +0,0 @@
-from django.utils.six.moves.urllib import parse as urlparse
-
-from bs4 import BeautifulSoup
-import html5lib
-import requests
-
-from combo.data.models import TextCell
-
-for cell in TextCell.objects.filter(slug__startswith='mallard-', page__snapshot__isnull=True):
- 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')
- for a in document.find_all('a'):
- href = a.attrs['href']
- parsed = urlparse.urlparse(href)
- if parsed.netloc:
- continue
- if '/' in parsed.path:
- continue
- try:
- target_cell = TextCell.objects.get(slug='mallard-%s' % parsed.path.replace('.html', ''),
- page__snapshot__isnull=True)
- except TextCell.DoesNotExist:
- continue
- a.attrs['href'] = target_cell.page.get_online_url()
- for img in document.find_all('img'):
- img.attrs['src'] = 'https://doc.entrouvert.org/%s/dev/%s' % (module, img.attrs['src'])
-
- new_content = content.decode()
- if more_info:
- new_content = new_content.replace(more_info.decode(), '')
-
- cell.text = new_content
- cell.save()
diff --git a/doc-publik/update-publik-doc-from-redmine.py b/doc-publik/update-publik-doc-from-redmine.py
deleted file mode 100644
index 53c68bb..0000000
--- a/doc-publik/update-publik-doc-from-redmine.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- coding: utf-8 -*-
-
-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",
- 'passerelle-json-data-store': "https://dev.entrouvert.org/projects/passerelle/wiki/Stockage_de_donn%C3%A9es_JSON.html",
- 'combo-json-cell': "https://dev.entrouvert.org/projects/combo/wiki/D%C3%A9veloppement_d'une_cellule_aliment%C3%A9e_par_JSON.html",
- 'developer-installation': "https://dev.entrouvert.org/projects/publik-devinst/wiki/Installation_d'un_environnement_de_développement_local.html",
- 'redmine-contribuer-a-publik': "https://dev.entrouvert.org/projects/publik/wiki/Contribuer_%C3%A0_Publik.html",
-}
-
-for cell in TextCell.objects.filter(slug__in=DOCS.keys(), page__snapshot__isnull=True):
- resp = requests.get(DOCS[cell.slug])
- if resp.status_code != 200:
- continue
- document = BeautifulSoup(resp.content, 'html5lib')
- content = document.find('body')
- new_content = content.decode().replace('<body>', '').replace('</body>', '')
- cell.text = new_content
- cell.order = 1
- cell.save()
-
- url = DOCS[cell.slug].replace('.html', '')
- cell, created = TextCell.objects.get_or_create(
- page=cell.page,
- slug='editor-warning', defaults={'order': 0})
- cell.placeholder = 'content'
- cell.order = 0
- cell.text = u'''<div class="note note-tip"><div>Cette page est tirée de redmine, l'édition se fait là :<br>
- <a href="%s">%s</a>.</div></div>''' % (url, url)
- cell.public = False
- cell.save()