mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fixing pdf generation issue
This commit is contained in:
parent
c462237b9d
commit
b9c0f07f57
1 changed files with 6 additions and 5 deletions
|
|
@ -6,6 +6,7 @@ import logging
|
||||||
import datetime
|
import datetime
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from codecs import open
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
@ -16,7 +17,7 @@ from jinja2.exceptions import TemplateNotFound
|
||||||
|
|
||||||
from pelican.contents import Article, Page, Category, is_valid_content
|
from pelican.contents import Article, Page, Category, is_valid_content
|
||||||
from pelican.readers import read_file
|
from pelican.readers import read_file
|
||||||
from pelican.utils import copy, process_translations, open
|
from pelican.utils import copy, process_translations
|
||||||
from pelican import signals
|
from pelican import signals
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -272,7 +273,7 @@ class ArticlesGenerator(Generator):
|
||||||
if 'category' not in metadata:
|
if 'category' not in metadata:
|
||||||
|
|
||||||
if os.path.dirname(f) == article_path: # if the article is not in a subdirectory
|
if os.path.dirname(f) == article_path: # if the article is not in a subdirectory
|
||||||
category = self.settings['DEFAULT_CATEGORY']
|
category = self.settings['DEFAULT_CATEGORY']
|
||||||
else:
|
else:
|
||||||
category = os.path.basename(os.path.dirname(f))\
|
category = os.path.basename(os.path.dirname(f))\
|
||||||
.decode('utf-8')
|
.decode('utf-8')
|
||||||
|
|
@ -355,7 +356,7 @@ class ArticlesGenerator(Generator):
|
||||||
|
|
||||||
self.authors = list(self.authors.items())
|
self.authors = list(self.authors.items())
|
||||||
self.authors.sort(key=lambda item: item[0].name)
|
self.authors.sort(key=lambda item: item[0].name)
|
||||||
|
|
||||||
self._update_context(('articles', 'dates', 'tags', 'categories',
|
self._update_context(('articles', 'dates', 'tags', 'categories',
|
||||||
'tag_cloud', 'authors', 'related_posts'))
|
'tag_cloud', 'authors', 'related_posts'))
|
||||||
|
|
||||||
|
|
@ -373,7 +374,7 @@ class PagesGenerator(Generator):
|
||||||
self.hidden_translations = []
|
self.hidden_translations = []
|
||||||
super(PagesGenerator, self).__init__(*args, **kwargs)
|
super(PagesGenerator, self).__init__(*args, **kwargs)
|
||||||
signals.pages_generator_init.send(self)
|
signals.pages_generator_init.send(self)
|
||||||
|
|
||||||
def generate_context(self):
|
def generate_context(self):
|
||||||
all_pages = []
|
all_pages = []
|
||||||
hidden_pages = []
|
hidden_pages = []
|
||||||
|
|
@ -470,7 +471,7 @@ class PdfGenerator(Generator):
|
||||||
output_pdf = os.path.join(output_path, filename)
|
output_pdf = os.path.join(output_path, filename)
|
||||||
# print "Generating pdf for", obj.filename, " in ", output_pdf
|
# print "Generating pdf for", obj.filename, " in ", output_pdf
|
||||||
with open(obj.filename) as f:
|
with open(obj.filename) as f:
|
||||||
self.pdfcreator.createPdf(text=f, output=output_pdf)
|
self.pdfcreator.createPdf(text=f.read(), output=output_pdf)
|
||||||
logger.info(u' [ok] writing %s' % output_pdf)
|
logger.info(u' [ok] writing %s' % output_pdf)
|
||||||
|
|
||||||
def generate_context(self):
|
def generate_context(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue