ignore_and_comments_output.init 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. use strict;
  2. # output comment lines in comments
  3. $misc_command_line = \&comments_output_misc_command_line;
  4. sub comments_output_misc_command_line($$$$$)
  5. {
  6. my $macro = shift;
  7. my $line = shift;
  8. my $args = shift;
  9. my $stack = shift;
  10. my $state = shift;
  11. my $result;
  12. if ($macro eq 'c' or $macro eq 'comment' and scalar(@$args))
  13. {
  14. my $comment_line = $args->[0];
  15. chomp ($comment_line);
  16. # makeinfo remove all the leading spaces
  17. $comment_line =~ s/^\s//;
  18. $result = &$comment ($comment_line);
  19. }
  20. return ($macro, $line, $result);
  21. }
  22. # output @ignore blocks in comments.
  23. $texi_formats_map{'ignore'} = 'raw';
  24. #$format_in_paragraph{'ignore'} = 1;
  25. $no_paragraph_commands{'end ignore'} = 1;
  26. $no_paragraph_commands{'ignore'} = 1;
  27. $command_handler{'ignore'} = { 'init' => \&collect_ignore_blocks,
  28. 'expand' => \&ignore_blocks_to_comments,
  29. };
  30. my %ignore_blocks;
  31. push @command_handler_init, \&ignore_block_to_comments_init;
  32. sub ignore_block_to_comments_init
  33. {
  34. %ignore_blocks = ();
  35. }
  36. sub collect_ignore_blocks($$$)
  37. {
  38. my $command = shift;
  39. my $text = shift;
  40. my $counter = shift;
  41. $ignore_blocks{$command}->{$counter} = $text;
  42. }
  43. sub ignore_blocks_to_comments($$)
  44. {
  45. my $command = shift;
  46. my $counter = shift;
  47. my $result = &$comment ($ignore_blocks{$command}->{$counter});
  48. chomp ($result);
  49. return $result;
  50. }