groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Handling without colors for .URL and .MTO in www.tmac


From: Gaius Mulley
Subject: Re: [Groff] Handling without colors for .URL and .MTO in www.tmac
Date: 12 Jan 2006 15:51:30 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4


A long time ago Keith Marshall <address@hidden> wrote:

> On Monday 08 August 2005 7:56 pm, Jörgen Grahn wrote:
> > On Mon Aug  8 18:59:32 2005, address@hidden wrote:
> > > .URL and .MTO use the color blue.  But if colors are not active they
> > > print in the normal font.  This is not impressive.
> > >
> > > The appended patch uses the bold font instead of blue.
> >
> > I must admit that I've never used www.tmac, but it seems to me to be
> > desirable that the non-HTML output can be customized by the macro user.
> 
> I tend to agree with Jörgen on this -- the user shouldn't be forced to accept 
> blue, or any other colour, or any specific font either;  IMO, he should have 
> the option to declare his own choice, through some appropriate register or 
> string.  For example, in `pdfmark', which also supports active URLs, I have 
> provided the PDFHREF.COLOUR string, (or PDFHREF.COLOR if you prefer), 
> specified as an RGB triplet, which the user may customise to suit his own 
> personal preference.
> 
> > For example, I don't like the blue color, but I also don't like Courier for
> > the URL itself-- I prefer to typeset URLs in italics so they don't break up
> > the surrounding text too much.
> 
> Hmm.  Again considering the `pdfmark' analogy, I didn't think of any such 
> option for PDF links or URLs.  The effect could be achieved by embedding font 
> change escapes in the optional prefix and suffix strings specified in the 
> `.pdfhref' call, but would you like to see something like a PDFHREF.FONT 
> control for it?
> 
> > I like the <>-like glyphs surrounding the URL, though.
> 
> Like Jörgen, I've not really explored www.tmac either.  Are these hard coded? 
> Some users may not like them, so would it not be better if they were 
> optional?  Something along the lines of the `-P prefix' and `-A suffix' 
> options to `.pdfhref' perhaps?  (These BTW, could be used to achieve the same 
> effect for a URL in a PDF document, e.g.
> 
>     .pdfhref W -P < -A > "http://groff.ffii.org";
> 
> would print `<http://groff.ffii.org>', with the angle brackets in the regular 
> text colour, and the interposed link in the PDFHREF.COLOUR).

Hi all,

here is a proposed patch which allows the user to specify colour, font
style, open and close glyph when using devices other than HTML with
www.tmac.

I was wondering whether this meets with approval before I commit it?

Gaius



--- groff-cvs/tmac/www.tmac     2006-01-03 23:57:03.000000000 +0000
+++ groff-html/tmac/www.tmac    2006-01-12 09:40:46.984127935 +0000
@@ -358,23 +358,23 @@
 .      \}
 .      el \{\
 .        ie \\n[.color] \
-.          nop \%\[la]\m[blue]\f[C]\\*[\\$0:adr]\f[]\m[]\[ra]\\$3
+.          nop 
\%\\*[www:open]\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\m[]\\*[www:close]\\$3
 .        el \
-.          nop \%\[la]\f[CB]\\*[\\$0:adr]\f[]\[ra]\\$3
+.          nop 
\%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
 .      \}
 .    \}
 .    el \{\
 .      ie '\\$1'' \{\
 .        ie \\n[.color] \
-.          nop \m[blue]\\$2\m[]\\$3
+.          nop \m[\\*[www:color]]\\$2\m[]\\$3
 .        el \
-.          nop \f[B]\\$2\f[]\\$3
+.          nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
 .      \}
 .      el \{\
 .        ie \\n[.color] \
-.          nop \m[blue]\\$2\m[] \%\[la]\f[C]\\*[\\$0:adr]\f[]\[ra]\\$3
+.          nop \m[\\*[www:color]]\\$2\m[] 
\%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
 .        el \
-.          nop \f[B]\\$2\f[] \%\[la]\f[C]\\*[\\$0:adr]\f[]\[ra]\\$3
+.          nop \f[\\*[www:fontstyle]]\\$2\f[] 
\%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
 .      \}
 .    \}
 .    if !r ps4html .ad
@@ -420,23 +420,23 @@
 .      \}
 .      el \{\
 .        ie \\n[.color] \
-.          nop \%\m[blue]\f[C]\\$1\f[]\m[]\\$3
+.          nop \%\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\$1\f[]\m[]\\$3
 .        el \
-.          nop \%\f[CB]\\$1\f[]\\$3
+.          nop \%\f[\\*[www:fontstyle]]\\$1\f[]\\$3
 .      \}
 .    \}
 .    el \{\
 .      ie '\\$1'' \{\
 .        ie \\n[.color] \
-.          nop \m[blue]\\$2\m[]\\$3
+.          nop \m[\\*[www:color]]\\$2\m[]\\$3
 .        el \
-.          nop \f[B]\\$2\f[]\\$3
+.          nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
 .      \}
 .      el \{\
 .        ie \\n[.color] \
-.          nop \m[blue]\\$2\m[] \%\[la]\f[C]\\$1\f[]\[ra]\\$3
+.          nop \m[\\*[www:color]]\\$2\m[] 
\%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
 .        el
-.          nop \f[B]\\$2\f[] \%\[la]\f[C]\\$1\f[]\[ra]\\$3
+.          nop \f[\\*[www:fontstyle]]\\$2\f[] 
\%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
 .      \}
 .    \}
 .  \}
@@ -480,7 +480,7 @@
            width=\\n[www-width] height=\\n[www-height]>
 .  \}
 .  el \
-.    nop \[la]\f[C]\\$1\f[]\[ra]
+.    nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]
 ..
 .
 .\" --------------------------------------------------------------------
@@ -1324,11 +1324,35 @@
 .  \}
 ..
 .
+.\" --------------------------------------------------------------------
+.\"  www:init color [ fontstyle [ openglyph closeglyph ] ]
+.\"
+.\"    Initializes www.tmac so that when this macro set is used with
+.\"    non html devices the urls are rendered the user defined attributes.
+.\"    For example:
+.\"
+.\"    www:init blue CR < >
+.\"
+.de www:init
+.  if (\\n[.$] < 1) \
+.    www:error .\\$0 expects at least 1 argument.
+.  ds www:color \\$1
+.  shift
+.  if (\\n[.$] < 1) return
+.  ds www:fontstyle \\$1
+.  shift
+.  if (\\n[.$] < 1) \
+.    www:error .\\$0 expects that both the open and close glyph is specified
+.  ds www:open \\$1
+.  ds www:close \\$2
+..
 .
 .\" --------------------------------------------------------------------
 .\" Final Setup
 .\" --------------------------------------------------------------------
 .
+.www:init blue C \[la] \[ra]
+.
 .if \n[www-html] \{\
 .  nh
 .  nr HY 0
--- groff-cvs/tmac/groff_www.man        2006-01-03 23:57:03.000000000 +0000
+++ groff-html/tmac/groff_www.man       2006-01-12 09:51:09.691706826 +0000
@@ -102,6 +102,7 @@
 \&.LNS start a new two-column
        table with links in the left.
 \&.LNE end the two-column table.
+\&.init:www    initialize default styles.
 .fi
 .PP
 Output of the
@@ -512,6 +513,20 @@
 End a two-column table.
 This should be called at the end of the document if .ALN was used.
 .
+.TP
+.B ".init:www color [ fontstyle [ openglyph closeglyph ] ]"
+Initialize default styles to be used when this macro set is not used
+with the HTML device.
+The macro set initializes itself with the following call
+.RS
+.IP
+.nf
+.ft B
+\&.www:init blue C \e[la] \e[ra]
+.ft P
+.fi
+.RE
+but these values will be superseded by a user call to www:init.
 .
 .SH SECTION HEADING LINKS
 By default




reply via email to

[Prev in Thread] Current Thread [Next in Thread]