1# bdefinitions.perl
2#    by Philippe Chauvat <philippe@chauvat.eu>
3# This file is designed to support the builing of Bacula (http://www.bacula.org) and/or
4# Bacula Enterprise Edition (http://www.baculasystems.com) manuals.
5# Support of the bdefinitions.sty Bacula package
6# ======================================================================
7# Does not require any package => do_require_package('') ;
8
9
10
11# Package Options
12#No package options
13#sub do_bdefinitions_option {}
14
15# ======================================================================
16sub bnext_arg { # Modifies $_
17    #
18    # This is a whole duplicate of the x_next_arg function
19    # defined in the graphics-support.perl file.
20    # I renamed it to be:
21    # a) consistent with the other definitions
22    # b) be sure there will be no conflict with anything else.
23    my $arg;
24    &missing_braces unless ((s/$next_pair_pr_rx/$arg=$2;''/e)
25			    ||(s/$next_pair_rx/$arg=$2;''/e));
26    $arg;
27}
28
29sub do_cmd_bfilename {
30    local($_)=@_;
31    my $file = bnext_arg();
32    &styled_text_chunk('SPAN','CLASS="bfilename"','','','','',@_) ;
33}
34sub do_cmd_btable {
35    local($_)=@_;
36    my $file = bnext_arg();
37    &styled_text_chunk('SPAN','CLASS="btable"','','','','',@_) ;
38}
39
40sub do_cmd_bdirectoryname {
41    local($_)=@_;
42    my $file = bnext_arg();
43    &styled_text_chunk('SPAN','CLASS="bdirectoryname"','','','','',@_) ;
44}
45
46sub do_cmd_bdirectory {
47    local($_)=@_;
48    my $file = bnext_arg() ;
49     &styled_text_chunk('','','','','','bdirectory',@_) ;
50}
51sub bdirectory {
52    local($btext)= @_ ;
53    join('','<span class="bdirectoryname">', $btext, '</span> directory') ;
54}
55
56sub do_cmd_bdirectivename {
57    local($_)=@_;
58    my $file = bnext_arg();
59    &styled_text_chunk('SPAN','CLASS="bdirectivename"','','','','',@_) ;
60}
61
62sub do_cmd_bdirective {
63    local($_)=@_;
64    my $file = bnext_arg() ;
65    &styled_text_chunk('','','','','','bdirective',@_) ;
66}
67sub bdirective {
68    local($btext)= @_ ;
69    join('','<span class="bdirectivename">',$btext, '</span> directive') ;
70}
71
72sub bresourcename {
73    local($mybresource) = @_ ;
74    join('','<span class="bresourcename">',$mybresource,'</span>') ;
75}
76
77sub bcommandname {
78    local($mybcommand) = @_ ;
79    join('','<span class="bcommandname">',$mybcommand,'</span>') ;
80}
81sub do_cmd_bPool {
82    join('','<span class="bresourcename">','Pool','</span>',$_[0]) ;
83}
84sub do_cmd_bConsole {
85    join('','<span class="bresourcename">','Console','</span>',$_[0]) ;
86}
87sub do_cmd_bCatalog {
88    join('','<span class="bresourcename">','Catalog','</span>',$_[0]) ;
89}
90sub do_cmd_bJob     {
91    join('','<span class="bresourcename">','Job','</span>',$_[0]) ;
92}
93sub do_cmd_bVolume  {
94    join('','<span class="bresourcename">','Volume','</span>',$_[0]) ;
95}
96sub do_cmd_bFileSet {
97    join('','<span class="bresourcename">','FileSet','</span>',$_[0]) ;
98}
99sub do_cmd_bStorage {
100    join('','<span class="bresourcename">','Storage','</span>',$_[0]) ;
101}
102sub do_cmd_bJobId {
103    join('','<span class="bresourcename">','JobId','</span>',$_[0]) ;
104}
105sub do_cmd_bClient {
106    join('','<span class="bresourcename">','Client','</span>',$_[0]) ;
107}
108sub do_cmd_bDirector {
109    join('','<span class="bdaemon">','Director','</span>',$_[0]) ;
110}
111sub do_cmd_bconsolename {
112    join('','<span class="btool">','bconsole','</span>',$_[0]) ;
113}
114sub do_cmd_bconsole {
115    join('',bbacula(),'<span class="bcommandname">',' ','Console','</span>',$_[0]) ;
116}
117sub do_cmd_bstructure {
118    local($_)=@_;
119    my $mybstructure = bnext_arg() ;
120    &styled_text_chunk('','','','','','bstructure',@_) ;
121}
122sub bstructure {
123    local($btext)= @_ ;
124    join('','<span class="bstructurename">',$btext,'</span> structure') ;
125}
126sub do_cmd_bstructurename {
127    local($_)=@_;
128    my $file = bnext_arg();
129    &styled_text_chunk('SPAN','CLASS="bstructurename"','','','','',@_) ;
130}
131sub do_cmd_bresourcename {
132    local($_)=@_;
133    my $file = bnext_arg();
134    &styled_text_chunk('SPAN','CLASS="bresourcename"','','','','',@_) ;
135}
136sub do_cmd_bresource {
137    local($_)=@_;
138    my $file = bnext_arg() ;
139    &styled_text_chunk('','','','','','bresource',@_) ;
140}
141sub bresource {
142    local($btext)= @_ ;
143    join('',bresourcename($btext),' resource') ;
144}
145sub bresources {
146    local($btext)= @_ ;
147    join('',bresourcename($btext),' resources') ;
148}
149sub do_cmd_bresources {
150    local($_)=@_;
151    my $file = bnext_arg() ;
152    &styled_text_chunk('','','','','','bresources',@_) ;
153}
154sub bresourceq {
155    local($btext)= @_ ;
156    join('',bresourcename(join('',$btext,"'s")),' resource') ;
157}
158sub do_cmd_bresourceq {
159    local($_)=@_;
160    my $file = bnext_arg() ;
161    &styled_text_chunk('','','','','','bresourceq',@_) ;
162}
163sub do_cmd_bcommandname {
164    local($_)=@_;
165    my $file = bnext_arg();
166    &styled_text_chunk('SPAN','CLASS="bcommandname"','','','','',@_) ;
167}
168sub bcommand {
169    local($btext)= @_ ;
170    join('',eval("&bcommandname(\$btext)"),' command') ;
171}
172sub do_cmd_bcommand {
173    local($_)=@_;
174    my $file = bnext_arg() ;
175    &styled_text_chunk('','','','','','bcommand',@_) ;
176}
177sub do_cmd_btool {
178    local($_)=@_;
179    my $tool = bnext_arg() ;
180    &styled_text_chunk('SPAN','CLASS="btool"','','','','',@_) ;
181}
182sub bbracket {
183    local($btext)= @_ ;
184    join('','<span class="bbracket">&lt;',$btext,'&gt;</span>') ;
185}
186sub do_cmd_bbracket {
187    local($_)=@_;
188    my $bracket = bnext_arg() ;
189    &styled_text_chunk('','','','','','bbracket',@_) ;
190}
191
192sub do_cmd_bvalue {
193    local($_)=@_;
194    my $value = bnext_arg();
195    &styled_text_chunk('SPAN','CLASS="bvalue"','','','','',@_) ;
196}
197sub do_cmd_bhighlight {
198    local($_)=@_;
199    my $value = bnext_arg();
200    &styled_text_chunk('SPAN','CLASS="bhighlight"','','','','',@_) ;
201}
202sub do_cmd_bkeyword {
203    local($_)=@_;
204    my $value = bnext_arg();
205    #
206    # The following is *not* a mistake. It is defined into the bdefinitions.sty file
207    # If you want to handle it differently please do.
208    # could be     &styled_text_chunk('SPAN','CLASS="bkeyword"','','','','',@_) ;
209    &styled_text_chunk('SPAN','CLASS="bvalue"','','','','',@_) ;
210}
211sub do_cmd_bdefaultvalue {
212    local($_)=@_;
213    my $value = bnext_arg();
214    &styled_text_chunk('SPAN','CLASS="bdefaultvalue"','','','','',@_) ;
215}
216sub bbacula {
217    local($_)=@_;
218    join('','<span class="bbacula">','Bacula','</span>') ;
219}
220sub do_cmd_bacula {
221    local($_)=@_;
222    my $bbacula = bnext_arg();
223    &styled_text_chunk('','','','','','bbacula',@_) ;
224}
225sub do_cmd_baculasystems{
226    join('','<a class="baculasystems" href="http://www.baculasystems.com">','Bacula Systems','</a>',$_[0]);
227}
228sub do_cmd_bweb{
229    join('','<span class="bweb">BWeb</span>',$_[0]);
230}
231sub do_cmd_mssql{
232    join('','<span class="bsqltool">MSSQL</span>',$_[0]);
233}
234sub do_cmd_postgresql {
235    join('','<span class="bsqltool">PostgreSQL</span>',$_[0]);
236}
237sub do_cmd_mysql {
238    join('','<span class="bsqltool">MySQL</span>',$_[0]);
239}
240sub do_cmd_sqlite {
241    join('','<span class="bsqltool">SQLite</span>',$_[0]);
242}
243
244sub do_cmd_bnextpage {
245    # We don't do nothing with it..
246}
247sub do_cmd_byesorno {
248    join('','<span class="byesorno">&lt;yes|no&gt;</span>',$_[0]);
249}
250sub do_cmd_gt {
251    join('',"&gt;",$_[0]);
252}
253sub do_cmd_lt {
254    join('',"&lt;",$_[0]);
255}
256#
257# Manual names
258sub buildmanualname {
259    local($mymanual) = @_ ;
260    my $bacula = bbacula() ;
261    my $bedition = &do_cmd_beditionname() ;
262    join('','<span class="bmanualname">',$bacula,' ',$bedition,' ',$mymanual,'</span>');
263}
264sub do_cmd_bmainman {
265    $mybuild = buildmanualname("Main manual") ;
266    join('',$mybuild,$_[0]);
267}
268sub do_cmd_bconsoleman {
269    $mybuild = buildmanualname("Console manual") ;
270    join('',$mybuild,$_[0]);
271}
272sub do_cmd_bdevelman {
273    $mybuild = buildmanualname("Developer's manual") ;
274    join('',$mybuild,$_[0]);
275}
276sub do_cmd_butilityman {
277    $mybuild = buildmanualname("Utility Programs manual") ;
278    join('',$mybuild,$_[0]);
279}
280#
281#sub do_cmd_bproblemsman {
282#    &do_cmd_bproblemman() ;
283#}
284sub do_cmd_bproblemman {
285    $mybuild = buildmanualname("Problems Resolution guide") ;
286    join('',$mybuild,$_[0]);
287}
288sub do_cmd_bmiscman {
289    $mybuild = buildmanualname("Miscellaneous guide") ;
290    join('',$mybuild,$_[0]);
291}
292
293sub do_cmd_bregistered {
294    join('',"&reg;",$_[0]);
295}
296sub do_cmd_bstar {
297    join('',"&starf;",$_[0]);
298}
299sub do_cmd_vb {
300    join('',"&#124;",$_[0]);
301}
302sub do_cmd_url {
303    local($_) = @_ ;
304    print "PCT: do_cmd_url: $_\n" if ($VERBOSITY > 20) ;
305}
306sub do_cmd_bcopyright {
307    join('',"&copy;",$_[0]);
308}
309sub do_cmd_byear {
310    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) ;
311    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
312    $year += 1900 ;
313    join('',$year,$_[0]);
314}
315sub do_cmd_btitlelogo {
316    join('',
317	 # Logo and documentation title
318	 '<div class="bsys_topclass" id="bsys_topid">',
319	 '<img alt="BaculaSystems Logo" id="bsys_logo" src="blogo-header.png" />',
320	 '<img alt="BaculaSystems Documentation text" id="bsys_doctitle" src="btitle-header.png" />',
321	 '</div>',
322	 # Breadcrumbs and search field
323	 '<div class="bsys_breadnsearchclass" id="bsys_breadnsearchid">',
324	 '<div class="bsys_searchclass" id="bsys_searchid">',
325	 '<span class="bsys_searchtitleclass" id="bsys_searchtitleid">Search</span>',
326	 '<input class="bsys_searchfieldclass" id="bsys_searchfieldid" type="text" value="Type your text here" />',
327	 '</div>',
328	 '<div class="bsys_breadcrumbsclass" id="bsys_breadcrumbsid">',
329	 '<p class="bsys_breadcrumbscontentclass" id="bsys_breadcrumbscontentid">Main</p>',
330	 '</div>',
331	 '</div>',
332	 $_[0]) ;
333}
334
335sub do_cmd_bru{
336    join('','<span class="btool">bru</span>',$_[0]) ;
337}
338
339sub do_cmd_bdump {
340    join('','<span class="btool">dump</span>',$_[0]) ;
341}
342sub do_cmd_tar {
343    join('','<span class="btool">tar</span>',$_[0]) ;
344}
345
346sub do_cmd_mtx {
347    join('','<span class="btool">mtx</span>',$_[0]) ;
348}
349
350sub do_cmd_mtxchanger {
351    join('','<span class="btool">mtx-changer</span>',$_[0]) ;
352}
353
354sub do_cmd_bat {
355    join('',&bacs('BAT'),$_[0]) ;
356}
357#
358# Acronyms
359sub bacs {
360    local($bkey)=@_ ;
361    print "PCT: bacs: key: >$bkey< @_\n" if ($VERBOSITY > 20) ;
362    join('','<a class="bacronyms" href="Acronyms.html#', eval("&make_acronym_id(\$bkey)"),'">',$bkey,"</a>") ;
363}
364sub do_cmd_acs {
365    local($_)=@_;
366    &styled_text_chunk('','','','','','bacs',$_[0]) ;
367}
368sub bacsp {
369    local($bkey) = @_ ;
370    join('','<a class="bacronyms" href="Acronyms.html#',eval("&make_acronym_id($bkey)"),'">',$bkey,'s</a>',$_[0]) ;
371}
372sub do_cmd_acsp {
373    local($_)=@_;
374    my $bkey = bnext_arg();
375    &styled_text_chunk('','','','','','bacsp',$_[0]) ;
376}
377sub bac {
378    local($bkey)=@_;
379    my $bvalue = $bkey ;
380    if ($bacronyms{$bkey}{'displayed'} == 0) {
381	print "PCT: bac: never displayed: $bkey\n" if ($VERBOSITY > 10) ;
382	$bacronyms{$bkey}{'displayed'} = 1 ;
383	$bvalue = join('',$bacronyms{$bkey}{'value'},' (',$bkey,')') ;
384    }
385    join('','<a class="bacronyms" href="Acronyms.html#', eval("&make_acronym_id(\$bkey)"), '">', $bvalue, '</a>') ;
386}
387sub do_cmd_ac {
388    local($_)=@_;
389    my $bkey = bnext_arg();
390    &styled_text_chunk('','','','','','bac',@_) ;
391}
392sub bacp {
393    local($bkey)=@_;
394    my $bvalue = join('',$bkey,'s') ;
395    if ($bacronyms{$bkey}{'displayed'} == 0) {
396	print "PCT: do_cmd_acp: never displayed: $bkey\n" if ($VERBOSITY > 10) ;
397	$bacronyms{$bkey}{'displayed'} = 1 ;
398	$bvalue = join('',$bacronyms{$bkey}{'value'},'s (', $bkey,'s)') ;
399    }
400    join('','<a class="bacronyms" href="Acronyms.html#',eval("&make_acronym_id(\$bkey)"),'">', $bvalue, '</a>') ;
401}
402sub do_cmd_acp {
403    local($_)=@_;
404    &styled_text_chunk('','','','','','bacp',@_) ;
405}
406
407sub bacl {
408    local($bkey)=@_;
409    print "PCT: do_cmd_acl: key: $bkey\n" if ($VERBOSITY > 5) ;
410    my $bvalue = $bacronyms{$bkey}{'value'} ;
411    print "PCT: do_cmd_acl: val: $bvalue\n" if ($VERBOSITY > 5) ;
412    join('','<a class="bacronyms" href="Acronyms.html#', eval("&make_acronym_id(\$bkey)"), '">', $bvalue, '</a>') ;
413}
414sub do_cmd_acl {
415    local($_)=@_;
416    my $bkey = bnext_arg();
417    &styled_text_chunk('','','','','','bacl',@_) ;
418}
419
420sub baclp {
421    local($bkey)=@_;
422    my $bvalue = $bacronyms{$bkey}{'value'} ;
423    join('','<a class="bacronyms" href="Acronyms.html#', eval("&make_acronym_id(\$bkey)"),'">',$bvalue,'s</a>') ;
424}
425sub do_cmd_aclp {
426    local($_)=@_;
427    &styled_text_chunk('','','','','','baclp',@_) ;
428}
429sub make_acronym_id {
430    local($bkey) = @_ ;
431    $bacronyms{$bkey}{'seen'} = 1 ;
432    print "PCT: make_acronym_id: $bkey seen\n" if ($VERBOSITY > 10) ;
433    join('','bacronyms_',lc($bkey)) ;
434}
435#
436# Images
437sub bcompute_image {
438    local($bclass,$bfilename,$blabel,$bcaption,$bsize) = @_ ;
439    join('','<div class="',$bclass,'">',
440	 '</br>',
441	 '<a name="',$blabel,'">','<span class="',$bclass,'">',$bcaption,'</span>','</a>',
442	 '</br>',
443	 '<img class="',$bclass,'" src="',$bfilename,'" ',$bsize,'>',
444	 '<br/>',
445	 '</div>',$_) ;
446}
447# Horizontal image
448sub do_cmd_bimageH {
449    local($_) = @_ ;
450    # bimageH[an optional width]{image_filename}{caption to display}{label to use}
451    print "do_cmd_bimageH: $_\n" if ($VERBOSITY > 20) ;
452    local($bwidth,$bfilename,$bcaption,$blabel) ;
453    $bwidth = &get_next_optional_argument() ;
454    $bfilename = join('','../../images/',&bnext_arg(),'.png') ;
455    $bcaption = &bnext_arg() ;
456    $blabel = &bnext_arg() ;
457    print "do_cmd_bimageH: Width = $bwidth\tFile = $bfilename\tCaption = $bcaption\tLabel = $blabel\n" if ($VERBOSITY > 100) ;
458    if ($bwidth ne "") {
459	print "do_cmd_bimageH: bwidth: $bwidth\n" if ($VERBOSITY > 200) ;
460	if ($bwidth =~ /(.*)\\linewidth/) {
461	    $bwidth = $1 * 100 ;
462	    $bwidth = join('','style="width: ',$bwidth,'%') ;
463	}
464    }
465    print "do_cmd_bimageH: bwidth: $bwidth\n" if ($VERBOSITY > 10) ;
466    &bcompute_image("bimageH",$bfilename,$blabel,$bcaption,$bwidth) ;
467}
468#
469# Images with no orientation
470sub do_cmd_bimageN {
471    local($_) = @_ ;
472    # bimageN[an optional width]{image_filename}{caption to display}{label to use}
473    print "do_cmd_bimageN: $_\n" if ($VERBOSITY > 20) ;
474    local($bwidth,$bfilename,$bcaption,$blabel) ;
475    $bwidth = &get_next_optional_argument() ;
476    $bfilename = join('','../../images/',&bnext_arg(),'.png') ;
477    $bcaption = &bnext_arg() ;
478    $blabel = &bnext_arg() ;
479    print "do_cmd_bimageN: Width = $bwidth\tFile = $bfilename\tCaption = $bcaption\tLabel = $blabel\n" if ($VERBOSITY > 10) ;
480    if ($bwidth ne "") {
481	print "do_cmd_bimageN: bwidth: $bwidth\n" if ($VERBOSITY > 10) ;
482	if ($bwidth =~ /(.*)\\linewidth/) {
483	    $bwidth = join('','style="width: ',$1 * 100,'%;"') ;
484	}
485    }
486    print "do_cmd_bimageN: bwidth: $bwidth\n" if ($VERBOSITY > 10) ;
487    &bcompute_image("bimageN",$bfilename,$blabel,$bcaption,$bwidth) ;
488}
489
490#
491# Images with no orientation
492sub do_cmd_bimageV {
493    local($_) = @_ ;
494    # bimageV[an optional height]{image_filename}{caption to display}{label to use}
495    print "do_cmd_bimageV: $_\n" if ($VERBOSITY > 20) ;
496    local($bheight,$bfilename,$bcaption,$blabel) ;
497    $bheight = &get_next_optional_argument() ;
498    $bfilename = join('','../../images/',&bnext_arg(),'.png') ;
499    $bcaption = &bnext_arg() ;
500    $blabel = &bnext_arg() ;
501    print "do_cmd_bimageV: Height = $bheight\tFile = $bfilename\tCaption = $bcaption\tLabel = $blabel\n" if ($VERBOSITY > 10) ;
502    #
503    # As we are in HTML, we can not calculate anything based on "linewidth". So either an absolute dimension is specified
504    # and everything is fine
505    # or no dimension or a relative dimension is provided and we are in trouble => no width no height.
506    if ($bheight ne "" and $bheight !~ /\\/) {
507	$bheight = join('','style: "height: ',$bheight,';"') ;
508    }
509    else {
510	$bheight = "" ;
511    }
512    print "do_cmd_bimageV: bheight: $bheight\n" if ($VERBOSITY > 10) ;
513    &bcompute_image("bimageV",$bfilename,$blabel,$bcaption,$bheight) ;
514}
515
516sub do_cmd_textcolor {
517    local($_) = @_ ;
518    my $bcolor = &bnext_arg() ;
519    my $btext = &bnext_arg() ;
520    print "PCT: do_cmd_textcolor: color: $bcolor - text: $btext\n" if ($VERBOSITY > 10) ;
521    join('',$btext,$_) ;
522}
523
524sub do_cmd_vref {
525    local($_) = @_ ;
526    #
527    # The only arg is the label name
528    my $blabel=&bnext_arg() ;
529    print "PCT: do_cmd_vref: label: $blabel\n" if ($VERBOSITY > 10) ;
530    if (my $bfilename = $ref_files{$blabel}) {
531	if ($bfilename ne $CURRENT_FILE) {
532	    $burl = join('',$bfilename,'#',$blabel) ;
533	}
534	else {
535	    $burl = join('','#',$blabel) ;
536	}
537    }
538    join('','(<a class="bref" href="',$burl,'" alt="',$captions{$blabel},'" >here</a>)',$_) ;
539}
540
541sub do_cmd_bref {
542    local($_) = @_ ;
543    my $burl = &bnext_arg();
544    my $btext=&bnext_arg() ;
545    print "\nPCT: do_cmd_bref: text: $btext - url: $burl\n" if ($VERBOSITY > 2) ;
546    if ($burl !~ /http(s?):/) {
547	if (my $bfilename = $ref_files{$burl}) {
548	    if ($bfilename ne $CURRENT_FILE) {
549		$burl = join('',$bfilename,'#',$burl) ;
550	    }
551	    else {
552		$burl = join('','#',$burl) ;
553	    }
554	}
555    }
556    join('','<a class="bref" href="',$burl,'">',$btext,'</a>',$_) ;
557}
558
559sub do_cmd_bfootref {
560    local($_) = @_ ;
561    &do_cmd_bref($_) ;
562}
563
564sub do_cmd_textrightarrow {
565    join('',"&#8594;",$_[0]);
566}
567
568sub do_cmd_bilink {
569     local($_) = @_;
570     local($text);
571     local($opt, $dummy) = &get_next_optional_argument;
572     $text = &missing_braces unless
573 	((s/$next_pair_pr_rx/$text = $2; ''/eo)
574	 ||(s/$next_pair_rx/$text = $2; ''/eo));
575     print "PCT: bilink: text: $text --- opt: $opt --- dummy: $dummy\n" if ($VERBOSITY > 2) ;
576     &bprocess_ref($cross_ref_mark,$cross_ref_mark,"bilink",$text);
577}
578sub do_cmd_bxdlink {
579    # \bxdlink}[4]{\href{../#3/#3}{\textbf{#1}} (#4 \vref{#3-#2})}
580    # Format is bxdlink{Mail Command in the Messages Resource}{blb:mailcommand}{main}{chapter}
581    local($_) = @_ ;
582    local($btext,$blabel,$bmanual,$bwhat,$text) ;
583    $btext = &bnext_arg() ;
584    $blabel = &bnext_arg() ;
585    $bmanual = &bnext_arg() ;
586    $bwhat = &bnext_arg() ;
587    #
588    # There is only one case we know where we are
589    my $blinkedfile = "__TO_BE_REPLACED_WITH_HTML_FILENAME__" ;
590    if ($bmanual eq $FILE) {
591	$blinkedfile = $CURRENT_FILE ;
592    }
593    join('','<a class="bxdlink" href="../',$bmanual,'/',$blinkedfile,'#',$blabel,'">',$btext,'</a>',$_) ;
594}
595
596
597
598sub do_cmd_bxlink {
599    # Format is bxlink{Mail Command in the Messages Resource}{blb:mailcommand}{main}{chapter}
600    local($_) = @_ ;
601    local($btext,$blabel,$bmanual,$bwhat,$text) ;
602    $btext = &bnext_arg() ;
603    $blabel = &bnext_arg() ;
604    $bmanual = &bnext_arg() ;
605    $bwhat = &bnext_arg() ;
606    #
607    # There is only one case we know where we are
608    my $blinkedfile = "__TO_BE_REPLACED_WITH_HTML_FILENAME__" ;
609    if ($bmanual eq $FILE) {
610	$blinkedfile = $CURRENT_FILE ;
611    }
612    join('','<a class="bxlink" href="../',$bmanual,'/',$blinkedfile,'#',$blabel,'">',$btext,' ',$bwhat,'</a>',$_) ;
613}
614
615sub do_cmd_label {
616    local($_) = @_;
617    local($label);
618    print "do_cmd_label: converting $FILE to $CURRENT_FILE\n" if ($VERBOSITY > 5) ;
619    $label = &missing_braces unless (
620	(s/$next_pair_pr_rx\n?/$label = $2;''/eo)
621	||(s/$next_pair_rx\n?/$label = $2;''/eo));
622    &anchor_label($label,$CURRENT_FILE,$_);
623    $label =~ s/<[^>]*>//go;
624    $label =~ s/$label_rx/_/g;
625    if ($ref_files{$label} ne $CURRENT_FILE) {
626        $ref_files{$label} = $CURRENT_FILE;
627        $noresave{$label} = 0; $changed = 1; }
628    print "<LABEL: $label>" if ($VERBOSITY > 3);
629    join('',"<A class=\"blabel\" NAME=\"$FILE-$label\">$anchor_mark</A>",$_);
630}
631
632# This is used by external style files ...
633sub bprocess_ref {
634    local($ref_mark, $visible_mark, $class, $use_label, $after_label) = @_;
635    $use_label = &balance_inner_tags($use_label)
636	if $use_label =~ (/<\/([A-Z]+)>($math_verbatim_rx.*)<\1>/);
637    $use_label = &translate_environments($use_label);
638    $use_label = &simplify(&translate_commands($use_label))
639	if ($use_label =~ /\\/ );
640    local($label,$id);
641    local($pretag) = &get_next_optional_argument;
642    $pretag = &translate_commands($pretag) if ($pretag =~ /\\/);
643    $label = &missing_braces unless (
644	(s/$next_pair_pr_rx/($id, $label) = ($1, $2);''/eo)
645	||(s/$next_pair_rx/($id, $label) = ($1, $2);''/eo));
646    if ($label) {
647	$label =~ s/<[^>]*>//go ; #RRM: Remove any HTML tags
648	$label =~ s/$label_rx/_/g;	# replace non alphanumeric characters
649
650	$symbolic_labels{"$pretag$label$id"} = $use_label if ($use_label);
651	if (($symbolic_labels{$pretag.$label})&&!($use_label)) {
652	    $use_label = $symbolic_labels{$pretag.$label}
653	}
654#	if (!($use_label eq $label)) {
655#	    $symbolic_labels{"$label$id"} = $use_label;
656#	};
657     	# if $use_label is empty then $label is used as the cross_ref_mark
658	# elseif $use_label is a string then $use_label is used
659        # else the usual mark will be used
660	$use_label = ( (!$use_label && $label) || $use_label);
661
662	print "\nLINK: $ref_mark\#$label\#$id  :$use_label:" if ($VERBOSITY > 3);
663	# The quotes around the HREF are inserted later
664	join('',"<A class=\"$class\" HREF=$ref_mark#$FILE-$label#$id>$visible_mark<\/A>",$after_label, $_);
665    }
666    else {
667	print "Cannot find label argument after <$last_word>\n" if $last_word;
668	$after_label . $_;
669    }
670}
671#
672# Quotes
673sub do_cmd_bog {
674    join('','<span class="bleftquote">','_left_quote_','</span>',$_[0]) ;
675}
676sub do_cmd_cog {
677    join('','<span class="brightquote">','_right_quote_','</span>',$_[0]) ;
678#    join('','&#8221;',$_[0]) ;
679}
680
681sub do_cmd_babove {
682    join('','&ge;',$_[0]) ;
683}
684# ======================================================================
6851;
686