build and distribute documentation, use HELP_DIR variable (#33789)

This commit is contained in:
Christophe Siraut 2019-06-17 20:06:49 +02:00 committed by Frédéric Péters
parent 37ed11e925
commit a7c44c421a
8 changed files with 17 additions and 6 deletions

3
debian/control vendored
View File

@ -6,7 +6,8 @@ Build-Depends: python-setuptools (>= 0.6b3),
python-all (>= 2.6.6-3),
debhelper (>= 8.0),
openssl,
python-django (>= 1.5)
python-django (>= 1.5),
yelp-tools
Standards-Version: 3.9.1
X-Python-Version: >= 2.7

2
debian/docs vendored
View File

@ -1 +1,3 @@
README.rst
help/fr/build-pfwb
help/fr/build-pw

4
debian/rules vendored
View File

@ -2,3 +2,7 @@
%:
dh $@ --with python2
override_dh_auto_build:
$(MAKE) -C help/fr
dh_auto_build

View File

@ -2,6 +2,7 @@ div.page {
max-width: 60em;
border: solid 1px #babdb6;
}
article,
div.body {
margin: 0;
padding-left: 1em;

View File

@ -315,9 +315,9 @@ def message(request, mailbox_id, outbox=False):
return render(request, 'docbow/message.html', ctx)
def get_help_content(pagename):
filepath = os.path.join(settings.STATIC_ROOT, 'help', pagename)
filepath = os.path.join(settings.HELP_DIR, pagename)
parsed_doc = BeautifulSoup(file(filepath).read())
page = parsed_doc.findAll(True, role='main')[0]
page = parsed_doc.findAll('main')[0]
for t in page.findAll('h4'):
t.name = 'h6'
for t in page.findAll('h3'):
@ -335,7 +335,7 @@ def help(request, pagename='index.html'):
'view_name': 'help',
'content': get_help_content(pagename) })
else:
filepath = os.path.join(settings.STATIC_ROOT, 'help', pagename)
filepath = os.path.join(settings.HELP_DIR, pagename)
response = HttpResponse(content=file(filepath))
response['Content-Type'] = 'image/png'
return response

View File

@ -19,3 +19,5 @@ TABELLIO_DBUSER = os.environ.get('TABELLIO_DBUSER')
TABELLIO_DBPASSWORD = os.environ.get('TABELLIO_DBPASSWORD')
PORTAL_BASE_URL = 'https://form.portail.pfwb.be'
HELP_DIR = '/usr/share/doc/docbow/build-pfwb'

View File

@ -52,6 +52,7 @@ if PLATFORM == 'test':
DEFAULT_FROM_EMAIL = 'gestionnaire@pes-pw.dev.entrouvert.org'
CONTACT_SUBJECT_PREFIX = 'Contact depuis pes-pw.dev.entrouvert.org: '
HELP_DIR = '/usr/share/doc/docbow/build-pw'
try:
from local_settings import *

View File

@ -227,7 +227,7 @@ LOGGING = {
},
}
# Remove after Django 1.7
SERIALIZATION_MODULES = {
SERIALIZATION_MODULES = {
'json': 'docbow_project.serializers',
}
@ -241,7 +241,7 @@ TEMPLATE_DIRS += (os.path.join(BASE_DIR, 'docbow_project', CUSTOMIZATION, 'templ
TEMPLATE_DIRS += (os.path.join(BASE_DIR, 'docbow_project', 'docbow', 'templates'),)
STATICFILES_DIRS += (os.path.join(BASE_DIR, 'docbow_project', CUSTOMIZATION, 'static'),)
STATICFILES_DIRS += (os.path.join(BASE_DIR, 'docbow_project', 'docbow', 'static'),)
HELP_DIR = '/usr/share/doc/docbow/help'
if 'SENTRY_DSN' in os.environ:
try: