docbook 2 html with images

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

docbook 2 html with images

JT Moree
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,
  I recently tried out docbook2html (which of course is just jw with
some default options).  I and the documentation for blender (which led
me to this in the first place) used the -o option to output to a
subdirectory.

Alas none of the images were copied into the subdirectory which left me
with only part of what I needed.

I wrote a script to copy the images for me but I thought perhaps the
latest version of the utils might have already dealt with this issue.

I am on debian sarge for amd64 and the utils version is 0.6.14.  jw
version 1.1.

Can anyone tell me if this issue has been addressed?  Shall I clean up
my script and post it somewhere for the maintainer of docbook-utils to
possibly include?

- --
JT Morée
PC Xperience, Inc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD4hdOucZ4lMT2d5IRAgAYAJ9tLtC6qbeq+pNmRDmmkcSFaWTwPwCgkGkm
5/PaT7TJerEE9sxfujCKeAE=
=tgvA
-----END PGP SIGNATURE-----

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

ebischoff (Bugzilla)
Le Jeudi 2 Février 2006 15:29, JT Moree a écrit :

> Hello,
>   I recently tried out docbook2html (which of course is just jw with
> some default options).  I and the documentation for blender (which led
> me to this in the first place) used the -o option to output to a
> subdirectory.
>
> Alas none of the images were copied into the subdirectory which left me
> with only part of what I needed.
>
> I wrote a script to copy the images for me but I thought perhaps the
> latest version of the utils might have already dealt with this issue.
>
> I am on debian sarge for amd64 and the utils version is 0.6.14.  jw
> version 1.1.
>
> Can anyone tell me if this issue has been addressed?  Shall I clean up
> my script and post it somewhere for the maintainer of docbook-utils to
> possibly include?

Hi JT,

and thanks for your help proposal,

It's an old issue. The difficulty is to guess which images should be copied
where from and where to. I can imagine how you can write a script that works
for you, but not how you can write a script that would work for everyone. If
you have a generic solution of course it is more than welcome.


--
George W. Bush mentions "liberty" in every speech he does. But today, the USA
exports war, torture, humiliation, secret prisons, arbitrary detention
without any judgement, and telephone tapping. That has very little to do with
freedom.
Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

JT Moree
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>Alas none of the images were copied into the subdirectory which left me
>>with only part of what I needed.

> It's an old issue. The difficulty is to guess which images should be copied
> where from and where to. I can imagine how you can write a script that works
> for you, but not how you can write a script that would work for everyone. If
> you have a generic solution of course it is more than welcome.

I used the SRC tag in the resulting html files.  In fact, two checks
would make the process more efficient.

for each SRC tag found in resulting html files
  if srcfile does not exist
    if srcfile does exist in original files
      copy srcfile

This is done easily in shell with unix utilities.  I dont know if it
could be integrated into a makefile.  are makefiles just shell commands?

- --
JT Morée
PC Xperience, Inc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD457YucZ4lMT2d5IRAtH8AKCNb/fbcgSQQIpnVkpybxj2z+KD+ACfYbUV
0KUFnv3uXxs+Kke8rkoWi8s=
=cJIr
-----END PGP SIGNATURE-----

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

JT Moree
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Actually it's the src attribute of the img tags that I'm looking at.
and come to think of it, this algor. needs some tweaking.

for each SRC attribute found in resulting html files
  parse out file
  if file starts with http:// #ftp too. etc?
    if srcfile does not exist in resulting html
      if srcfile does exist in original files
        copy srcfile from original to html

- --
JT Morée
PC Xperience, Inc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD46FqucZ4lMT2d5IRAg6oAJ9oScwxI0pPG2ccH6YiXDjo2ih9dACgi6Ko
kO7XVu6k6KpTBP1JexStWuU=
=r4li
-----END PGP SIGNATURE-----

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

ebischoff (Bugzilla)
Le Vendredi 3 Février 2006 19:31, JT Moree a écrit :
> Actually it's the src attribute of the img tags that I'm looking at.
> and come to think of it, this algor. needs some tweaking.
>
> for each SRC attribute found in resulting html files
>   parse out file
>   if file starts with http:// #ftp too. etc?

OK. How do you do the difference between an <img src=""> that comes from the
local files and an <img src=""> that comes from some other external source ?

And why should the images be precisely in the same directory as the docbook
source ?

>     if srcfile does not exist in resulting html
>       if srcfile does exist in original files
>         copy srcfile from original to html

Understood.

--
George W. Bush mentions "liberty" in every speech he does. But today, the USA
exports war, torture, humiliation, secret prisons, arbitrary detention
without any judgement, and telephone tapping. That has very little to do with
freedom.
Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

ebischoff (Bugzilla)
In reply to this post by JT Moree
Le Vendredi 3 Février 2006 19:20, JT Moree a écrit :
> for each SRC tag found in resulting html files
>   if srcfile does not exist
>     if srcfile does exist in original files
>       copy srcfile
>
> This is done easily in shell with unix utilities.  I dont know if it
> could be integrated into a makefile.  are makefiles just shell commands?

Ooops, missed this part of your message.

No, makefiles are a separate mechanism. In fact some projects like Borges rely
on makefiles, the docbook-tools don't. One of the many reasons is that "make"
utility is a developper package that could very well not be installed.


--
George W. Bush mentions "liberty" in every speech he does. But today, the USA
exports war, torture, humiliation, secret prisons, arbitrary detention
without any judgement, and telephone tapping. That has very little to do with
freedom.
Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

JT Moree
In reply to this post by ebischoff (Bugzilla)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> OK. How do you do the difference between an <img src=""> that comes from the
> local files and an <img src=""> that comes from some other external source ?

see next message i sent.  src with http:// or ftp:// etc are external
and would not be acted upon.

> And why should the images be precisely in the same directory as the docbook
> source ?
Where else would they be?  if they are being referred to in the docbook
files and they are not external?


Can makefiles call external programs.  Worst case could be that the
utility is called manually by the user or by the docbook2html wrapper.

- --
JT Morée
PC Xperience, Inc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD5K+7ucZ4lMT2d5IRAjC1AKCIWER1P/hVgFF/8RALZqxYLejL1QCcCKjq
YECzVkDxuTvqsNsqM5wQVfk=
=KE18
-----END PGP SIGNATURE-----

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

ebischoff (Bugzilla)
Le Samedi 4 Février 2006 14:44, JT Moree a écrit :
> > OK. How do you do the difference between an <img src=""> that comes from
> > the local files and an <img src=""> that comes from some other external
> > source ?
>
> see next message i sent.  src with http:// or ftp:// etc are external
> and would not be acted upon.

OK.

> > And why should the images be precisely in the same directory as the
> > docbook source ?
>
> Where else would they be?

For example, at my place, they are in images/ ...

> if they are being referred to in the docbook
> files and they are not external?

In fact, they could be anywhere.

You would at least need to pass a parameter like --images-dir to your script.
That could default to ".".

> Can makefiles call external programs.  Worst case could be that the
> utility is called manually by the user or by the docbook2html wrapper.

I see it best in docbook2html wrapper.

Heya, anybody listening us ? Any maintainer here ? ;-)


--
George W. Bush mentions "liberty" in every speech he does. But today, the USA
exports war, torture, humiliation, secret prisons, arbitrary detention
without any judgement, and telephone tapping. That has very little to do with
freedom.
Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

JT Moree
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>And why should the images be precisely in the same directory as the
>>>docbook source ?
>>
>>Where else would they be?
>
>
> For example, at my place, they are in images/ ...
Does your docbook link to them with the 'images' in the path?

In my case the Blender guide is not just referring to images but images
under subdirectories so that the src looks like
src="boo/bar/baz/image.png" in the resulting html.  the original docbook
files use
ref="boo/bar/baz/image.png" format="png"

>>if they are being referred to in the docbook
>>files and they are not external?
>
>
> In fact, they could be anywhere.
>
> You would at least need to pass a parameter like --images-dir to your script.
> That could default to ".".

That's fine but I'm not sure that it makes sense.  How could the docbook
stuff use images from anywhere without specifiying where that is in the
ref tag?
And if it is specified it results in an <img src= after conversion to html?
And if it can be found by the docbook stuff why wouldn't it be findable
by the html conversion stuff and my utility as well?

- --
JT Morée
PC Xperience, Inc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD5SWrucZ4lMT2d5IRAozpAJ9OmUPYieDy7mjvklI+7GER7dwb/gCfVDOh
7beUIIQiHvezgZAbSee+g14=
=a617
-----END PGP SIGNATURE-----

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

ebischoff (Bugzilla)
Le Samedi 4 Février 2006 23:07, JT Moree a écrit :
> > For example, at my place, they are in images/ ...
>
> Does your docbook link to them with the 'images' in the path?

I suppose it has to reference them somehow, yes, otherwise how would the
rendering engine calculate the images size for example for PDF output ?

> In my case the Blender guide is not just referring to images but images
> under subdirectories so that the src looks like
> src="boo/bar/baz/image.png" in the resulting html.  the original docbook
> files use
> ref="boo/bar/baz/image.png" format="png"

Yes, you could base your algorithm on the path in the docbook source.

Beware it could be something vicious like "../../images/", in which case it
might not be obvious to convert that to a HTML path and copy the files.

Example to show you why this could reasonably happen
(use fixed font to display) :
  project/
    +------ images/
    |          +----- illustration.png
    |
    +------ part 1/
    |         +------ chapter1/
    |         |          +-------- myfile.docbook
    |         |
    |         +------ chapter 2/

It could also be an absolute path, it is not necessarily a relative path.

> > You would at least need to pass a parameter like --images-dir to your
> > script. That could default to ".".
>
> That's fine but I'm not sure that it makes sense.  How could the docbook
> stuff use images from anywhere without specifiying where that is in the
> ref tag?

Correct.

> And if it is specified it results in an <img src= after conversion to html?
> And if it can be found by the docbook stuff why wouldn't it be findable
> by the html conversion stuff and my utility as well?

If you find a valuable algorithm, I have nothing against, on the contrary, it
would really be a *great* plus for the docbook-utils.

I just wanted to stress that the source images could be anywhere. You will
have to think a lot about that in your algorithm. In fact, it's what has
always prevented me from coding that...



--
George W. Bush mentions "liberty" in every speech he does. But today, the USA
exports war, torture, humiliation, secret prisons, arbitrary detention
without any judgement, and telephone tapping. That has very little to do with
freedom.
Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

JT Moree
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Beware it could be something vicious like "../../images/", in which case it
> might not be obvious to convert that to a HTML path and copy the files.

Actually there are a few like that but I haven't done any testing
because the blender guys didn't include the images directory so they are
broken links regardless.  I will probably create some images for testing
purposes.

> It could also be an absolute path, it is not necessarily a relative path.
Yes, I've dealt with this before in a photo album shell script project
called picbook.  It is tricky.  I had it working pretty well but ran
into issues with path names that included dashes.  Never figured out why
that happened.

- --
JT Morée
PC Xperience, Inc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD5qvjucZ4lMT2d5IRAuqjAKCoOmOYjjxyKJFxnrOVdDyHI3yfJQCcDFGc
WB3cYH3BDQkSKp63yiUWTEs=
=Oh3E
-----END PGP SIGNATURE-----

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

Reply | Threaded
Open this post in threaded view
|

Re: docbook 2 html with images

ebischoff (Bugzilla)
Le Lundi 6 Février 2006 02:52, JT Moree a écrit :

> > Beware it could be something vicious like "../../images/", in which case
> > it might not be obvious to convert that to a HTML path and copy the
> > files.
>
> Actually there are a few like that but I haven't done any testing
> because the blender guys didn't include the images directory so they are
> broken links regardless.  I will probably create some images for testing
> purposes.
>
> > It could also be an absolute path, it is not necessarily a relative path.
>
> Yes, I've dealt with this before in a photo album shell script project
> called picbook.  It is tricky.  I had it working pretty well but ran
> into issues with path names that included dashes.  Never figured out why
> that happened.

I imagine that they had been mistaken as options in commands like "cp".


--
George W. Bush mentions "liberty" in every speech he does. But today, the USA
exports war, torture, humiliation, secret prisons, arbitrary detention
without any judgement, and telephone tapping. That has very little to do with
freedom.