Patrice Dumas <[email protected]> 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č <[email protected]> [he/him]
http://adamkovic.org

Reply via email to