Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: users

LaTeX Story document model and management

 

 

Bricolage users RSS feed   Index | Next | Previous | View Threaded


k.rudnik at gmail

Oct 25, 2008, 5:07 AM

Post #1 of 8 (1673 views)
Permalink
LaTeX Story document model and management

Hi,
I've almost decided to use Birc to build a site for 20 years old
polish (non profit) journal which popularizes math, physics,
astronomy, informatics etc. (on various [from school to university]
levels).
They have tons of fresh (Pitagoras does't get older too quickly)
illustrated big articles and exercises - all written in tex because
they contain heavy math very often.
I think of building a site where there will be sometnihg more than
just simple descriptions of pdf's icons.

I installed 1.11.1 and for the last 2 weeks I've read everything about
Bricolage. I have the feeling that Biricolage would be the perfect
choice, even if there are opinions that it is almost dead (correct me
if I am wrong).

Another feeling is that I can't feel Bric's "way of life" yet, and I
am sure that
without little help from experienced users I'll make serious strategic
mistakes. I really miss for something like

make installdemo

after which all that nice ideas (i.e how to build site from scratch,
manage server side includes, clever media documents management and
other "good practice" tips) well hidden in the mailing lists, wiki's
etc.could be seen and touched directly.

OK, main problem now.
How to manage such (latex) content in Bricolage in the most clever and
bric-ish way.

Using latex, tex4ht, and some additional stuff for picture and html
manipulation I can (after some customization) get perfectly looking,
paginated and "cross referenced" html output (comparable with that on
mathworld.com). Suitable perl module would do the job and could be
used on bric's templates leavel.

tex4ht converter offers 3 ways in which math stuff (symbols,
formulas, diagrams etc.) is converted and presented on final html page
i.e graphics, graphics+html,or mathml.
One of these option must be selected before conversion starts and it
affects the whole document. Only the first one (not recommended by
tex4ht) gives very good results.

I can imagine the following scenario:

1. define LaTeX_Story document model containing subelements with latex
code: tex_paragraph, tex_display_equation, tex_theorem, tex_proof etc.

2. define "tex2html_pre" output channel for preprocessing
LaTeX_Stories. In this oc one latex file would be constructed and
compiled by tex4ht. This file would contain latex code from story's
subelement's fields and some extra latex code allowing precise
identification of html pieces in the tex4ht final output.

Finally, tex_hash of the form (element_id.field_name => generated
html) would be build and stored on disk to be used later during all
successive publish and preview requests of the same version of the
story . All graphics for math presentation with unique (md5) names
would be copied to a directory accessible for the local preview
server.

3. define tex2html_final in which LaTeX_Story would be prcessed
normally but instead of field's values of any tex* element suitable
preprocessed tex_hash value would be used.

It'd be perfect, if at the beginning of the tex2html_final oc,
preprocessing through tex2html_pre could be triggered.

4. There is a problem: how to transportat at the right time all
graphics files for math presentation that bric does't know about to
the external presentation server.

If the above scenario is sensible than one could the most from bric
(reach media illustrations, bulk edit etc) and from latex (automatic:
numbering of items, multipage's cross references, footnotes, tables of
content etc.)

I know that the above LaTeX_Story is too long but hope somebody
reached this point.
What do you think about it?

I will be very thankful for your opinions, hints, links to doc, help etc.

Krzysztof Rudnik


david at kineticode

Oct 27, 2008, 10:23 AM

Post #2 of 8 (1556 views)
Permalink
Re: LaTeX Story document model and management [In reply to]

On Oct 25, 2008, at 05:07, Krzysztof Rudnik wrote:

> I installed 1.11.1 and for the last 2 weeks I've read everything about
> Bricolage. I have the feeling that Biricolage would be the perfect
> choice, even if there are opinions that it is almost dead (correct me
> if I am wrong).

I think that the release of 1.11.1 a few weeks ago proves that it's
not dead, eh?

> Another feeling is that I can't feel Bric's "way of life" yet, and I
> am sure that
> without little help from experienced users I'll make serious strategic
> mistakes. I really miss for something like
>
> make installdemo
>
> after which all that nice ideas (i.e how to build site from scratch,
> manage server side includes, clever media documents management and
> other "good practice" tips) well hidden in the mailing lists, wiki's
> etc.could be seen and touched directly.

Yeah, there are some folks who want to do something like this, but
tuits are in short supply.

> I can imagine the following scenario:
>
> 1. define LaTeX_Story document model containing subelements with latex
> code: tex_paragraph, tex_display_equation, tex_theorem, tex_proof etc.

If it's easy for your editors to write in tex, then that should work
pretty well.

> 2. define "tex2html_pre" output channel for preprocessing
> LaTeX_Stories. In this oc one latex file would be constructed and
> compiled by tex4ht. This file would contain latex code from story's
> subelement's fields and some extra latex code allowing precise
> identification of html pieces in the tex4ht final output.

Sounds reasonable.

> Finally, tex_hash of the form (element_id.field_name => generated
> html) would be build and stored on disk to be used later during all
> successive publish and preview requests of the same version of the
> story . All graphics for math presentation with unique (md5) names
> would be copied to a directory accessible for the local preview
> server.

So you're talking about caching the results of burns? Sounds
interesting, though I'm not sure I really follow.

> 3. define tex2html_final in which LaTeX_Story would be prcessed
> normally but instead of field's values of any tex* element suitable
> preprocessed tex_hash value would be used.
>
> It'd be perfect, if at the beginning of the tex2html_final oc,
> preprocessing through tex2html_pre could be triggered.

So you want to use one output channel for preprocessing and another
for final processing? Hrm. I don't think that output channels execute
in a defined order.

> 4. There is a problem: how to transportat at the right time all
> graphics files for math presentation that bric does't know about to
> the external presentation server.

Ideally how would you like it to work?

> If the above scenario is sensible than one could the most from bric
> (reach media illustrations, bulk edit etc) and from latex (automatic:
> numbering of items, multipage's cross references, footnotes, tables of
> content etc.)
>
> I know that the above LaTeX_Story is too long but hope somebody
> reached this point.
> What do you think about it?

I'm not familiar with TeX myself, but it sound pretty reasonable,
though I didn't really follow every step…anyone else know TeX and have
suggestions?

Best,

David


terence.bodola at cbsparamount

Oct 27, 2008, 11:55 AM

Post #3 of 8 (1578 views)
Permalink
RE: LaTeX Story document model and management [In reply to]

"So you want to use one output channel for preprocessing and another for
final processing? Hrm. I don't think that output channels execute in a
defined order."

We get around this by using publish_another and passing what we need
from one element/story/template to the other with notes, or stored in a
separate mysql db sometimes. Then these two different
elements/stories/templates can have separate output channels and
destinations. So, for our element for the story that is the
publish_another story we'll use the slug for the file name and set it in
the preceding story (shown below as the cleanup block for preceding
story) and make sure we clear the resource before republish (so that our
ftp publish, which is set to delete before put, doesn't delete the last
file first even though they are actually different files. You could be
even more clever and make sure you know if it matches the name of last
one published so that if your ftp server really needs delete before put
it would still work on republish. This didn't seem necessary for us.)
The second story for us is just a container story to launch execute of
the template on whatever output channel/destination.

<%cleanup>
if($burner->get_mode == PUBLISH_MODE) {
my $bric_id = $story->get_id;
my $slug = $story->get_slug;
$burner->clear_notes();
$burner->notes(bric_id => $bric_id);
if(my @whateverstory =
$story->list({uuid=>"06977C68-7452-11DD-8358-255863A74C6D"})) {
if(my @resource_id = Bric::Dist::Resource->list({story_id =>
$whateverstory[0]->get_id})) {
foreach my $resid (@resource_id) {
$resid->del_story_ids($whateverstory[0]->get_id)->save;
}}
$whateverstory[0]->set_slug($bric_id . $slug);
$whateverstory[0]->save;
$burner->publish_another($whateverstory[0]);
}}
$burner->clear_notes();
</%cleanup>

then in the publish_another story template

<%perl>
my ($bric_id,$asset);
if($bric_id = $burner->notes('bric_id')) {
$asset = $story->lookup( { id => $bric_id });
}

...

</%perl>



I think in direct mode this would always work, but in queued mode you
might still get into precedence problems if your first story/template
takes longer to execute than your second. You might have to further
ensure in the second template that the first job had gone through
already somehow. Some sort of http client 200 check and a loop in the
second template waiting for finished pub on first...or that and a parse
for a comment that occurs at the end of the live preceding file to be
sure it is fully there? You could probably also use a Bricolage jobs
check loop like

$count = 0;
while((Bric::Util::Job->list({story_id => $bric_id})) and ($count < 10))
{
$count++;
sleep(2);
}.

or you could maybe be more specific about the actual job instance to
make sure a republish of the preceding while the publish_another isn't
done doesn't goof things

Terence

-----Original Message-----
From: David E. Wheeler [mailto:david [at] kineticode]
Sent: Monday, October 27, 2008 10:24 AM
To: users [at] lists
Subject: Re: LaTeX Story document model and management

On Oct 25, 2008, at 05:07, Krzysztof Rudnik wrote:

> I installed 1.11.1 and for the last 2 weeks I've read everything about

> Bricolage. I have the feeling that Biricolage would be the perfect
> choice, even if there are opinions that it is almost dead (correct me
> if I am wrong).

I think that the release of 1.11.1 a few weeks ago proves that it's not
dead, eh?

> Another feeling is that I can't feel Bric's "way of life" yet, and I
> am sure that without little help from experienced users I'll make
> serious strategic mistakes. I really miss for something like
>
> make installdemo
>
> after which all that nice ideas (i.e how to build site from scratch,
> manage server side includes, clever media documents management and
> other "good practice" tips) well hidden in the mailing lists, wiki's
> etc.could be seen and touched directly.

Yeah, there are some folks who want to do something like this, but tuits
are in short supply.

> I can imagine the following scenario:
>
> 1. define LaTeX_Story document model containing subelements with latex
> code: tex_paragraph, tex_display_equation, tex_theorem, tex_proof etc.

If it's easy for your editors to write in tex, then that should work
pretty well.

> 2. define "tex2html_pre" output channel for preprocessing
> LaTeX_Stories. In this oc one latex file would be constructed and
> compiled by tex4ht. This file would contain latex code from story's
> subelement's fields and some extra latex code allowing precise
> identification of html pieces in the tex4ht final output.

Sounds reasonable.

> Finally, tex_hash of the form (element_id.field_name => generated
> html) would be build and stored on disk to be used later during all
> successive publish and preview requests of the same version of the
> story . All graphics for math presentation with unique (md5) names
> would be copied to a directory accessible for the local preview
> server.

So you're talking about caching the results of burns? Sounds
interesting, though I'm not sure I really follow.

> 3. define tex2html_final in which LaTeX_Story would be prcessed
> normally but instead of field's values of any tex* element suitable
> preprocessed tex_hash value would be used.
>
> It'd be perfect, if at the beginning of the tex2html_final oc,
> preprocessing through tex2html_pre could be triggered.

So you want to use one output channel for preprocessing and another for
final processing? Hrm. I don't think that output channels execute in a
defined order.

> 4. There is a problem: how to transportat at the right time all
> graphics files for math presentation that bric does't know about to
> the external presentation server.

Ideally how would you like it to work?

> If the above scenario is sensible than one could the most from bric
> (reach media illustrations, bulk edit etc) and from latex (automatic:
> numbering of items, multipage's cross references, footnotes, tables of

> content etc.)
>
> I know that the above LaTeX_Story is too long but hope somebody
> reached this point.
> What do you think about it?

I'm not familiar with TeX myself, but it sound pretty reasonable, though
I didn't really follow every step...anyone else know TeX and have
suggestions?

Best,

David


k.rudnik at gmail

Oct 27, 2008, 3:59 PM

Post #4 of 8 (1557 views)
Permalink
Re: LaTeX Story document model and management [In reply to]

thanks Terence,

but it is not quite clear to me (I need some reading).
At the end of publish process you call slave story, set up it's resources,
and publish it through is oc.
Slave story knows who initialized it's burning process (notes), gets
master's data
and does the job. correct?
There is something I ma not ready yet (need more reading and practice).
Can not this be done If a story'd have two different output channels assigned?
(probably not I am afraid, which proves I am a real newbie)

I think, I probably need something different.
In my case: story data must go through tex_compilation output channel
before it can be published or previewed correctly.
Compilation is time consuming so the results should be cached for any repreview
or republish.

Krzysztof




On Mon, Oct 27, 2008 at 7:55 PM, bodola, terence
<terence.bodola [at] cbsparamount> wrote:
>
> "So you want to use one output channel for preprocessing and another for
> final processing? Hrm. I don't think that output channels execute in a
> defined order."
>
> We get around this by using publish_another and passing what we need
> from one element/story/template to the other with notes, or stored in a
> separate mysql db sometimes. Then these two different
> elements/stories/templates can have separate output channels and
> destinations. So, for our element for the story that is the
> publish_another story we'll use the slug for the file name and set it in
> the preceding story (shown below as the cleanup block for preceding
> story) and make sure we clear the resource before republish (so that our
> ftp publish, which is set to delete before put, doesn't delete the last
> file first even though they are actually different files. You could be
> even more clever and make sure you know if it matches the name of last
> one published so that if your ftp server really needs delete before put
> it would still work on republish. This didn't seem necessary for us.)
> The second story for us is just a container story to launch execute of
> the template on whatever output channel/destination.
>
> <%cleanup>
> if($burner->get_mode == PUBLISH_MODE) {
> my $bric_id = $story->get_id;
> my $slug = $story->get_slug;
> $burner->clear_notes();
> $burner->notes(bric_id => $bric_id);
> if(my @whateverstory =
> $story->list({uuid=>"06977C68-7452-11DD-8358-255863A74C6D"})) {
> if(my @resource_id = Bric::Dist::Resource->list({story_id =>
> $whateverstory[0]->get_id})) {
> foreach my $resid (@resource_id) {
> $resid->del_story_ids($whateverstory[0]->get_id)->save;
> }}
> $whateverstory[0]->set_slug($bric_id . $slug);
> $whateverstory[0]->save;
> $burner->publish_another($whateverstory[0]);
> }}
> $burner->clear_notes();
> </%cleanup>
>
> then in the publish_another story template
>
> <%perl>
> my ($bric_id,$asset);
> if($bric_id = $burner->notes('bric_id')) {
> $asset = $story->lookup( { id => $bric_id });
> }
>
> ...
>
> </%perl>
>
>
>
> I think in direct mode this would always work, but in queued mode you
> might still get into precedence problems if your first story/template
> takes longer to execute than your second. You might have to further
> ensure in the second template that the first job had gone through
> already somehow. Some sort of http client 200 check and a loop in the
> second template waiting for finished pub on first...or that and a parse
> for a comment that occurs at the end of the live preceding file to be
> sure it is fully there? You could probably also use a Bricolage jobs
> check loop like
>
> $count = 0;
> while((Bric::Util::Job->list({story_id => $bric_id})) and ($count < 10))
> {
> $count++;
> sleep(2);
> }.
>
> or you could maybe be more specific about the actual job instance to
> make sure a republish of the preceding while the publish_another isn't
> done doesn't goof things
>
> Terence
>
> -----Original Message-----
> From: David E. Wheeler [mailto:david [at] kineticode]
> Sent: Monday, October 27, 2008 10:24 AM
> To: users [at] lists
> Subject: Re: LaTeX Story document model and management
>
> On Oct 25, 2008, at 05:07, Krzysztof Rudnik wrote:
>
>> I installed 1.11.1 and for the last 2 weeks I've read everything about
>
>> Bricolage. I have the feeling that Biricolage would be the perfect
>> choice, even if there are opinions that it is almost dead (correct me
>> if I am wrong).
>
> I think that the release of 1.11.1 a few weeks ago proves that it's not
> dead, eh?
>
>> Another feeling is that I can't feel Bric's "way of life" yet, and I
>> am sure that without little help from experienced users I'll make
>> serious strategic mistakes. I really miss for something like
>>
>> make installdemo
>>
>> after which all that nice ideas (i.e how to build site from scratch,
>> manage server side includes, clever media documents management and
>> other "good practice" tips) well hidden in the mailing lists, wiki's
>> etc.could be seen and touched directly.
>
> Yeah, there are some folks who want to do something like this, but tuits
> are in short supply.
>
>> I can imagine the following scenario:
>>
>> 1. define LaTeX_Story document model containing subelements with latex
>> code: tex_paragraph, tex_display_equation, tex_theorem, tex_proof etc.
>
> If it's easy for your editors to write in tex, then that should work
> pretty well.
>
>> 2. define "tex2html_pre" output channel for preprocessing
>> LaTeX_Stories. In this oc one latex file would be constructed and
>> compiled by tex4ht. This file would contain latex code from story's
>> subelement's fields and some extra latex code allowing precise
>> identification of html pieces in the tex4ht final output.
>
> Sounds reasonable.
>
>> Finally, tex_hash of the form (element_id.field_name => generated
>> html) would be build and stored on disk to be used later during all
>> successive publish and preview requests of the same version of the
>> story . All graphics for math presentation with unique (md5) names
>> would be copied to a directory accessible for the local preview
>> server.
>
> So you're talking about caching the results of burns? Sounds
> interesting, though I'm not sure I really follow.
>
>> 3. define tex2html_final in which LaTeX_Story would be prcessed
>> normally but instead of field's values of any tex* element suitable
>> preprocessed tex_hash value would be used.
>>
>> It'd be perfect, if at the beginning of the tex2html_final oc,
>> preprocessing through tex2html_pre could be triggered.
>
> So you want to use one output channel for preprocessing and another for
> final processing? Hrm. I don't think that output channels execute in a
> defined order.
>
>> 4. There is a problem: how to transportat at the right time all
>> graphics files for math presentation that bric does't know about to
>> the external presentation server.
>
> Ideally how would you like it to work?
>
>> If the above scenario is sensible than one could the most from bric
>> (reach media illustrations, bulk edit etc) and from latex (automatic:
>> numbering of items, multipage's cross references, footnotes, tables of
>
>> content etc.)
>>
>> I know that the above LaTeX_Story is too long but hope somebody
>> reached this point.
>> What do you think about it?
>
> I'm not familiar with TeX myself, but it sound pretty reasonable, though
> I didn't really follow every step...anyone else know TeX and have
> suggestions?
>
> Best,
>
> David
>


bharder at methodlogic

Oct 27, 2008, 11:55 PM

Post #5 of 8 (1557 views)
Permalink
Re: LaTeX Story document model and management [In reply to]

On Sat, Oct 25, 2008 at 02:07:37PM +0200, Krzysztof Rudnik wrote:
> Hi,
> I've almost decided to use Birc to build a site for 20 years old
> polish (non profit) journal which popularizes math, physics,
> astronomy, informatics etc. (on various [from school to university]
> levels).
> They have tons of fresh (Pitagoras does't get older too quickly)
> illustrated big articles and exercises - all written in tex because
> they contain heavy math very often.
> I think of building a site where there will be sometnihg more than
> just simple descriptions of pdf's icons.
>
> I installed 1.11.1 and for the last 2 weeks I've read everything about
> Bricolage. I have the feeling that Biricolage would be the perfect
> choice, even if there are opinions that it is almost dead (correct me
> if I am wrong).

Rumours of Bricolage's death are greatly exagerated...

> Another feeling is that I can't feel Bric's "way of life" yet, and I
> am sure that
> without little help from experienced users I'll make serious strategic
> mistakes. I really miss for something like
>
> make installdemo
>
> after which all that nice ideas (i.e how to build site from scratch,
> manage server side includes, clever media documents management and
> other "good practice" tips) well hidden in the mailing lists, wiki's
> etc.could be seen and touched directly.
>
> OK, main problem now.
> How to manage such (latex) content in Bricolage in the most clever and
> bric-ish way.
>
> Using latex, tex4ht, and some additional stuff for picture and html

[snip]

> I can imagine the following scenario:
>
> 1. define LaTeX_Story document model containing subelements with latex
> code: tex_paragraph, tex_display_equation, tex_theorem, tex_proof etc.

I'm not sure if this is applicable here (and I don't have the time to spend this really deserves at the moment...), but this reminds me of an image processing I did, where I associated various processed images with their original, and organized them in such a way to allow traversal to find the any certain type of processing... iow, any mods for an image (ie: grayscale, cropped, solarized, etc) were children of their parent image. The multi-processing I think you're explaining here might be suited for this type of treatment as well...

The most important lines (as I scan an old copy of the template) appear to be:

$container->set_related_media($newmedia);
$container->save();
$relmed->save();


If I find a decent copy of this template on my 'puter, I'll post... otherwise, hopefully this will prove useful, or at least interesting re: LaTeX processing and integration... The idea is that for some unit of your LaTeX document (ie: "paragraph" at a time? "Formula" at a time), you would have the final output generated, and re-incorporated/associated w/ it's source (it would be a child of the source code)...

A heads-up, I also remember running into 8-bit issues when generating PDFs via pdflatex -- I don't remember the fix details, but Bret Dawson may... Other formats may require same treatment.

If this seems confusing, and you're interested, I can try to explain better when it's not so late, and I have some more time -- I don't think this process needs to be as disjointed as my train of thought here... I'm just writing what comes to my mind for completeness' sake...


> 2. define "tex2html_pre" output channel for preprocessing
> LaTeX_Stories. In this oc one latex file would be constructed and

[snip]

> I know that the above LaTeX_Story is too long but hope somebody
> reached this point.
> What do you think about it?
>
> I will be very thankful for your opinions, hints, links to doc, help etc.

Welcome to Bricolage... I hope you enjoy it :)

> Krzysztof Rudnik

--

Brad Harder,
Method Logic Digital Consulting
http://www.methodlogic.net


k.rudnik at gmail

Oct 28, 2008, 2:15 AM

Post #6 of 8 (1554 views)
Permalink
Re: LaTeX Story document model and management [In reply to]

Hi, Brad
....
>
> Rumours of Bricolage's death are greatly exagerated...
yes, your re:'s just finish the proof for me.
>

>> Using latex, tex4ht, and some additional stuff for picture and html
>
> [snip]
I''ll send when I am ready
>
>> I can imagine the following scenario:
>>
>> 1. define LaTeX_Story document model containing subelements with latex
>> code: tex_paragraph, tex_display_equation, tex_theorem, tex_proof etc.
>
> I'm not sure if this is applicable here (and I don't have the time to spend this really deserves at the moment...), but this reminds me of an image processing I did, where I associated various processed images with their original, and organized them in such a way to allow traversal to find the any certain type of processing... iow, any mods for an image (ie: grayscale, cropped, solarized, etc) were children of their parent image. The multi-processing I think you're explaining here might be suited for this type of treatment as well...
>
> The most important lines (as I scan an old copy of the template) appear to be:
>
> $container->set_related_media($newmedia);
> $container->save();
> $relmed->save();
>
This is not the case, I think. I'm just finishing re: to David where
I'll be more precise.
> If I find a decent copy of this template on my 'puter, I'll post... otherwise, hopefully this will prove >useful, or at least interesting re: LaTeX processing and integration...
>The idea is that for some unit of your LaTeX document (ie: "paragraph" at a time? "Formula" at a >time), you would have the final output generated, and re-incorporated/associated w/ it's source (it >would be a child of the source code)...
This is sort of what I am thinking about if I understood you correctly.
>
> A heads-up, I also remember running into 8-bit issues when generating PDFs via pdflatex -- I don't >remember the fix details, but Bret Dawson may... Other formats may require same treatment.
8-bit issues are real pain in the *, but with texlive2008 (after 2
days fight) I managed to build the workflow:
polish latex source (utf8 encoded) ->
latex (pdflatex with dvi output) ->
tex4ht (Customized - /C not c/) ->
html output (utf8 encoded) + transparent gifs for math presentation
perfectly vertically positioned by css commands.
It will certainly no work with any input source, but with mysite.sty
will, I hope.
I am not tex hacker so there are some "black \hbox" 'es in the
process, but it works so far.
>
> If this seems confusing, and you're interested, I can try to explain better when it's not so late, and I have some more time -- I don't think this process needs to be as disjointed as my train of thought here... I'm just writing what comes to my mind for completeness' sake...
just $+\epsilon$ confused, but very interested
>
>
>> 2. define "tex2html_pre" output channel for preprocessing
>> LaTeX_Stories. In this oc one latex file would be constructed and
>
> [snip]
>
>> I know that the above LaTeX_Story is too long but hope somebody
>> reached this point.
>> What do you think about it?
>>
>> I will be very thankful for your opinions, hints, links to doc, help etc.
>
> Welcome to Bricolage... I hope you enjoy it :)
I really do, thanks
Krzysztof

>
> --
>
> Brad Harder,
> Method Logic Digital Consulting
> http://www.methodlogic.net
>


k.rudnik at gmail

Oct 29, 2008, 4:47 PM

Post #7 of 8 (1557 views)
Permalink
Re: LaTeX Story document model and management [In reply to]

thanks David,
this piece about death was just a joke (polish one).
I've decided to play bric's - there is nothing better for me, I suppose.
(and hard to get through /ops, I didn't say that/ tough conceptually
brilliant.)

>
> So you're talking about caching the results of burns? Sounds interesting,
> though I'm not sure I really follow.

Exectly, there must be sort of caching. Not optimized conversion of
typical 7 page's (math'y) document generates ~150 gifs (presenting
math) and takes 9s (picture generation takes 7 of them).
happily picture generation can be switched off
when unnecessary.
It'd be perfect if compiled latex2html output could be cached.
Bulk publish without caching would be a suicide.
I'll do some tests when I am ready.

There are two types of data needing caching.
Pictures for math presentation (thousands of them so there is on sense
to inform bric about them, I think) and html versions of converted
tex* fields.

I'll try to write pseudocode snip to make the idea clear.
Sort of 2in1 solution

<%shared%>
my $texconv=TeX_Converter->new() # this instance should be accessible
during burning in any template.
<%/shared%>

<%init%>
my $env = precise description of where we are: story type, uuid, version, etc
$texconv->init($env) # to know how cached data can be reached
</%init>
....
<!-- end /autohandler -->

<html>....

<%perl>
unless ($burner->notes('preprocess_finished')){
# just to prevent jumping in here too often
# we'll do preprocessing first/ $texconv will swallow tex fields
values for delayed compilation
$garbage=$burner->sdisplay_element($_) for element->get_elements('page');
$burner->notes( preprocess_finished => 1);
$texconv->compile_latex;
# some error handling now
unless ($texconv->compilation_successfull()){
# cleanup if compilation failed
if ($burner->get_mode == PUBLISH_MODE){
$burner->alert("Very bad. Call for tex help now!'); # or something
$m->clear_buffer;
}
if ($burner->get_mode == PREVIEW_MODE){
$m->print($texconv->compilation_log');#
}
$m->abort;
}
}

# compilation was succesful ,
# $texconf will now return cached/compiled html when asked for.
#buisness as usuall
$burner->display_pages('page');

<%/perl%>

<!--end tex_story.mc-->

In any tex* subemement template

<!-- tex*_element.mc -->
%#instead of $element->get_value() and the like
$texconv->return_cached_compiled_html_or_swallow_for_delayed_compilation($element->get_value)

<!-- end tex_element.mc-->

Math gifs generated during compilation can be stored in
DocumentRoot/math-garbage/
of my local preview server.
In html output from tex conversion all <img> tags with inline math
have the form
<img href="/math-garbage/(md5).gif">
Some publish action should rsync this directory to its production server mirror.
#know nothing about actions yet.

It'd be perfect if in <%cleanup> block of tex_story template
tex_conv could store (cache) data in hidden to editors dedicated
story field but it is impossible I am afraid.

Does the above make sense?

\thanks
Krzysztof
PS.
there is a funny bug in 1.11.1
couple of times after pressing <cancel checkout> button I landed in
www.checkout.com


> Best,
>
> David


david at kineticode

Nov 6, 2008, 8:03 PM

Post #8 of 8 (1518 views)
Permalink
Re: LaTeX Story document model and management [In reply to]

On Oct 29, 2008, at 4:47 PM, Krzysztof Rudnik wrote:

> thanks David,
> this piece about death was just a joke (polish one).

Ah. Sorry to be dense.

> I've decided to play bric's - there is nothing better for me, I
> suppose.
> (and hard to get through /ops, I didn't say that/ tough conceptually
> brilliant.)

W00t!

>> So you're talking about caching the results of burns? Sounds
>> interesting,
>> though I'm not sure I really follow.
>
> Exectly, there must be sort of caching. Not optimized conversion of
> typical 7 page's (math'y) document generates ~150 gifs (presenting
> math) and takes 9s (picture generation takes 7 of them).
> happily picture generation can be switched off
> when unnecessary.
> It'd be perfect if compiled latex2html output could be cached.
> Bulk publish without caching would be a suicide.
> I'll do some tests when I am ready.

Makes sense.

> There are two types of data needing caching.
> Pictures for math presentation (thousands of them so there is on sense
> to inform bric about them, I think) and html versions of converted
> tex* fields.
>
> I'll try to write pseudocode snip to make the idea clear.
> Sort of 2in1 solution
>
> %#/autohandler
> <%shared%>
> my $texconv=TeX_Converter->new() # this instance should be accessible
> during burning in any template.
> <%/shared%>

I believe that <%shared> blocks are lexically scoped to the template
file, not to any other template. You can create a utility template, to
return one, though.

> <%init%>
> my $env = precise description of where we are: story type, uuid,
> version, etc
> $texconv->init($env) # to know how cached data can be reached
> </%init>
> ....
> <!-- end /autohandler -->
>
> %# tex_page.mc
> <html>....
>
> <%perl>
> unless ($burner->notes('preprocess_finished')){
> # just to prevent jumping in here too often
> # we'll do preprocessing first/ $texconv will swallow tex fields
> values for delayed compilation
> $garbage=$burner->sdisplay_element($_) for element-
> >get_elements('page');
> $burner->notes( preprocess_finished => 1);
> $texconv->compile_latex;
> # some error handling now
> unless ($texconv->compilation_successfull()){
> # cleanup if compilation failed
> if ($burner->get_mode == PUBLISH_MODE){
> $burner->alert("Very bad. Call for tex help now!'); # or
> something
> $m->clear_buffer;
> }
> if ($burner->get_mode == PREVIEW_MODE){
> $m->print($texconv->compilation_log');#
> }
> $m->abort;

You want $burner->throw_error() here.


> }
> }
>
> # compilation was succesful ,
> # $texconf will now return cached/compiled html when asked for.
> #buisness as usuall
> $burner->display_pages('page');
>
> <%/perl%>

So where is it cached?

>
> <!--end tex_story.mc-->
>
> In any tex* subemement template
>
> <!-- tex*_element.mc -->
> %#instead of $element->get_value() and the like
> $texconv-
> >
> return_cached_compiled_html_or_swallow_for_delayed_compilation
> ($element->get_value)
>
> <!-- end tex_element.mc-->
>
> Math gifs generated during compilation can be stored in
> DocumentRoot/math-garbage/
> of my local preview server.
> In html output from tex conversion all <img> tags with inline math
> have the form
> <img href="/math-garbage/(md5).gif">
> Some publish action should rsync this directory to its production
> server mirror.
> #know nothing about actions yet.
>
> It'd be perfect if in <%cleanup> block of tex_story template
> tex_conv could store (cache) data in hidden to editors dedicated
> story field but it is impossible I am afraid.

What is it you want to store, and where?

> Does the above make sense?

Sort of…I'm sure some of it is just lost in translation.

Best,

David

Bricolage users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.