Fossil

Check-in [cb44f7de]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a bug in HTML attribute parsing.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cb44f7dea478e9b08127a27dc37b7697bce22748
User & Date: drh 2010-05-24 18:43:32
References
2010-05-26
13:46 New ticket [fb47088d] The default editor on Linux is ed. artifact: 4f7ad9c5 user: anonymous
13:40 Ticket [8c46da20] Checkin fails: "editor aborted" on Cygwin status still Open with 2 other changes artifact: d479fbf5 user: anonymous
2010-05-25
09:31 Ticket [e39122fc] Typo on "Fossil Self-Hosting Repositories" Page status still Open with 4 other changes artifact: c0236096 user: anonymous
Context
2010-05-25
12:30
Fix typo in the Self-Hostiry Repositories page. Ticket [e39122fcc434125c6]. check-in: f19de0b0 user: drh tags: trunk
2010-05-24
18:43
Fix a bug in HTML attribute parsing. check-in: cb44f7de user: drh tags: trunk
18:19
Rewrite the SRC= attribute of <IMG> markup to insert the zBaseURL where appropriate. check-in: dc82d570 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/wikiformat.c.

37
38
39
40
41
42
43

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
...
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
....
1084
1085
1086
1087
1088
1089
1090




1091
1092
1093
1094
1095
1096
1097
*/
#define ATTR_ALIGN              1
#define ATTR_ALT                2
#define ATTR_BGCOLOR            3
#define ATTR_BORDER             4
#define ATTR_CELLPADDING        5
#define ATTR_CELLSPACING        6

#define ATTR_CLEAR              7
#define ATTR_COLOR              8
#define ATTR_COLSPAN            9
#define ATTR_COMPACT            10
#define ATTR_FACE               11
#define ATTR_HEIGHT             12
#define ATTR_HREF               13
#define ATTR_HSPACE             14
#define ATTR_ID                 15
#define ATTR_NAME               16
#define ATTR_ROWSPAN            17
#define ATTR_SIZE               18
#define ATTR_SRC                19
#define ATTR_START              20
#define ATTR_TYPE               21
#define ATTR_VALIGN             22
#define ATTR_VALUE              23
#define ATTR_VSPACE             24
#define ATTR_WIDTH              25
#define AMSK_ALIGN              0x0000001
#define AMSK_ALT                0x0000002
#define AMSK_BGCOLOR            0x0000004
#define AMSK_BORDER             0x0000008
#define AMSK_CELLPADDING        0x0000010
#define AMSK_CELLSPACING        0x0000020
#define AMSK_CLEAR              0x0000040
................................................................................
    for(i=0; i<p->nAttr; i++){
      blob_appendf(pOut, " %s", aAttribute[p->aAttr[i].iACode].zName);
      if( p->aAttr[i].zValue ){
        const char *zVal = p->aAttr[i].zValue;
        if( p->aAttr[i].iACode==ATTR_SRC && zVal[0]=='/' ){
          blob_appendf(pOut, "=\"%s%s\"", g.zBaseURL, zVal);
        }else{
          blob_appendf(pOut, "=\"%s\"", p->aAttr[i].zValue);
        }
      }
    }
    blob_append(pOut, ">", 1);
  }
}

................................................................................
static void wiki_render(Renderer *p, char *z){
  int tokenType;
  ParsedMarkup markup;
  int n;
  int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
  int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0;





  while( z[0] ){
    if( wikiUseHtml ){
      n = nextRawToken(z, p, &tokenType);
    }else{
      n = nextWikiToken(z, p, &tokenType);
    }
    p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







 







|







 







>
>
>
>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
...
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
....
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
*/
#define ATTR_ALIGN              1
#define ATTR_ALT                2
#define ATTR_BGCOLOR            3
#define ATTR_BORDER             4
#define ATTR_CELLPADDING        5
#define ATTR_CELLSPACING        6
#define ATTR_CLASS              7
#define ATTR_CLEAR              8
#define ATTR_COLOR              9
#define ATTR_COLSPAN            10
#define ATTR_COMPACT            11
#define ATTR_FACE               12
#define ATTR_HEIGHT             13
#define ATTR_HREF               14
#define ATTR_HSPACE             15
#define ATTR_ID                 16
#define ATTR_NAME               17
#define ATTR_ROWSPAN            18
#define ATTR_SIZE               19
#define ATTR_SRC                20
#define ATTR_START              21
#define ATTR_TYPE               22
#define ATTR_VALIGN             23
#define ATTR_VALUE              24
#define ATTR_VSPACE             25
#define ATTR_WIDTH              26
#define AMSK_ALIGN              0x0000001
#define AMSK_ALT                0x0000002
#define AMSK_BGCOLOR            0x0000004
#define AMSK_BORDER             0x0000008
#define AMSK_CELLPADDING        0x0000010
#define AMSK_CELLSPACING        0x0000020
#define AMSK_CLEAR              0x0000040
................................................................................
    for(i=0; i<p->nAttr; i++){
      blob_appendf(pOut, " %s", aAttribute[p->aAttr[i].iACode].zName);
      if( p->aAttr[i].zValue ){
        const char *zVal = p->aAttr[i].zValue;
        if( p->aAttr[i].iACode==ATTR_SRC && zVal[0]=='/' ){
          blob_appendf(pOut, "=\"%s%s\"", g.zBaseURL, zVal);
        }else{
          blob_appendf(pOut, "=\"%s\"", zVal);
        }
      }
    }
    blob_append(pOut, ">", 1);
  }
}

................................................................................
static void wiki_render(Renderer *p, char *z){
  int tokenType;
  ParsedMarkup markup;
  int n;
  int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
  int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0;

  /* Make sure the attribute constants and names still align
  ** following changes in the attribute list. */
  assert( strcmp(aAttribute[ATTR_WIDTH].zName, "width")==0 );

  while( z[0] ){
    if( wikiUseHtml ){
      n = nextRawToken(z, p, &tokenType);
    }else{
      n = nextWikiToken(z, p, &tokenType);
    }
    p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);