help-texinfo
[Top][All Lists]
Advanced

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

Re: How to add "Up:" to Texinfo navigation bar?


From: Rudolf Adamkovič
Subject: Re: How to add "Up:" to Texinfo navigation bar?
Date: Thu, 29 Aug 2024 00:27:26 +0200

Patrice Dumas <pertusus@free.fr> writes:

Pat,

Thank you for your *extensive* help!

It worked perfectly (ignoring the typo).

I ended up with the following:

  # Configure the buttons.
  
  sub _my_panel_button_dynamic_direction {
      my ($self, $direction) = @_;
      my $node_direction = 'Node'.$direction;
      my $href = $self->from_element_direction($node_direction, 'href');
      my $section = $self->from_element_direction($node_direction, 'section');
      return ("$direction: <a href=\"$href\">$section</a>", 1);
  }
  
  my $up_button = ['Up', \&_my_panel_button_dynamic_direction];
  my $section_buttons = [$up_button, ' ', 'Top', 'Contents'];
  my $top_buttons = ['Contents'];
  
  texinfo_set_from_init_file('TOP_BUTTONS', $top_buttons);
  texinfo_set_from_init_file('SECTION_BUTTONS', $section_buttons);
  texinfo_set_from_init_file('SECTION_FOOTER_BUTTONS', $section_buttons);

It took me additional couple of hours to figure out:

  my $node_direction = 'Node'.$direction;

This is definitely the longest it took me to add a button! :)

[One afternoon before I asked, and then one after that.]

> An example of something better, though maybe too complicated could be
> ['Up', 'Up: {section}'].

Concise and robust!

[Unlike my function that assumes too much: NODES, English, etc.]

Thank you again for your *extensive* help!

Rudy
-- 
“Those who cannot remember the past are condemned to repeat it.”  ---
George Santayana, Life of Reason: Reason in Common Sense, 1905

Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org



reply via email to

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