public inbox for docbook-tools-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36       ` Jochem Huhmann
@ 2000-12-27  6:36         ` Eric Bischoff
  2000-12-27  6:36           ` Jochem Huhmann
  0 siblings, 1 reply; 24+ messages in thread
From: Eric Bischoff @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Jochem Huhmann; +Cc: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]

Jochem Huhmann wrote:
> 
> * Eric Bischoff <ebisch@cybercable.tm.fr> wrote:
> > The stylesheets solution could perfectly work if there was a
> > way to easily detect which extension(s) do exist for this
> > file from DSSSL.
> 
> Could this be done by looking at this from the converting
> (shell-)backend that builds the command-line for jade? It knows the
> output format and could pass a variable to jade via "-V variable=value",
> which is available in the stylesheet then (or isn't it?). Just a fuzzy
> idea...

You idea is good, but this would mean that you should pass
*for each screenshot* its file type while calling jade. If
your doc includes, say, 120 screenshots, you can imagine the
number of parameters to Jade... Well, a shell script could
do the job, yes, but would jade stand so much variables ?

-- 
 Éric Bischoff   -   mailto:ebisch@cybercable.tm.fr
 __________________________________________________
                                           \^o~_.
     .~.                           ______  /( __ )
     /V\         Toys story         \__  \/  (  V
   //   \\                            \__| (__=v
  /(     )\                        |\___/     )
    ^^-^^                           \_____(  )
     Tux                        Konqui     \__=v
 __________________________________________________

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36   ` Sam Roberts
@ 2000-12-27  6:36     ` Eric Bischoff
  2000-12-27  6:36       ` David C. Mason
                         ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Eric Bischoff @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2040 bytes --]

Sam Roberts wrote:
> 
> > I'm currently using the following approach:
> >
> > <graphic fileref="foo.&gif-eps;">
> >
> > stands for:
> > "use foo.gif when making HTML files, foo.eps when printing
> > to TeX."
> >
> > You can do create on the same model other entities like
> > &jpg-eps;. It's not perfect, but it's simple and works.
> 
> I assume we're talking the same thing here,

Yes

> and that you
> use this technique only because you use BOTH gifs and
> jpegs in the same document when it's formatted as html?

Not necessarily in the same document. I'm using both gifs
and jpegs, but usually in different documents. Anyway, it
remains a problem if you hack the stylesheets.

What is really a problem is that the file extension depends
on the processing you apply to the document, while the
docbook file should remain a simple source. And since you
don't want to hack the document each time you use it
differently, the solution needs to simply work from the
command line. So I managed in a way that the only thing I
need is the following definition in some external file:

<!ENTITY % html "IGNORE">
<![%html; [
        <!ENTITY % print "IGNORE">
        <!ENTITY gif-eps "gif">
        <!ENTITY jpg-eps "jpg">
        <!ENTITY jpeg-eps "jpeg">
]]>
<!ENTITY % print "INCLUDE">
<![%print; [
        <!ENTITY gif-eps "eps">
        <!ENTITY jpg-eps "eps">
        <!ENTITY jpeg-eps "eps">
]]>

The stylesheets solution could perfectly work if there was a
way to easily detect which extension(s) do exist for this
file from DSSSL.

-- 
 Éric Bischoff   -   mailto:ebisch@cybercable.tm.fr
 __________________________________________________
                                           \^o~_.
     .~.                           ______  /( __ )
     /V\         Toys story         \__  \/  (  V
   //   \\                            \__| (__=v
  /(     )\                        |\___/     )
    ^^-^^                           \_____(  )
     Tux                        Konqui     \__=v
 __________________________________________________

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36 ` Eric Bischoff
@ 2000-12-27  6:36   ` Diego Sevilla Ruiz (dsevilla@um.es)
  2000-12-27  6:36     ` Eric Bischoff
  2000-12-27  6:36     ` Sam Roberts
  2000-12-27  6:36   ` Sam Roberts
  1 sibling, 2 replies; 24+ messages in thread
From: Diego Sevilla Ruiz (dsevilla@um.es) @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Eric Bischoff; +Cc: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2471 bytes --]

Hi, Eric:

    Sorry for my ignorance, but I am new to docbook ;-)

    What you use (&gif-eps;) is standard? I mean, can I use directly? Or
does it depend on some "macro" defined before? Sorry again, but I don't
know how to define "macros" in SGML :-( .

    Thanks in advance.
    diego.

Eric Bischoff wrote:

> Sam Roberts wrote:
> >
> >
> > (define (graphic-file filename)
> >     (let ((ext (file-extension filename)))
> >         (if (or tex-backend   ;; TeX can work this out itself
> >             (not filename)
> >             (not %graphic-default-extension%)
> >             (member ext %graphic-extensions%))
> >         filename
> >         (string-append filename "." %graphic-default-extension%))))
> >
>
> Such code trying to guess the graphic extension from within
> the stylesheet is a good idea. Anyway, it will always face
> the same problem : for publishing in HTML, for example, how
> to decide whether to add JPEG, PNG or GIF ? It's not easy.
>
> I'm currently using the following approach:
>
>         <graphic fileref="foo.&gif-eps;">
>
> stands for:
>         "use foo.gif when making HTML files, foo.eps when printing
> to TeX."
>
> You can do create on the same model other entities like
> &jpg-eps;. It's not perfect, but it's simple and works.
>
> --
>  Éric Bischoff   -   mailto:ebisch@cybercable.tm.fr
>  __________________________________________________
>                                            \^o~_.
>      .~.                           ______  /( __ )
>      /V\         Toys story         \__  \/  (  V
>    //   \\                            \__| (__=v
>   /(     )\                        |\___/     )
>     ^^-^^                           \_____(  )
>      Tux                        Konqui     \__=v
>  __________________________________________________

--
Diego Sevilla Ruiz -- http://www.ditec.um.es/~dsevilla/
Departamento de Ingeniería y Tecnología de Computadores
Facultad de Informática. Universidad de Murcia
Campus de Espinardo - 30080 Murcia (SPAIN)
Tel.: +34-968-367570
E-mail: dsevilla@ditec.um.es

$_="\\l/) (>".     "_'\n<";@@=        /.|\n/g;$_=
"\@".     "\007f".   "DDq".           "DD5".   "\204".
"\@".     "DT4CE".    "D54E".         "DD".    "\244".
"\021".   "dBDTC".     "\010DD".      "\200\$FD\024".
"GDAG".   "DAGDT".       "CqI";$c     =0;$p    =5;for$q
(/./g)    {$q=              ord$q;    for(a,   b){$z[$c]
=$@[$p+=($q&15)    -4];$q>>=4;$c+=33  ;$c>98   &&($c-=98);}};print@z;



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
@ 2000-12-27  6:36 Sam Roberts
  2000-12-27  6:36 ` Eric Bischoff
  0 siblings, 1 reply; 24+ messages in thread
From: Sam Roberts @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Peter Toft; +Cc: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3069 bytes --]

pdfjadetex need pdf, png, or perhaps jpeg formatted images, it
doesn't grok .eps.

The easy way to fix this is to make the stylesheets not generate
an extension in the tex files (right now there's an option
where you specify the default extension for print, html, rtf, etc.
-- except that the print/tex is going to become two formats,
pdf and ps, so this doesn't work). The code below does this.
[pdf]jadetex then figures out for itself what it's preferred
image format is and finds it (assumming it exists...).

By the way, this list is dead. You should subscribe to the
docbook-apps mailing list, it's very active and helpful. There
should be info on Normans site at www.nwalsh.com. Mail me
if you can't find it.

Sam

;;
;; Snarfed from Angus Lees, gus at getsystems.com,
;; message id <20000302155142.D9761@getsystems.com> in the docbook list.
;;

(define (graphic-file filename)
    (let ((ext (file-extension filename)))
        (if (or tex-backend   ;; TeX can work this out itself
            (not filename)
            (not %graphic-default-extension%)
            (member ext %graphic-extensions%))
        filename
        (string-append filename "." %graphic-default-extension%))))



Previously, you (Peter Toft) wrote:
> Using Docbook with Red Hat 6.2 I have a hard time
> generating the PDF file with images (HTML is working
> fine). I have xterm.gif and xterm.eps available and my
> simplified source is shown below (The real source gives
> 350 pages of text)
> 
> db2pdf complains
> 
> -------->
> ! LaTeX Error: Unknown graphics extension: .eps.
> 
> See the LaTeX manual or LaTeX Companion for
> explanation.
> Type  H <return>  for immediate help.
>  ...                                              
>                                                   
> l.753 {0}}
> 
> \endNode{}\endNode{}\endSeq{}\endPar{}\endNode{}\endSeq{}\endDispl...
> <--------
> 
> Any clues - I am very stuck here....
> I am using 
> tetex-1.0.6-11
> jade-1.2.1-9
> jadetex-2.7-2
> 
> -----------------
> My sgml-source:
> 
> <!doctype book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
> ]>
> 
> <book id="index" lang="da">
>   <bookinfo>
>     <date>9. april 2000</date>
>     <title>aargh</title>
>     <AUTHORGROUP>
> 
>     <AUTHOR>
>       <FIRSTNAME>Peter</FIRSTNAME>
>       <SURNAME>Toft</SURNAME>
>     </AUTHOR>
> 
>     </AUTHORGROUP>
>     <COPYRIGHT>
>       <YEAR>1998</YEAR>
>       <HOLDER>Toft/HOLDER>
>     </COPYRIGHT>
>   </bookinfo>
> 
> 
> 
> <chapter id="intro">
> <title>Linux?</title>
> 
> <sect1 id="OpenSource">
> <title>Ã…ben kildetekst - Open Source</title>
> 
> <FIGURE ID="xterm" FLOAT="1">
> <TITLE>xterm
> </TITLE>
> <GRAPHIC
> FILEREF="xterm"  SCALE="60"></GRAPHIC>
> </FIGURE>
> </sect1>
> </chapter>
> </book>
> 
> 
> Peter Toft, Ph.D. [pto@sslug.dk] http://www.sslug.dk/~pto
> 
> ... when men were men and wrote their own device driver ...
>                     --- Linus Benedict Torvalds
> 
> 
> 

--
--
Sam Roberts (sam@cogent.ca), Cogent Real-Time Systems (www.cogent.ca)
"News is very popular among its readers." - RFC 977 (NNTP)

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36   ` Diego Sevilla Ruiz (dsevilla@um.es)
  2000-12-27  6:36     ` Eric Bischoff
@ 2000-12-27  6:36     ` Sam Roberts
  1 sibling, 0 replies; 24+ messages in thread
From: Sam Roberts @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

>     Sorry for my ignorance, but I am new to docbook ;-)
> 
>     What you use (&gif-eps;) is standard? I mean, can I use directly? Or
> does it depend on some "macro" defined before? Sorry again, but I don't
> know how to define "macros" in SGML :-( .
> 
>     Thanks in advance.
>     diego.
> 
> Eric Bischoff wrote:

In case it's not clear, this below must be placed into a stylesheet
customization layer. This is described in nwalshes docs for the
docbook stylesheets, at www.nwalsh.com.


> > Sam Roberts wrote:
> > >
> > >
> > > (define (graphic-file filename)
> > >     (let ((ext (file-extension filename)))
> > >         (if (or tex-backend   ;; TeX can work this out itself
> > >             (not filename)
> > >             (not %graphic-default-extension%)
> > >             (member ext %graphic-extensions%))
> > >         filename
> > >         (string-append filename "." %graphic-default-extension%))))
> > >


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36     ` Eric Bischoff
  2000-12-27  6:36       ` David C. Mason
@ 2000-12-27  6:36       ` Sam Roberts
  2000-12-27  6:36         ` Norman Walsh
  2000-12-27  6:36       ` Jochem Huhmann
  2 siblings, 1 reply; 24+ messages in thread
From: Sam Roberts @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

From: Eric Bischoff <ebisch@cybercable.tm.fr>

> The stylesheets solution could perfectly work if there was a
> way to easily detect which extension(s) do exist for this
> file from DSSSL.

I'm not a dsssl hacker, but I'm surprised this isn't possible.

Cheers,
Sam


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36             ` Eric Bischoff
@ 2000-12-27  6:36               ` Jochem Huhmann
  2000-12-27  6:36                 ` Eric Bischoff
  0 siblings, 1 reply; 24+ messages in thread
From: Jochem Huhmann @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

* Eric Bischoff <ebisch@cybercable.tm.fr> wrote:
> The stylesheet themselves have easy ways of determining the
> backend with no help of any shell script (Sam's very first
> message even shows how to do it in DSSSL).

Err, yes. That's right ;-) But from within a shell script you can
configure/request a specific file-format for a given output (as in
preferring PNG over GIF for HTML-output) and then pass this over to jade
and the stylesheets. You have to have all images in this format then,
yes. That's a "Not my problem, get your work done and I do mine" from
DSSSL point of view ;-)

> To summarize :
> 
> We have files that may be GIF, JPEG, PNG, EPS, ... :
> 	flower.jpeg, cactus.gif, flower.eps, cactus.eps
> We have a selected backend (tex, pdf, html, ...) :
> 	html
> We have a filename from the docbook document :
> 	flower
> 
> What would be nice if the stylesheet could say :
> 
> "Well, this is html so I can accept JPG, JPEG, GIF, and PNG.
> The filename is "flower" so I should try "flower.jpg",
> "flower.jpeg", "flower.gif" and "flower.png". Hmmm, only
> "flower.jpeg" exists : I'll take it."

That would be nice indeed. Although one could ask if this is in DSSSL
scope anymore.

> But this would assume we would have a way to know from DSSSL
> whether a file exists or not. Norm said it was impossible.

DSSSL isn't a system programming language, it is for stylesheets. If
this means that you have to have all images in one format, well, convert
them ;-)


        Jochem

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36                     ` godoy
@ 2000-12-27  6:36                       ` Jochem Huhmann
  2000-12-27  6:36                       ` Eric Bischoff
  1 sibling, 0 replies; 24+ messages in thread
From: Jochem Huhmann @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

Hi Jorge!

* godoy@conectiva.com.br wrote:
> When I choose "PS" backend, the script runs something similar to 
> 
> for i in `ls directory/images/tiff/*.tiff` ; do 
>     convert directory/images/tiff/$i directory/images/eps/`basename $i .tiff`.eps
> done
> 
> and then call the Makefile with the correct options (runs
> collateindex, runs openjade, runs jadetex 3 times, runs dvips and
> finally calls gv). 

Yes, this is fine. That's what I meant with "handle this outside of
DSSSL". With such an approach you have to store the images for the
document in some single directory, but this is a low price to pay (and a
good idea anyway).


        Jochem

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36                       ` Eric Bischoff
@ 2000-12-27  6:36                         ` godoy
  2000-12-27  6:36                           ` Jochem Huhmann
  0 siblings, 1 reply; 24+ messages in thread
From: godoy @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Eric Bischoff; +Cc: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1292 bytes --]

Eric Bischoff <ebisch@cybercable.tm.fr> writes:

> godoy@conectiva.com.br wrote:
> > 
> > We work this way:
> > 
> > All pictures are in TIFF format (better quality)
> > 
> > When I choose "PS" backend, the script runs something similar to
> > 
> > for i in `ls directory/images/tiff/*.tiff` ; do
> >     convert directory/images/tiff/$i directory/images/eps/`basename $i .tiff`.eps
> > done
> 
> Yes, this is a very good solution too. It only has two small
> drawback :
> - it can be slow to convert all the pictures each time you
> process the docbook
> document. But this can be avoided through a test or using
> the Makefile mechanism.

They are converted only if there's no converted file. Conversion can
be suppressed with "touch", for testing purposes... 

> - it requires disciple from your authors ;-)

Well... Everything would require that, but all this process can be
mapped to Emacs and it can asks interactively by these
parameters. VI/pico/jed/etc users can run these by hand. 


1. There's no perfect solution.
2. "Make a foul proof tool and only a foul would use it".


These two sayings are very useful guidelines when developing something
:-) 



-- 
Godoy.	<godoy@conectiva.com.br> 

Departamento de Publicações
Publishing Department                   Conectiva S.A.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36         ` Eric Bischoff
@ 2000-12-27  6:36           ` Jochem Huhmann
  2000-12-27  6:36             ` Eric Bischoff
  0 siblings, 1 reply; 24+ messages in thread
From: Jochem Huhmann @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

* Eric Bischoff <ebisch@cybercable.tm.fr> wrote:
> Jochem Huhmann wrote:
> > 
> > * Eric Bischoff <ebisch@cybercable.tm.fr> wrote:
> > > The stylesheets solution could perfectly work if there was a
> > > way to easily detect which extension(s) do exist for this
> > > file from DSSSL.
> > 
> > Could this be done by looking at this from the converting
> > (shell-)backend that builds the command-line for jade? It knows the
> > output format and could pass a variable to jade via "-V variable=value",
> > which is available in the stylesheet then (or isn't it?). Just a fuzzy
> > idea...
> 
> You idea is good, but this would mean that you should pass
> *for each screenshot* its file type while calling jade. If
> your doc includes, say, 120 screenshots, you can imagine the
> number of parameters to Jade... Well, a shell script could
> do the job, yes, but would jade stand so much variables ?

I didn't meant it this way. The wrapping shell-backend knows the target
format and therefore it should know which file-type for images is the
best for this target format. So it could pass this format (as in "png",
"eps", "gif", ...) in a variable to jade and make it available in the
stylesheet.

The stylesheet has the blank filename (from the SGML source) and the
needed extension (from that variable) of the image-file then. This leads
me to the assumption that this should be enough to build the right
file-name (name + extension) in the stylesheet.

It wouldn't be enough to make sure that the file in the needed format
really exists, yes. But if it exists this could work. I haven't got the
time right now to dig through the stylesheets to see how this could be
done in a driver file and I may well have missed something important,
though.


        Jochem

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36     ` Eric Bischoff
@ 2000-12-27  6:36       ` David C. Mason
  2000-12-27  6:36       ` Sam Roberts
  2000-12-27  6:36       ` Jochem Huhmann
  2 siblings, 0 replies; 24+ messages in thread
From: David C. Mason @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Eric Bischoff; +Cc: docbook-tools-discuss

Eric Bischoff <ebisch@cybercable.tm.fr> writes:


> The stylesheets solution could perfectly work if there was a
> way to easily detect which extension(s) do exist for this
> file from DSSSL.


Have you brought it up with Norman - seems like it would be
do-able. <ndw@nwalsh.com>


Dave

-- 

          David Mason
        Red Hat AD Labs

        dcm@redhat.com
  http://people.redhat.com/dcm

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36               ` Jochem Huhmann
@ 2000-12-27  6:36                 ` Eric Bischoff
  2000-12-27  6:36                   ` Jochem Huhmann
  0 siblings, 1 reply; 24+ messages in thread
From: Eric Bischoff @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Jochem Huhmann; +Cc: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]

Jochem Huhmann wrote:
> Err, yes. That's right ;-) But from within a shell script you can
> configure/request a specific file-format for a given output (as in
> preferring PNG over GIF for HTML-output)

You can do this in the stylesheets as well, as Sam's code
snippet shows it.

> > What would be nice if the stylesheet could say :
> >
> > "Well, this is html so I can accept JPG, JPEG, GIF, and PNG.
> > The filename is "flower" so I should try "flower.jpg",
> > "flower.jpeg", "flower.gif" and "flower.png". Hmmm, only
> > "flower.jpeg" exists : I'll take it."
> 
> That would be nice indeed. Although one could ask if this is in DSSSL
> scope anymore.

True.

> DSSSL isn't a system programming language, it is for stylesheets. If
> this means that you have to have all images in one format, well, convert
> them ;-)

... or use my entities-based solution ;-).

I also know there's an "imagelib" functionality in Jade, but
I don't know if this could address this problem.

-- 
 Éric Bischoff   -   mailto:ebisch@cybercable.tm.fr
 __________________________________________________
                                           \^o~_.
     .~.                           ______  /( __ )
     /V\         Toys story         \__  \/  (  V
   //   \\                            \__| (__=v
  /(     )\                        |\___/     )
    ^^-^^                           \_____(  )
     Tux                        Konqui     \__=v
 __________________________________________________

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36   ` Diego Sevilla Ruiz (dsevilla@um.es)
@ 2000-12-27  6:36     ` Eric Bischoff
  2000-12-27  6:36     ` Sam Roberts
  1 sibling, 0 replies; 24+ messages in thread
From: Eric Bischoff @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1872 bytes --]

"Diego Sevilla Ruiz (dsevilla@um.es)" wrote:
> 
> Hi, Eric:
> 
>     Sorry for my ignorance, but I am new to docbook ;-)
> 
>     What you use (&gif-eps;) is standard? I mean, can I use directly? Or
> does it depend on some "macro" defined before? Sorry again, but I don't
> know how to define "macros" in SGML :-( .

It's a kind of "macro" that is called an "entity". You can
define it
in an external file and then "include" it. Here is an
example:

In "document.docbook":

<!DOCTYPE book PUBLIC  "-//OASIS//DTD DocBook V3.1//EN" [
  <!ENTITY % magic-entities SYSTEM "magic.ent">
  %magic-entities;  <!-- This is where we include it -->
]>
<book lang="en">
...
  <graphic fileref="flower.&jpeg-eps;"></graphic>
\x03  <!-- and here is where we use it -->
\x03...
  <graphic fileref="cactus.&gif-eps;"></graphic>
...
</book>

and in "magic.ent":

<!-- here we define it -->
<!ENTITY % html "IGNORE">
<![%html; [
        <!ENTITY % print "IGNORE">
        <!ENTITY gif-eps "gif">
        <!ENTITY jpg-eps "jpg">
        <!ENTITY jpeg-eps "jpeg">
]]>
<!ENTITY % print "INCLUDE">
<![%print; [
        <!ENTITY gif-eps "eps">
        <!ENTITY jpg-eps "eps">
        <!ENTITY jpeg-eps "eps">
]]>

You need to pass "-i html" or "-i print" to jade so the
right extension is chosen at processing time. The
docbook-tools wrapper scripts do this.

It is quite rough, but it works.

-- 
 Éric Bischoff   -   mailto:ebisch@cybercable.tm.fr
 __________________________________________________
                                           \^o~_.
     .~.                           ______  /( __ )
     /V\         Toys story         \__  \/  (  V
   //   \\                            \__| (__=v
  /(     )\                        |\___/     )
    ^^-^^                           \_____(  )
     Tux                        Konqui     \__=v
 __________________________________________________

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36           ` Jochem Huhmann
@ 2000-12-27  6:36             ` Eric Bischoff
  2000-12-27  6:36               ` Jochem Huhmann
  0 siblings, 1 reply; 24+ messages in thread
From: Eric Bischoff @ 2000-12-27  6:36 UTC (permalink / raw)
  To: egcs; +Cc: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2316 bytes --]

Jochem Huhmann wrote:

> I didn't meant it this way. The wrapping shell-backend knows the target
> format and therefore it should know which file-type for images is the
> best for this target format. So it could pass this format (as in "png",
> "eps", "gif", ...) in a variable to jade and make it available in the
> stylesheet.

The stylesheet themselves have easy ways of determining the
backend with no help of any shell script (Sam's very first
message even shows how to do it in DSSSL).

But what happens if some pictures are PNG, others GIF,
others JPEG ?

> The stylesheet has the blank filename (from the SGML source) and the
> needed extension (from that variable) of the image-file then. This leads
> me to the assumption that this should be enough to build the right
> file-name (name + extension) in the stylesheet.

Again, there's no need of such a variable to know the
backend.

> It wouldn't be enough to make sure that the file in the needed format
> really exists, yes. But if it exists this could work. I haven't got the
> time right now to dig through the stylesheets to see how this could be
> done in a driver file and I may well have missed something important,
> though.

To summarize :

We have files that may be GIF, JPEG, PNG, EPS, ... :
	flower.jpeg, cactus.gif, flower.eps, cactus.eps
We have a selected backend (tex, pdf, html, ...) :
	html
We have a filename from the docbook document :
	flower

What would be nice if the stylesheet could say :

"Well, this is html so I can accept JPG, JPEG, GIF, and PNG.
The filename is "flower" so I should try "flower.jpg",
"flower.jpeg", "flower.gif" and "flower.png". Hmmm, only
"flower.jpeg" exists : I'll take it."

But this would assume we would have a way to know from DSSSL
whether a file exists or not. Norm said it was impossible.

-- 
 Éric Bischoff   -   mailto:ebisch@cybercable.tm.fr
 __________________________________________________
                                           \^o~_.
     .~.                           ______  /( __ )
     /V\         Toys story         \__  \/  (  V
   //   \\                            \__| (__=v
  /(     )\                        |\___/     )
    ^^-^^                           \_____(  )
     Tux                        Konqui     \__=v
 __________________________________________________

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36       ` Sam Roberts
@ 2000-12-27  6:36         ` Norman Walsh
  2000-12-27  6:36           ` David C. Mason
  0 siblings, 1 reply; 24+ messages in thread
From: Norman Walsh @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Sam Roberts; +Cc: docbook-tools-discuss

/ "Sam Roberts" <sam@cogent.ca> was heard to say:
| From: Eric Bischoff <ebisch@cybercable.tm.fr>
| 
| > The stylesheets solution could perfectly work if there was a
| > way to easily detect which extension(s) do exist for this
| > file from DSSSL.
| 
| I'm not a dsssl hacker, but I'm surprised this isn't possible.

Alas, there's no function to test what files exist from within DSSSL.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com>      | The trip doesn't exist that can
http://nwalsh.com/                 | set you behond the reach of
                                   | cravings, fits of temper, or
                                   | fears. If it did, the human race
                                   | would be off there in a
                                   | body.--Seneca

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36                 ` Eric Bischoff
@ 2000-12-27  6:36                   ` Jochem Huhmann
  2000-12-27  6:36                     ` godoy
  0 siblings, 1 reply; 24+ messages in thread
From: Jochem Huhmann @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

* Eric Bischoff <ebisch@cybercable.tm.fr> wrote:
> Jochem Huhmann wrote:
> > Err, yes. That's right ;-) But from within a shell script you can
> > configure/request a specific file-format for a given output (as in
> > preferring PNG over GIF for HTML-output)
> 
> You can do this in the stylesheets as well, as Sam's code
> snippet shows it.

OK.

> > DSSSL isn't a system programming language, it is for stylesheets. If
> > this means that you have to have all images in one format, well, convert
> > them ;-)
> 
> ... or use my entities-based solution ;-).
> 
> I also know there's an "imagelib" functionality in Jade, but
> I don't know if this could address this problem.

The actual problem (as so often with this stuff) is to make it easy to
use from a documentation writers point of view. Actually we don't need
any tools, we do need jade and stylesheets and DTD's and a Makefile. 
Period.

Someone who just wants to write and convert docs needs simple, straight,
well-documented tools with a man-page. With some commandline options or
with a GUI and with simple configuration files, with reasonable defaults
in /etc and his own in $HOME to override this. We should try to keep
that in mind. Tell these people about entities and driver files and such
and they won't use that at all.


        Jochem

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36                         ` godoy
@ 2000-12-27  6:36                           ` Jochem Huhmann
  0 siblings, 0 replies; 24+ messages in thread
From: Jochem Huhmann @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

* godoy@conectiva.com.br wrote:
> 1. There's no perfect solution.
> 2. "Make a foul proof tool and only a foul would use it".
> 
> 
> These two sayings are very useful guidelines when developing something
> :-) 

3. "Make it as simple as possible, but not simpler".
4. "Keep it simple, stupid".
5. "Make simple things easy and complex things possible".

Sadly, following these guidelines is astonishingly hard sometimes ;-)


        Jochem

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36                     ` godoy
  2000-12-27  6:36                       ` Jochem Huhmann
@ 2000-12-27  6:36                       ` Eric Bischoff
  2000-12-27  6:36                         ` godoy
  1 sibling, 1 reply; 24+ messages in thread
From: Eric Bischoff @ 2000-12-27  6:36 UTC (permalink / raw)
  To: egcs; +Cc: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

godoy@conectiva.com.br wrote:
> 
> We work this way:
> 
> All pictures are in TIFF format (better quality)
> 
> When I choose "PS" backend, the script runs something similar to
> 
> for i in `ls directory/images/tiff/*.tiff` ; do
>     convert directory/images/tiff/$i directory/images/eps/`basename $i .tiff`.eps
> done

Yes, this is a very good solution too. It only has two small
drawback :
- it can be slow to convert all the pictures each time you
process the docbook
document. But this can be avoided through a test or using
the Makefile mechanism.
- it requires disciple from your authors ;-)

-- 
 Éric Bischoff   -   mailto:ebisch@cybercable.tm.fr
 __________________________________________________
                                           \^o~_.
     .~.                           ______  /( __ )
     /V\         Toys story         \__  \/  (  V
   //   \\                            \__| (__=v
  /(     )\                        |\___/     )
    ^^-^^                           \_____(  )
     Tux                        Konqui     \__=v
 __________________________________________________

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36                   ` Jochem Huhmann
@ 2000-12-27  6:36                     ` godoy
  2000-12-27  6:36                       ` Jochem Huhmann
  2000-12-27  6:36                       ` Eric Bischoff
  0 siblings, 2 replies; 24+ messages in thread
From: godoy @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Jochem Huhmann; +Cc: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2381 bytes --]

Jochem Huhmann <joh@gmx.net> writes:


> The actual problem (as so often with this stuff) is to make it easy to
> use from a documentation writers point of view. Actually we don't need
> any tools, we do need jade and stylesheets and DTD's and a Makefile. 
> Period.
> 
> Someone who just wants to write and convert docs needs simple, straight,
> well-documented tools with a man-page. With some commandline options or
> with a GUI and with simple configuration files, with reasonable defaults
> in /etc and his own in $HOME to override this. We should try to keep
> that in mind. Tell these people about entities and driver files and such
> and they won't use that at all.

We work this way:

1. Linux platform
2. DocBook and OpenJade or DocBook and other converter
3. All pictures are in TIFF format (better quality)
4. Emacs + PSGML as editor (choose whatever you want. This gave us the
   easiness we needed to have plus an automation on validation of the
   document --- and syntax highlighting)
5. NFS for stylesheet and some common scripts --- I'm changing this to
   be a package now...
6. ImageMagick package (because of the graphical conversion tools)
7. teTeX

Our makefile is called by a script in a command line that looks like
this:

$ compiles document format [stylesheet -- optional] [converter -- optional]

document is the SGML document, format is one of the supported output
formats of Jade/OpenJade (mif, html, jadetex, ...) or a combination of
them (PS, DVI, ASCII, ...). Stylesheet is an optional stylesheet to be
used and converter is used to choose between Jade and OpenJade, being
OpenJade the default.

When I choose "PS" backend, the script runs something similar to 

for i in `ls directory/images/tiff/*.tiff` ; do 
    convert directory/images/tiff/$i directory/images/eps/`basename $i .tiff`.eps
done

and then call the Makefile with the correct options (runs
collateindex, runs openjade, runs jadetex 3 times, runs dvips and
finally calls gv). 

Authors use the <mediaobject> option to insert figures (as I've sent
before on this list). 


We have no problems here (more than 20 people writing documents and books)...


PS:. We are in the process of changing some steps described, but this
     works perfectly.

Regards,
-- 
Godoy.	<godoy@conectiva.com.br> 

Departamento de Publicações
Publishing Department                   Conectiva S.A.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36 images in Docbook with Red Hat 6.2 Sam Roberts
@ 2000-12-27  6:36 ` Eric Bischoff
  2000-12-27  6:36   ` Diego Sevilla Ruiz (dsevilla@um.es)
  2000-12-27  6:36   ` Sam Roberts
  0 siblings, 2 replies; 24+ messages in thread
From: Eric Bischoff @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Sam Roberts; +Cc: Peter Toft, docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]

Sam Roberts wrote:
> 
> 
> (define (graphic-file filename)
>     (let ((ext (file-extension filename)))
>         (if (or tex-backend   ;; TeX can work this out itself
>             (not filename)
>             (not %graphic-default-extension%)
>             (member ext %graphic-extensions%))
>         filename
>         (string-append filename "." %graphic-default-extension%))))
> 

Such code trying to guess the graphic extension from within
the stylesheet is a good idea. Anyway, it will always face
the same problem : for publishing in HTML, for example, how
to decide whether to add JPEG, PNG or GIF ? It's not easy.

I'm currently using the following approach:

	<graphic fileref="foo.&gif-eps;">

stands for:
	"use foo.gif when making HTML files, foo.eps when printing
to TeX."

You can do create on the same model other entities like
&jpg-eps;. It's not perfect, but it's simple and works.

-- 
 Éric Bischoff   -   mailto:ebisch@cybercable.tm.fr
 __________________________________________________
                                           \^o~_.
     .~.                           ______  /( __ )
     /V\         Toys story         \__  \/  (  V
   //   \\                            \__| (__=v
  /(     )\                        |\___/     )
    ^^-^^                           \_____(  )
     Tux                        Konqui     \__=v
 __________________________________________________

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36     ` Eric Bischoff
  2000-12-27  6:36       ` David C. Mason
  2000-12-27  6:36       ` Sam Roberts
@ 2000-12-27  6:36       ` Jochem Huhmann
  2000-12-27  6:36         ` Eric Bischoff
  2 siblings, 1 reply; 24+ messages in thread
From: Jochem Huhmann @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

* Eric Bischoff <ebisch@cybercable.tm.fr> wrote:
> The stylesheets solution could perfectly work if there was a
> way to easily detect which extension(s) do exist for this
> file from DSSSL.

Could this be done by looking at this from the converting
(shell-)backend that builds the command-line for jade? It knows the
output format and could pass a variable to jade via "-V variable=value",
which is available in the stylesheet then (or isn't it?). Just a fuzzy
idea...


        Jochem

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36 ` Eric Bischoff
  2000-12-27  6:36   ` Diego Sevilla Ruiz (dsevilla@um.es)
@ 2000-12-27  6:36   ` Sam Roberts
  2000-12-27  6:36     ` Eric Bischoff
  1 sibling, 1 reply; 24+ messages in thread
From: Sam Roberts @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Eric Bischoff; +Cc: Peter Toft, docbook-tools-discuss

> Such code trying to guess the graphic extension from within
> the stylesheet is a good idea. Anyway, it will always face
> the same problem : for publishing in HTML, for example, how
> to decide whether to add JPEG, PNG or GIF ? It's not easy.

It's only hard if you use more than one image format per
output type. Otherwise Norman's stylesheets allow you to
trivially set the extension for that format. This fails only
in the tex output case, because tex is formatted into both
pdf and ps.

> I'm currently using the following approach:
> 
> <graphic fileref="foo.&gif-eps;">
> 
> stands for:
> "use foo.gif when making HTML files, foo.eps when printing
> to TeX."
> 
> You can do create on the same model other entities like
> &jpg-eps;. It's not perfect, but it's simple and works.

I assume we're talking the same thing here, and that you
use this technique only because you use BOTH gifs and
jpegs in the same document when it's formatted as html?

Sam
 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: images in Docbook with Red Hat 6.2
  2000-12-27  6:36         ` Norman Walsh
@ 2000-12-27  6:36           ` David C. Mason
  0 siblings, 0 replies; 24+ messages in thread
From: David C. Mason @ 2000-12-27  6:36 UTC (permalink / raw)
  To: Norman Walsh; +Cc: docbook-tools-discuss

Norman Walsh <ndw@nwalsh.com> writes:


> Alas, there's no function to test what files exist from within DSSSL.


Really - it seems like you could handle a 'per encounter' instance of
a file type with DSSSL - but then I haven't *really* thought about
it until now...

Dave

-- 

          David Mason
        Red Hat AD Labs

        dcm@redhat.com
  http://people.redhat.com/dcm

^ permalink raw reply	[flat|nested] 24+ messages in thread

* images in Docbook with Red Hat 6.2
@ 2000-12-27  6:36 Peter Toft
  0 siblings, 0 replies; 24+ messages in thread
From: Peter Toft @ 2000-12-27  6:36 UTC (permalink / raw)
  To: docbook-tools-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

Using Docbook with Red Hat 6.2 I have a hard time
generating the PDF file with images (HTML is working
fine). I have xterm.gif and xterm.eps available and my
simplified source is shown below (The real source gives
350 pages of text)

db2pdf complains

-------->
! LaTeX Error: Unknown graphics extension: .eps.

See the LaTeX manual or LaTeX Companion for
explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.753 {0}}

\endNode{}\endNode{}\endSeq{}\endPar{}\endNode{}\endSeq{}\endDispl...
<--------

Any clues - I am very stuck here....
I am using 
tetex-1.0.6-11
jade-1.2.1-9
jadetex-2.7-2

-----------------
My sgml-source:

<!doctype book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
]>

<book id="index" lang="da">
  <bookinfo>
    <date>9. april 2000</date>
    <title>aargh</title>
    <AUTHORGROUP>

    <AUTHOR>
      <FIRSTNAME>Peter</FIRSTNAME>
      <SURNAME>Toft</SURNAME>
    </AUTHOR>

    </AUTHORGROUP>
    <COPYRIGHT>
      <YEAR>1998</YEAR>
      <HOLDER>Toft/HOLDER>
    </COPYRIGHT>
  </bookinfo>



<chapter id="intro">
<title>Linux?</title>

<sect1 id="OpenSource">
<title>Ã…ben kildetekst - Open Source</title>

<FIGURE ID="xterm" FLOAT="1">
<TITLE>xterm
</TITLE>
<GRAPHIC
FILEREF="xterm"  SCALE="60"></GRAPHIC>
</FIGURE>
</sect1>
</chapter>
</book>


Peter Toft, Ph.D. [pto@sslug.dk] http://www.sslug.dk/~pto

... when men were men and wrote their own device driver ...
                    --- Linus Benedict Torvalds



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2000-12-27  6:36 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-27  6:36 images in Docbook with Red Hat 6.2 Sam Roberts
2000-12-27  6:36 ` Eric Bischoff
2000-12-27  6:36   ` Diego Sevilla Ruiz (dsevilla@um.es)
2000-12-27  6:36     ` Eric Bischoff
2000-12-27  6:36     ` Sam Roberts
2000-12-27  6:36   ` Sam Roberts
2000-12-27  6:36     ` Eric Bischoff
2000-12-27  6:36       ` David C. Mason
2000-12-27  6:36       ` Sam Roberts
2000-12-27  6:36         ` Norman Walsh
2000-12-27  6:36           ` David C. Mason
2000-12-27  6:36       ` Jochem Huhmann
2000-12-27  6:36         ` Eric Bischoff
2000-12-27  6:36           ` Jochem Huhmann
2000-12-27  6:36             ` Eric Bischoff
2000-12-27  6:36               ` Jochem Huhmann
2000-12-27  6:36                 ` Eric Bischoff
2000-12-27  6:36                   ` Jochem Huhmann
2000-12-27  6:36                     ` godoy
2000-12-27  6:36                       ` Jochem Huhmann
2000-12-27  6:36                       ` Eric Bischoff
2000-12-27  6:36                         ` godoy
2000-12-27  6:36                           ` Jochem Huhmann
  -- strict thread matches above, loose matches on Subject: below --
2000-12-27  6:36 Peter Toft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).