-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't display new lines in variable #10
Comments
According to ODF specification, line breaks in ODF document must be represented with For more info, see "6.1.5 text:line-break" of the Specification (pdf), or simply perform a simple experiment as I did. I created a new document with a number of linebreaks and then took a look at the contents, as described here. Please consider closing the ticket if it solves your problem. Otherwise, please let me know if something goes wrong. |
I figured it wasn't a bug but more of a feature that wasn't implemented. It may be nice to have that filter included in the package. I assume wanting to put text with line breaks in documents would be fairly popular- blog posts, news articles, etc. Here is a Gist of the code for a templatetag for xml line breaks. I borrowed/stole the code from Django's linebreaksbr filter and just switched it to the proper xml tag.
|
Thank you. Indeed, it would be useful to include this filter in the webodt package. I re-open the issue as a reminder for myself. |
I don't know if this is any easier, or more practical, but maybe instead of the filter to convert Does that make sense? I guess the way I see it is that XML doesn't care about any |
Regarding your last proposal. Frankly, It seems to me as too unobvious and incomplete. If we convert So I'd rather stay with template filter implementation. |
That makes perfect sense. I seemed to have entangled the actual scope of the project with how I use it or how I envision it being used. In other news, the filter I posted above has been working well- I guess it helps that it is practically actual Django code. I just wish I didn't have to use the Thanks for your work on this project, it's awesome. |
I was having a problem with a couple pdfs I was trying to generate. After a lot of line by line debugging, I realized that the Objects which were causing problems were those which had '&' in the attributes that I was running through this line break filter. The solution was to use escape option with the 'linebreaksodt' filter I defined above. I switched the autoescape kwarg to True which then made me realize I hadn't fully imported the necessary functions, so i had to add a few things to the imports. The updated Gist is here: Gist 1676645 |
|
Am i right with my conclusion that this project is practically dead? Many Thanks to @jsykora that line-break Gist works perfectly! This helped me implementing it: https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/ |
@monkee-ch for what it's worth, I'm still using this in some internal apps, but migrating away from it. Mainly because the Open Office daemon is a pain. I run into a lot of crashes and issues with temp files pilling up. I have cron jobs to restart OO every hour. |
So far i use Abiword, and that works fine so far... Only Problem i have now is that it somehow chokes on Special Characters like äöü - Any idea how to fix that? Or do you recommend using something completely different than webodt? |
I don't really have to deal with special characters, but that may have been a limitation of abiword and googledocs processors. I needed to use Open Office for some more advanced tables anyway. (4 year ago, they might be better now). I started using z3c.rml which is an open source implementation of Reportlab's RML. |
I fixed my special Char Problem, just force the script to UTF8 # encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')` Thanks for your Support and Tipps! |
First off, this may not be an issue, but more of a support question.
I have a model with a TextField and I am trying to use it in a .odt template converting to .pdf via Open Office.
The value of the field is
u'Line one\r\nLine two'
I've tried just the plain variable as well as the following template tags: linebreaks, linebreaksbr, safe. But none of them seem to work to allow the carriage return or newline characters.
Am I missing the proper way to allow new lines?
The text was updated successfully, but these errors were encountered: