# bdefinitions.perl # by Philippe Chauvat # This file is designed to support the builing of Bacula (http://www.bacula.org) and/or # Bacula Enterprise Edition (http://www.baculasystems.com) manuals. # Support of the bdefinitions.sty Bacula package # ====================================================================== # Does not require any package => do_require_package('') ; # Package Options #No package options #sub do_bdefinitions_option {} # ====================================================================== sub bnext_arg { # Modifies $_ # # This is a whole duplicate of the x_next_arg function # defined in the graphics-support.perl file. # I renamed it to be: # a) consistent with the other definitions # b) be sure there will be no conflict with anything else. my $arg; &missing_braces unless ((s/$next_pair_pr_rx/$arg=$2;''/e) ||(s/$next_pair_rx/$arg=$2;''/e)); $arg; } sub do_cmd_bfilename { local($_)=@_; my $file = bnext_arg(); &styled_text_chunk('SPAN','CLASS="bfilename"','','','','',@_) ; } sub do_cmd_btable { local($_)=@_; my $file = bnext_arg(); &styled_text_chunk('SPAN','CLASS="btable"','','','','',@_) ; } sub do_cmd_bdirectoryname { local($_)=@_; my $file = bnext_arg(); &styled_text_chunk('SPAN','CLASS="bdirectoryname"','','','','',@_) ; } sub do_cmd_bdirectory { local($_)=@_; my $file = bnext_arg() ; &styled_text_chunk('','','','','','bdirectory',@_) ; } sub bdirectory { local($btext)= @_ ; join('','', $btext, ' directory') ; } sub do_cmd_bdirectivename { local($_)=@_; my $file = bnext_arg(); &styled_text_chunk('SPAN','CLASS="bdirectivename"','','','','',@_) ; } sub do_cmd_bdirective { local($_)=@_; my $file = bnext_arg() ; &styled_text_chunk('','','','','','bdirective',@_) ; } sub bdirective { local($btext)= @_ ; join('','',$btext, ' directive') ; } sub bresourcename { local($mybresource) = @_ ; join('','',$mybresource,'') ; } sub bcommandname { local($mybcommand) = @_ ; join('','',$mybcommand,'') ; } sub do_cmd_bPool { join('','','Pool','',$_[0]) ; } sub do_cmd_bConsole { join('','','Console','',$_[0]) ; } sub do_cmd_bCatalog { join('','','Catalog','',$_[0]) ; } sub do_cmd_bJob { join('','','Job','',$_[0]) ; } sub do_cmd_bVolume { join('','','Volume','',$_[0]) ; } sub do_cmd_bFileSet { join('','','FileSet','',$_[0]) ; } sub do_cmd_bStorage { join('','','Storage','',$_[0]) ; } sub do_cmd_bJobId { join('','','JobId','',$_[0]) ; } sub do_cmd_bClient { join('','','Client','',$_[0]) ; } sub do_cmd_bDirector { join('','','Director','',$_[0]) ; } sub do_cmd_bconsolename { join('','','bconsole','',$_[0]) ; } sub do_cmd_bconsole { join('',bbacula(),'',' ','Console','',$_[0]) ; } sub do_cmd_bstructure { local($_)=@_; my $mybstructure = bnext_arg() ; &styled_text_chunk('','','','','','bstructure',@_) ; } sub bstructure { local($btext)= @_ ; join('','',$btext,' structure') ; } sub do_cmd_bstructurename { local($_)=@_; my $file = bnext_arg(); &styled_text_chunk('SPAN','CLASS="bstructurename"','','','','',@_) ; } sub do_cmd_bresourcename { local($_)=@_; my $file = bnext_arg(); &styled_text_chunk('SPAN','CLASS="bresourcename"','','','','',@_) ; } sub do_cmd_bresource { local($_)=@_; my $file = bnext_arg() ; &styled_text_chunk('','','','','','bresource',@_) ; } sub bresource { local($btext)= @_ ; join('',bresourcename($btext),' resource') ; } sub bresources { local($btext)= @_ ; join('',bresourcename($btext),' resources') ; } sub do_cmd_bresources { local($_)=@_; my $file = bnext_arg() ; &styled_text_chunk('','','','','','bresources',@_) ; } sub bresourceq { local($btext)= @_ ; join('',bresourcename(join('',$btext,"'s")),' resource') ; } sub do_cmd_bresourceq { local($_)=@_; my $file = bnext_arg() ; &styled_text_chunk('','','','','','bresourceq',@_) ; } sub do_cmd_bcommandname { local($_)=@_; my $file = bnext_arg(); &styled_text_chunk('SPAN','CLASS="bcommandname"','','','','',@_) ; } sub bcommand { local($btext)= @_ ; join('',eval("&bcommandname(\$btext)"),' command') ; } sub do_cmd_bcommand { local($_)=@_; my $file = bnext_arg() ; &styled_text_chunk('','','','','','bcommand',@_) ; } sub do_cmd_btool { local($_)=@_; my $tool = bnext_arg() ; &styled_text_chunk('SPAN','CLASS="btool"','','','','',@_) ; } sub bbracket { local($btext)= @_ ; join('','<',$btext,'>') ; } sub do_cmd_bbracket { local($_)=@_; my $bracket = bnext_arg() ; &styled_text_chunk('','','','','','bbracket',@_) ; } sub do_cmd_bvalue { local($_)=@_; my $value = bnext_arg(); &styled_text_chunk('SPAN','CLASS="bvalue"','','','','',@_) ; } sub do_cmd_bhighlight { local($_)=@_; my $value = bnext_arg(); &styled_text_chunk('SPAN','CLASS="bhighlight"','','','','',@_) ; } sub do_cmd_bkeyword { local($_)=@_; my $value = bnext_arg(); # # The following is *not* a mistake. It is defined into the bdefinitions.sty file # If you want to handle it differently please do. # could be &styled_text_chunk('SPAN','CLASS="bkeyword"','','','','',@_) ; &styled_text_chunk('SPAN','CLASS="bvalue"','','','','',@_) ; } sub do_cmd_bdefaultvalue { local($_)=@_; my $value = bnext_arg(); &styled_text_chunk('SPAN','CLASS="bdefaultvalue"','','','','',@_) ; } sub bbacula { local($_)=@_; join('','','Bacula','') ; } sub do_cmd_bacula { local($_)=@_; my $bbacula = bnext_arg(); &styled_text_chunk('','','','','','bbacula',@_) ; } sub do_cmd_baculasystems{ join('','','Bacula Systems','',$_[0]); } sub do_cmd_bweb{ join('','BWeb',$_[0]); } sub do_cmd_mssql{ join('','MSSQL',$_[0]); } sub do_cmd_postgresql { join('','PostgreSQL',$_[0]); } sub do_cmd_mysql { join('','MySQL',$_[0]); } sub do_cmd_sqlite { join('','SQLite',$_[0]); } sub do_cmd_bnextpage { # We don't do nothing with it.. } sub do_cmd_byesorno { join('','<yes|no>',$_[0]); } sub do_cmd_gt { join('',">",$_[0]); } sub do_cmd_lt { join('',"<",$_[0]); } # # Manual names sub buildmanualname { local($mymanual) = @_ ; my $bacula = bbacula() ; my $bedition = &do_cmd_beditionname() ; join('','',$bacula,' ',$bedition,' ',$mymanual,''); } sub do_cmd_bmainman { $mybuild = buildmanualname("Main manual") ; join('',$mybuild,$_[0]); } sub do_cmd_bconsoleman { $mybuild = buildmanualname("Console manual") ; join('',$mybuild,$_[0]); } sub do_cmd_bdevelman { $mybuild = buildmanualname("Developer's manual") ; join('',$mybuild,$_[0]); } sub do_cmd_butilityman { $mybuild = buildmanualname("Utility Programs manual") ; join('',$mybuild,$_[0]); } # #sub do_cmd_bproblemsman { # &do_cmd_bproblemman() ; #} sub do_cmd_bproblemman { $mybuild = buildmanualname("Problems Resolution guide") ; join('',$mybuild,$_[0]); } sub do_cmd_bmiscman { $mybuild = buildmanualname("Miscellaneous guide") ; join('',$mybuild,$_[0]); } sub do_cmd_bregistered { join('',"®",$_[0]); } sub do_cmd_bstar { join('',"★",$_[0]); } sub do_cmd_vb { join('',"|",$_[0]); } sub do_cmd_url { local($_) = @_ ; print "PCT: do_cmd_url: $_\n" if ($VERBOSITY > 20) ; } sub do_cmd_bcopyright { join('',"©",$_[0]); } sub do_cmd_byear { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) ; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); $year += 1900 ; join('',$year,$_[0]); } sub do_cmd_btitlelogo { join('', # Logo and documentation title '
', '', 'BaculaSystems Documentation text', '
', # Breadcrumbs and search field '
', '
', 'Search', '', '
', '
', '

Main

', '
', '
', $_[0]) ; } sub do_cmd_bru{ join('','bru',$_[0]) ; } sub do_cmd_bdump { join('','dump',$_[0]) ; } sub do_cmd_tar { join('','tar',$_[0]) ; } sub do_cmd_mtx { join('','mtx',$_[0]) ; } sub do_cmd_mtxchanger { join('','mtx-changer',$_[0]) ; } sub do_cmd_bat { join('',&bacs('BAT'),$_[0]) ; } # # Acronyms sub bacs { local($bkey)=@_ ; print "PCT: bacs: key: >$bkey< @_\n" if ($VERBOSITY > 20) ; join('','',$bkey,"") ; } sub do_cmd_acs { local($_)=@_; &styled_text_chunk('','','','','','bacs',$_[0]) ; } sub bacsp { local($bkey) = @_ ; join('','',$bkey,'s',$_[0]) ; } sub do_cmd_acsp { local($_)=@_; my $bkey = bnext_arg(); &styled_text_chunk('','','','','','bacsp',$_[0]) ; } sub bac { local($bkey)=@_; my $bvalue = $bkey ; if ($bacronyms{$bkey}{'displayed'} == 0) { print "PCT: bac: never displayed: $bkey\n" if ($VERBOSITY > 10) ; $bacronyms{$bkey}{'displayed'} = 1 ; $bvalue = join('',$bacronyms{$bkey}{'value'},' (',$bkey,')') ; } join('','', $bvalue, '') ; } sub do_cmd_ac { local($_)=@_; my $bkey = bnext_arg(); &styled_text_chunk('','','','','','bac',@_) ; } sub bacp { local($bkey)=@_; my $bvalue = join('',$bkey,'s') ; if ($bacronyms{$bkey}{'displayed'} == 0) { print "PCT: do_cmd_acp: never displayed: $bkey\n" if ($VERBOSITY > 10) ; $bacronyms{$bkey}{'displayed'} = 1 ; $bvalue = join('',$bacronyms{$bkey}{'value'},'s (', $bkey,'s)') ; } join('','', $bvalue, '') ; } sub do_cmd_acp { local($_)=@_; &styled_text_chunk('','','','','','bacp',@_) ; } sub bacl { local($bkey)=@_; print "PCT: do_cmd_acl: key: $bkey\n" if ($VERBOSITY > 5) ; my $bvalue = $bacronyms{$bkey}{'value'} ; print "PCT: do_cmd_acl: val: $bvalue\n" if ($VERBOSITY > 5) ; join('','', $bvalue, '') ; } sub do_cmd_acl { local($_)=@_; my $bkey = bnext_arg(); &styled_text_chunk('','','','','','bacl',@_) ; } sub baclp { local($bkey)=@_; my $bvalue = $bacronyms{$bkey}{'value'} ; join('','',$bvalue,'s') ; } sub do_cmd_aclp { local($_)=@_; &styled_text_chunk('','','','','','baclp',@_) ; } sub make_acronym_id { local($bkey) = @_ ; $bacronyms{$bkey}{'seen'} = 1 ; print "PCT: make_acronym_id: $bkey seen\n" if ($VERBOSITY > 10) ; join('','bacronyms_',lc($bkey)) ; } # # Images sub bcompute_image { local($bclass,$bfilename,$blabel,$bcaption,$bsize) = @_ ; join('','
', '
', '','',$bcaption,'','', '
', '', '
', '
',$_) ; } # Horizontal image sub do_cmd_bimageH { local($_) = @_ ; # bimageH[an optional width]{image_filename}{caption to display}{label to use} print "do_cmd_bimageH: $_\n" if ($VERBOSITY > 20) ; local($bwidth,$bfilename,$bcaption,$blabel) ; $bwidth = &get_next_optional_argument() ; $bfilename = join('','../../images/',&bnext_arg(),'.png') ; $bcaption = &bnext_arg() ; $blabel = &bnext_arg() ; print "do_cmd_bimageH: Width = $bwidth\tFile = $bfilename\tCaption = $bcaption\tLabel = $blabel\n" if ($VERBOSITY > 100) ; if ($bwidth ne "") { print "do_cmd_bimageH: bwidth: $bwidth\n" if ($VERBOSITY > 200) ; if ($bwidth =~ /(.*)\\linewidth/) { $bwidth = $1 * 100 ; $bwidth = join('','style="width: ',$bwidth,'%') ; } } print "do_cmd_bimageH: bwidth: $bwidth\n" if ($VERBOSITY > 10) ; &bcompute_image("bimageH",$bfilename,$blabel,$bcaption,$bwidth) ; } # # Images with no orientation sub do_cmd_bimageN { local($_) = @_ ; # bimageN[an optional width]{image_filename}{caption to display}{label to use} print "do_cmd_bimageN: $_\n" if ($VERBOSITY > 20) ; local($bwidth,$bfilename,$bcaption,$blabel) ; $bwidth = &get_next_optional_argument() ; $bfilename = join('','../../images/',&bnext_arg(),'.png') ; $bcaption = &bnext_arg() ; $blabel = &bnext_arg() ; print "do_cmd_bimageN: Width = $bwidth\tFile = $bfilename\tCaption = $bcaption\tLabel = $blabel\n" if ($VERBOSITY > 10) ; if ($bwidth ne "") { print "do_cmd_bimageN: bwidth: $bwidth\n" if ($VERBOSITY > 10) ; if ($bwidth =~ /(.*)\\linewidth/) { $bwidth = join('','style="width: ',$1 * 100,'%;"') ; } } print "do_cmd_bimageN: bwidth: $bwidth\n" if ($VERBOSITY > 10) ; &bcompute_image("bimageN",$bfilename,$blabel,$bcaption,$bwidth) ; } # # Images with no orientation sub do_cmd_bimageV { local($_) = @_ ; # bimageV[an optional height]{image_filename}{caption to display}{label to use} print "do_cmd_bimageV: $_\n" if ($VERBOSITY > 20) ; local($bheight,$bfilename,$bcaption,$blabel) ; $bheight = &get_next_optional_argument() ; $bfilename = join('','../../images/',&bnext_arg(),'.png') ; $bcaption = &bnext_arg() ; $blabel = &bnext_arg() ; print "do_cmd_bimageV: Height = $bheight\tFile = $bfilename\tCaption = $bcaption\tLabel = $blabel\n" if ($VERBOSITY > 10) ; # # As we are in HTML, we can not calculate anything based on "linewidth". So either an absolute dimension is specified # and everything is fine # or no dimension or a relative dimension is provided and we are in trouble => no width no height. if ($bheight ne "" and $bheight !~ /\\/) { $bheight = join('','style: "height: ',$bheight,';"') ; } else { $bheight = "" ; } print "do_cmd_bimageV: bheight: $bheight\n" if ($VERBOSITY > 10) ; &bcompute_image("bimageV",$bfilename,$blabel,$bcaption,$bheight) ; } sub do_cmd_textcolor { local($_) = @_ ; my $bcolor = &bnext_arg() ; my $btext = &bnext_arg() ; print "PCT: do_cmd_textcolor: color: $bcolor - text: $btext\n" if ($VERBOSITY > 10) ; join('',$btext,$_) ; } sub do_cmd_vref { local($_) = @_ ; # # The only arg is the label name my $blabel=&bnext_arg() ; print "PCT: do_cmd_vref: label: $blabel\n" if ($VERBOSITY > 10) ; if (my $bfilename = $ref_files{$blabel}) { if ($bfilename ne $CURRENT_FILE) { $burl = join('',$bfilename,'#',$blabel) ; } else { $burl = join('','#',$blabel) ; } } join('','(here)',$_) ; } sub do_cmd_bref { local($_) = @_ ; my $burl = &bnext_arg(); my $btext=&bnext_arg() ; print "\nPCT: do_cmd_bref: text: $btext - url: $burl\n" if ($VERBOSITY > 2) ; if ($burl !~ /http(s?):/) { if (my $bfilename = $ref_files{$burl}) { if ($bfilename ne $CURRENT_FILE) { $burl = join('',$bfilename,'#',$burl) ; } else { $burl = join('','#',$burl) ; } } } join('','',$btext,'',$_) ; } sub do_cmd_bfootref { local($_) = @_ ; &do_cmd_bref($_) ; } sub do_cmd_textrightarrow { join('',"→",$_[0]); } sub do_cmd_bilink { local($_) = @_; local($text); local($opt, $dummy) = &get_next_optional_argument; $text = &missing_braces unless ((s/$next_pair_pr_rx/$text = $2; ''/eo) ||(s/$next_pair_rx/$text = $2; ''/eo)); print "PCT: bilink: text: $text --- opt: $opt --- dummy: $dummy\n" if ($VERBOSITY > 2) ; &bprocess_ref($cross_ref_mark,$cross_ref_mark,"bilink",$text); } sub do_cmd_bxdlink { # \bxdlink}[4]{\href{../#3/#3}{\textbf{#1}} (#4 \vref{#3-#2})} # Format is bxdlink{Mail Command in the Messages Resource}{blb:mailcommand}{main}{chapter} local($_) = @_ ; local($btext,$blabel,$bmanual,$bwhat,$text) ; $btext = &bnext_arg() ; $blabel = &bnext_arg() ; $bmanual = &bnext_arg() ; $bwhat = &bnext_arg() ; # # There is only one case we know where we are my $blinkedfile = "__TO_BE_REPLACED_WITH_HTML_FILENAME__" ; if ($bmanual eq $FILE) { $blinkedfile = $CURRENT_FILE ; } join('','',$btext,'',$_) ; } sub do_cmd_bxlink { # Format is bxlink{Mail Command in the Messages Resource}{blb:mailcommand}{main}{chapter} local($_) = @_ ; local($btext,$blabel,$bmanual,$bwhat,$text) ; $btext = &bnext_arg() ; $blabel = &bnext_arg() ; $bmanual = &bnext_arg() ; $bwhat = &bnext_arg() ; # # There is only one case we know where we are my $blinkedfile = "__TO_BE_REPLACED_WITH_HTML_FILENAME__" ; if ($bmanual eq $FILE) { $blinkedfile = $CURRENT_FILE ; } join('','',$btext,' ',$bwhat,'',$_) ; } sub do_cmd_label { local($_) = @_; local($label); print "do_cmd_label: converting $FILE to $CURRENT_FILE\n" if ($VERBOSITY > 5) ; $label = &missing_braces unless ( (s/$next_pair_pr_rx\n?/$label = $2;''/eo) ||(s/$next_pair_rx\n?/$label = $2;''/eo)); &anchor_label($label,$CURRENT_FILE,$_); $label =~ s/<[^>]*>//go; $label =~ s/$label_rx/_/g; if ($ref_files{$label} ne $CURRENT_FILE) { $ref_files{$label} = $CURRENT_FILE; $noresave{$label} = 0; $changed = 1; } print "" if ($VERBOSITY > 3); join('',"$anchor_mark",$_); } # This is used by external style files ... sub bprocess_ref { local($ref_mark, $visible_mark, $class, $use_label, $after_label) = @_; $use_label = &balance_inner_tags($use_label) if $use_label =~ (/<\/([A-Z]+)>($math_verbatim_rx.*)<\1>/); $use_label = &translate_environments($use_label); $use_label = &simplify(&translate_commands($use_label)) if ($use_label =~ /\\/ ); local($label,$id); local($pretag) = &get_next_optional_argument; $pretag = &translate_commands($pretag) if ($pretag =~ /\\/); $label = &missing_braces unless ( (s/$next_pair_pr_rx/($id, $label) = ($1, $2);''/eo) ||(s/$next_pair_rx/($id, $label) = ($1, $2);''/eo)); if ($label) { $label =~ s/<[^>]*>//go ; #RRM: Remove any HTML tags $label =~ s/$label_rx/_/g; # replace non alphanumeric characters $symbolic_labels{"$pretag$label$id"} = $use_label if ($use_label); if (($symbolic_labels{$pretag.$label})&&!($use_label)) { $use_label = $symbolic_labels{$pretag.$label} } # if (!($use_label eq $label)) { # $symbolic_labels{"$label$id"} = $use_label; # }; # if $use_label is empty then $label is used as the cross_ref_mark # elseif $use_label is a string then $use_label is used # else the usual mark will be used $use_label = ( (!$use_label && $label) || $use_label); print "\nLINK: $ref_mark\#$label\#$id :$use_label:" if ($VERBOSITY > 3); # The quotes around the HREF are inserted later join('',"$visible_mark<\/A>",$after_label, $_); } else { print "Cannot find label argument after <$last_word>\n" if $last_word; $after_label . $_; } } # # Quotes sub do_cmd_bog { join('','','_left_quote_','',$_[0]) ; } sub do_cmd_cog { join('','','_right_quote_','',$_[0]) ; # join('','”',$_[0]) ; } sub do_cmd_babove { join('','≥',$_[0]) ; } # ====================================================================== 1;