mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
Extend yat2m to allow indented tables.
Current makeinfo versions allow to indent the texinfo source. However yat2m had no support for this. With this patch it is now possible to use a simple indentation style while keeping man pages readable.
This commit is contained in:
parent
cdd152bf49
commit
b277bec250
@ -1,3 +1,7 @@
|
||||
2011-10-12 Werner Koch <wk@g10code.com>
|
||||
|
||||
* yat2m.c (parse_file): Add hack to allow table indentation.
|
||||
|
||||
2011-08-12 Werner Koch <wk@g10code.com>
|
||||
|
||||
* texi.css: Override some elements.
|
||||
|
35
doc/yat2m.c
35
doc/yat2m.c
@ -1,6 +1,6 @@
|
||||
/* yat2m.c - Yet Another Texi 2 Man converter
|
||||
* Copyright (C) 2005 g10 Code GmbH
|
||||
* Copyright (C) 2006, 2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2006, 2008, 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -72,7 +72,21 @@
|
||||
extracted from one file, either using the --store or the --select
|
||||
option.
|
||||
|
||||
If you want to indent tables in the source use this style:
|
||||
|
||||
@table foo
|
||||
@item
|
||||
@item
|
||||
@table
|
||||
@item
|
||||
@end
|
||||
@end
|
||||
|
||||
Don't change the indentation within a table and keep the same
|
||||
number of white space at the start of the line. yat2m simply
|
||||
detects the number of white spaces in front of an @item and remove
|
||||
this number of spaces from all following lines until a new @item
|
||||
is found or there are less spaces than for the last @item.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -856,6 +870,7 @@ parse_file (const char *fname, FILE *fp, char **section_name, int in_pause)
|
||||
int in_gpgone = 0; /* Keep track of "@ifset gpgone" parts. */
|
||||
int not_in_gpgone = 0; /* Keep track of "@ifclear gpgone" parts. */
|
||||
int not_in_man = 0; /* Keep track of "@ifclear isman" parts. */
|
||||
int item_indent = 0; /* How far is the current @item indented. */
|
||||
|
||||
/* Helper to define a macro. */
|
||||
char *macroname = NULL;
|
||||
@ -879,6 +894,24 @@ parse_file (const char *fname, FILE *fp, char **section_name, int in_pause)
|
||||
}
|
||||
line[--n] = 0;
|
||||
|
||||
/* Kludge to allow indentation of tables. */
|
||||
for (p=line; *p == ' ' || *p == '\t'; p++)
|
||||
;
|
||||
if (*p)
|
||||
{
|
||||
if (*p == '@' && !strncmp (p+1, "item", 4))
|
||||
item_indent = p - line; /* Set a new indent level. */
|
||||
else if (p - line < item_indent)
|
||||
item_indent = 0; /* Switch off indention. */
|
||||
|
||||
if (item_indent)
|
||||
{
|
||||
memmove (line, line+item_indent, n - item_indent + 1);
|
||||
n -= item_indent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (*line == '@')
|
||||
{
|
||||
for (p=line+1, n=1; *p && *p != ' ' && *p != '\t'; p++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user