By: hemocyanin
Date: 2013-11-30
Time: 00:49
|
mergeblock deleting space charactersI have some data I need to put in a table in an ODT document. The data comes from a number of arrays sent to the document by MergeBlock. When the arrays are empty, and the corresponding table gets removed (bmagnet), it takes a very long time to process the document, approx 2 secs per empty array and I have 16 of them, so it really adds up if a significant number of the arrays are empty.
My workaround was to ensure that the arrays are never empty -- if all the arrays have at least some data, the document generates in about one second. So, I decided that the first line of the array would be the heading for the following data. I want to indent the data under that heading and I figured the easiest way would be to insert five space characters in front of it. But they all get removed. If I put a junk character in front of the five spaces, all but one space is removed. I would like to modify things so that spaces are not removed. I've been poking around in tbs_class.php and tbs_plugin_opentbs.php and trying to figure out exactly where the substitution is occurring, but I haven't been able to find it yet, leading me to think the easiest way to find it would be to ask here. |
|||||
By: Skrol29
Date: 2013-12-02
Time: 15:45
|
Re: mergeblock deleting space charactersHi Hemocyanin,
Did you have a look at the FAQ about optimization? http://www.tinybutstrong.com/support.php#faq_slow > I would like to modify things so that spaces are not removed. Can you give an example of data set containing spaces that are removed? Can you include a snippet of the template description in order to reproduce the structure with "bmagnet" ? |
|||||
By: hemocyanin
Date: 2013-12-04
Time: 21:23
|
Re: mergeblock deleting space charactersThe form is extremely complicated -- like a tax form.
At some point, I discovered that if I removed the footer, the form built fairly quickly. without the footer, it builds very slowly. I though there might be a problem with the original template itself so I remade that from scratch. Didn't change anything, in fact, now it runs slowly with or without the footer if my arrays are empty. I know I can solve my problem by having no empty arrays. I just need to find out where the mergeBlock process is removing extra spaces. If I can indent with spaces, I can just include the heading for the data section in my array. If there is no data, there will still be something in the array (the heading). But I want to indent the data under each heading, and thus I want to be able to manually insert an arbitrary number of space characters. So for example, if you have an array like this:
and run through the normal mergeblock process
in a form that has a table with this:
you get:
what I want to get is
|
|||||
By: Skrol29
Date: 2013-12-04
Time: 22:16
|
Re: mergeblock deleting space characters> At some point during the mergeblock process, all side by side space characters are collapsed
> into a single character, and leading spaces eliminated entirely like with trim. This is the normal behavior for an XML content. For non collapsed white space in an ODT XML content, we have to replace spaces with <text:s/>. The OASIS documentation says that the first white space should be preserved for a good practice, but all can be converted. OpenTBS doesn't manage that for you by now, but you can arrange that by changing the data or using an "onformat" custom function. Can cannot see no reason for the time processing. I could check if I have a piece of code to reproduce it. |
|||||
By: hemocyanin
Date: 2013-12-04
Time: 23:06
|
Re: mergeblock deleting space charactersis there a way to embed spaces or tabs in my array on the PHP side so that they will show up in the document?
|
|||||
By: hemocyanin
Date: 2013-12-04
Time: 23:25
|
Re: mergeblock deleting space charactersPerhaps the tbs_class and opentbs got mangled at some point -- my computer did run out of HD space due a log file running wild. Who knows.
Anyway, I've reverted back to an earlier version of the tbs class (3.7.0) and open_tbs plugin (1.7.5) and the document builds in 4 seconds, which is fine, way better than 30+ seconds. |
|||||
By: Skrol29
Date: 2013-12-05
Time: 23:59
|
Re: mergeblock deleting space characters> is there a way to embed spaces or tabs in my array on the PHP side so that they will show up in the document?
What do you mean by "embed spaces" ? |
|||||
By: hemocyanin
Date: 2013-12-06
Time: 00:31
|
Re: mergeblock deleting space charactersI solved this issue by using an older version of tbs and the plugin -- this allows an odt to generate in about 4 seconds, which is good enough. I'm having even worse problems with docx though, and it doesn't matter whether my arrays are empty or full.
In my original problem, only empty arrays associated with a table row that was eliminated by bmagnet caused the slowdown. So my thought was that I would include the heading describing the data in my arrays. That way I would never have an empty array even if there was no data under that heading because the heading would be part of the array. But I also want to indent the data in the rows below that heading. I figured I could cheat by just putting 5 space characters in front of the subsequent data after the heading *in the array* itself, but those space characters get trimmed off (actually even if I had something like "- someData", I'd get back "- someData", so it isn't just a trim, there's a replace going on. If I had an array like this:
What I hoped for:
But what I would get because all the leading spaces were eliminated or collapsed was this:
|