[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/makeinfo html.c,1.8,1.9 index.c,1.7,1.8
From: |
dirt |
Subject: |
texinfo/makeinfo html.c,1.8,1.9 index.c,1.7,1.8 |
Date: |
Wed, 14 Jan 2004 00:37:16 +0100 |
Update of /cvsroot/texinfo/texinfo/makeinfo
In directory sheep:/tmp/cvs-serv2491/makeinfo
Modified Files:
html.c index.c
Log Message:
2004-01-14 Alper Ersoy <address@hidden>
* makeinfo/html.c (rollback_empty_tag): rewrote to also identify empty
elements with attributes.
(insert_html_tag): increment and decrement in_html_elt.
* makeinfo/index.c (index_add_arg): do not call flush_output for xml
and html outputs as they do not need an accurate output line number
tracking, and flush_output makes rollback_empty tag useless.
Index: html.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/html.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** html.c 13 Jan 2004 19:05:01 -0000 1.8
--- html.c 13 Jan 2004 23:37:13 -0000 1.9
***************
*** 430,466 ****
{
int check_position = output_paragraph_offset;
! char *tag_with_lt_gt = xmalloc (strlen (tag) + sizeof ("<>"));
! char *whitespace;
! /* Prepare check tag. */
! snprintf (tag_with_lt_gt, strlen (tag) + sizeof ("<>"), "<%s>", tag);
! /* Skip whitespace at the end of output_paragraph. */
! while (output_paragraph[check_position-1] == ' '
! || output_paragraph[check_position-1] == '\n'
! || output_paragraph[check_position-1] == '\t')
check_position--;
if (check_position != output_paragraph_offset)
! { /* We have whitespace to save. */
! whitespace = xmalloc (output_paragraph_offset - check_position);
! memcpy (whitespace, output_paragraph + check_position,
output_paragraph_offset - check_position);
}
! /* Adjust check_position so it shows the start of opening tag. */
! /* (-1 is for NULL.) */
! check_position -= strlen (tag) + sizeof ("<>") - 1;
! /* Actual check. */
! if (strncmp ((char *) output_paragraph + check_position,
! tag_with_lt_gt, strlen (tag_with_lt_gt)) == 0)
{
! /* Rollback. */
! output_paragraph_offset = check_position;
! return 1;
}
! else
! return 0;
}
--- 430,484 ----
{
int check_position = output_paragraph_offset;
! int taglen = strlen (tag);
! int rollback_happened = 0;
! char *contents = "";
! char *contents_canon_white = "";
! /* If output_paragraph is empty, we cannot rollback :-\ */
! if (output_paragraph_offset <= 0)
! return 0;
! /* Find the end of the previous tag. */
! while (output_paragraph[check_position-1] != '>' && check_position > 0)
check_position--;
+ /* Save stuff between tag's end to output_paragraph's end. */
if (check_position != output_paragraph_offset)
! {
! contents = xmalloc (output_paragraph_offset - check_position + 1);
! memcpy (contents, output_paragraph + check_position,
output_paragraph_offset - check_position);
+
+ contents[output_paragraph_offset - check_position] = '\0';
+
+ contents_canon_white = xstrdup (contents);
+ canon_white (contents_canon_white);
}
! /* Find the start of the previous tag. */
! while (output_paragraph[check_position-1] != '<' && check_position > 0)
! check_position--;
! /* Check to see if this is the tag. */
! if (strncmp ((char *) output_paragraph + check_position, tag, taglen) == 0
! && (whitespace (output_paragraph[check_position + taglen])
! || output_paragraph[check_position + taglen] == '>'))
{
! if (!contents_canon_white || !*contents_canon_white)
! {
! /* Empty content after whitespace removal, so roll it back. */
! output_paragraph_offset = check_position - 1;
! rollback_happened = 1;
!
! /* Original contents may not be empty (whitespace.) */
! if (contents && *contents)
! {
! insert_string (contents);
! free (contents);
! }
! }
}
!
! return rollback_happened;
}
***************
*** 473,476 ****
--- 491,495 ----
char *old_tag = NULL;
int do_return = 0;
+ extern int in_html_elt;
if (start_or_end != START)
***************
*** 491,494 ****
--- 510,515 ----
return;
+ in_html_elt++;
+
/* texinfo.tex doesn't support more than one font attribute
at the same time. */
***************
*** 507,510 ****
--- 528,533 ----
if ((start_or_end != START) && old_tag && *old_tag)
add_word_args ("<%s>", old_tag);
+
+ in_html_elt--;
}
Index: index.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/index.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** index.c 13 Jan 2004 01:01:01 -0000 1.7
--- index.c 13 Jan 2004 23:37:13 -0000 1.8
***************
*** 174,178 ****
/* Get output line number updated before doing anything. */
! flush_output ();
new->next = the_indices[which];
--- 174,179 ----
/* Get output line number updated before doing anything. */
! if (!html && !xml)
! flush_output ();
new->next = the_indices[which];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/makeinfo html.c,1.8,1.9 index.c,1.7,1.8,
dirt <=