Skip to content

Commit 2b30081

Browse files
authored
fix verify markup polarity (#35)
* fix verify markup polarity * fix comments * standardize fileCheck line comments, add docs
1 parent 808f4f8 commit 2b30081

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

src/metamath.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,7 +2156,7 @@ void command(int argc, char *argv[]) {
21562156
writeBibliography(g_fullArg[2],
21572157
"*", /* labelMatch - all labels */
21582158
0, /* 1 = no output, just warning msgs if any */
2159-
1); /* 1 = check missing external files (gifs, bib, etc.) */
2159+
1); /* 1 = check external files (gifs and bib) */
21602160
continue;
21612161
} /* End of "WRITE BIBLIOGRAPHY" */
21622162

@@ -6382,23 +6382,18 @@ void command(int argc, char *argv[]) {
63826382
}
63836383

63846384
if (cmdMatches("VERIFY MARKUP")) {
6385-
i = (switchPos("/ DATE_SKIP") != 0) ? 1 : 0;
6386-
j = (switchPos("/ TOP_DATE_SKIP") != 0) ? 1 : 0;
6387-
k = (switchPos("/ FILE_SKIP") != 0) ? 1 : 0;
6388-
l = (switchPos("/ UNDERSCORE_SKIP") != 0) ? 1 : 0;
6389-
m = (switchPos("/ MATHBOX_SKIP") != 0) ? 1 : 0;
6390-
n = (switchPos("/ VERBOSE") != 0) ? 1 : 0;
6391-
if (i == 1 && j == 1) {
6392-
printf(
6393-
"?Only one of / DATE_SKIP and / TOP_DATE_SKIP may be specified.\n");
6394-
continue;
6395-
}
6385+
i = switchPos("/ DATE_SKIP") == 0;
6386+
j = switchPos("/ TOP_DATE_CHECK") != 0;
6387+
k = switchPos("/ FILE_CHECK") != 0;
6388+
l = switchPos("/ UNDERSCORE_SKIP") == 0;
6389+
m = switchPos("/ MATHBOX_SKIP") == 0;
6390+
n = switchPos("/ VERBOSE") != 0;
63966391
verifyMarkup(g_fullArg[2],
6397-
(flag)i, /* 1 = skip checking date consistency */
6398-
(flag)j, /* 1 = skip checking top date only */
6399-
(flag)k, /* 1 = skip checking external files GIF, mmset.html,... */
6400-
(flag)l, /* 1 = skip checking labels for underscores */
6401-
(flag)m, /* 1 = skip checking mathbox cross-references */
6392+
(flag)i, /* 1 = check date consistency */
6393+
(flag)j, /* 1 = check top date */
6394+
(flag)k, /* 1 = check external files (gifs and bib) */
6395+
(flag)l, /* 1 = check labels for underscores */
6396+
(flag)m, /* 1 = check mathbox cross-references */
64026397
(flag)n); /* 1 = verbose mode */
64036398
continue;
64046399
}

src/mmcmds.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4768,8 +4768,8 @@ void verifyProofs(vstring labelMatch, flag verifyFlag) {
47684768

47694769
void verifyMarkup(vstring labelMatch,
47704770
flag dateCheck, /* 1 = check date consistency */
4771-
flag topDateCheck, /* 1 = check top date but check others */
4772-
flag fileCheck, /* 1 = check external files (gifs, mmset.html,...) */
4771+
flag topDateCheck, /* 1 = check top date */
4772+
flag fileCheck, /* 1 = check external files (gifs and bib) */
47734773
flag underscoreCheck, /* 1 = check labels for "_" characters) */
47744774
flag mathboxCheck, /* 1 = check mathbox cross-references) */
47754775
flag verboseMode) /* 1 = more details */ {
@@ -5325,7 +5325,7 @@ void verifyMarkup(vstring labelMatch,
53255325
f = writeBibliography("mmbiblio.html",
53265326
labelMatch,
53275327
1, /* 1 = no output, just warning msgs if any */
5328-
fileCheck); /* 1 = check missing external files (gifs, bib, etc.) */
5328+
fileCheck); /* 1 = check external files (gifs and bib) */
53295329
if (f != 0) errFound = 1;
53305330

53315331
/* Check mathboxes for cross-references */

src/mmcmds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void verifyProofs(vstring labelMatch, flag verifyFlag);
8585

8686

8787
/* If checkFiles = 0, do not open external files.
88-
If checkFiles = 1, check mm*.html, presence of gifs, etc. */
88+
If checkFiles = 1, check for presence of gifs and biblio file */
8989
void verifyMarkup(vstring labelMatch, flag dateCheck, flag topDateCheck,
9090
flag fileCheck,
9191
flag underscoreCheck,

src/mmwtex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ flag printTexComment(vstring commentPtr, flag htmlCenterFlag,
16631663
(These new values were added instead of adding a new argument,
16641664
so as not to have to modify ~60 other calls to this function) */
16651665

1666-
flag fileCheck) /* 1 = check for missing external files (gifs, bib, etc.) */
1666+
flag fileCheck) /* 1 = check external files (gifs and bib) */
16671667
{
16681668
vstring cmtptr; /* Not allocated */
16691669
vstring srcptr; /* Not allocated */
@@ -5087,7 +5087,7 @@ vstring getTexOrHtmlHypAndAssertion(long statemNum) {
50875087
flag writeBibliography(vstring bibFile,
50885088
vstring labelMatch, /* Normally "*" except when called by verifyMarkup() */
50895089
flag errorsOnly, /* 1 = no output, just warning msgs if any */
5090-
flag fileCheck) /* 1 = check missing external files (mmbiblio.html) */
5090+
flag fileCheck) /* 1 = check external files (gifs and bib) */
50915091
{
50925092
flag errFlag;
50935093
FILE *list1_fp = NULL;

src/mmwtex.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ void eraseTexDefs(void); /* Undo readTexDefs() */
4646
/* TeX/HTML/ALT_HTML word-processor-specific routines */
4747
/* Returns 2 if there were severe parsing errors, 1 if there were warnings but
4848
no errors, 0 if no errors or warnings */
49+
/* The GIF check ensures that for every 'htmldef' definition containing
50+
`IMG SRC="bla.gif"`, `bla.gif` must exist. */
4951
flag readTexDefs(
5052
flag errorsOnly, /* 1 = supprees non-error messages */
5153
flag gifCheck /* 1 = check for missing GIFs */);
@@ -164,10 +166,14 @@ vstring getTexOrHtmlHypAndAssertion(long statemNum);
164166

165167
/* For WRITE BIBLIOGRAPHY command and error checking by VERIFY MARKUP */
166168
/* Returns 0 if OK, 1 if error or warning found */
169+
/* In addition to checking for GIFs (see readTexDefs()),
170+
the `fileCheck` flag controls whether to attempt to open and parse the
171+
`htmlbibliograhy` or `exthtmlbibliograhy` file to search for anchors,
172+
which can be used to verify the correctness of bibliography tags. */
167173
flag writeBibliography(vstring bibFile,
168174
vstring labelMatch, /* Normally "*" except by verifyMarkup() */
169175
flag errorsOnly, /* 1 = no output, just warning msgs if any */
170-
flag fileCheck); /* 1 = check missing external files (gifs, bib, etc.) */
176+
flag fileCheck); /* 1 = check external files (gifs and bib) */
171177

172178
/* Globals to hold mathbox information. They should be re-initialized
173179
by the ERASE command (eraseSource()). g_mathboxStmt = 0 indicates

0 commit comments

Comments
 (0)