~vcs-imports-ii/gnubg/trunk

« back to all changes in this revision

Viewing changes to html.c

  • Committer: plm
  • Date: 2017-05-25 20:29:46 UTC
  • Revision ID: plm-20170525202946-xqef6xdzeknewk7r
Remove superfluous spaces in HTML output

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * along with this program; if not, write to the Free Software
17
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 *
19
 
 * $Id: html.c,v 1.242 2017/04/04 04:50:39 plm Exp $
 
19
 * $Id: html.c,v 1.243 2017/05/25 20:29:46 plm Exp $
20
20
 */
21
21
 
22
22
#include "config.h"
163
163
 
164
164
        fputs("\n"
165
165
              "/* CSS Stylesheet for " VERSION_STRING " */\n"
166
 
              "/* $Id: html.c,v 1.242 2017/04/04 04:50:39 plm Exp $ */\n", pf);
 
166
              "/* $Id: html.c,v 1.243 2017/05/25 20:29:46 plm Exp $ */\n", pf);
167
167
 
168
168
    fputs("/* This file is distributed as a part of the "
169
169
          "GNU Backgammon program. */\n"
417
417
                const htmlexportcss hecss, const htmlexporttype het, const stylesheetclass ssc)
418
418
{
419
419
 
420
 
    fprintf(pf, "<img src=\"%s%s%s.%s\" %s alt=\"%s\" />",
 
420
    fprintf(pf, "<img src=\"%s%s%s.%s\" %s alt=\"%s\"/>",
421
421
            (szImageDir) ? szImageDir : "",
422
422
            (!szImageDir || szImageDir[strlen(szImageDir) - 1] == '/') ? "" : "/",
423
423
            szImage, szExtension,
537
537
 
538
538
    printImageClass(pf, szImageDir, fTurn ? "n_high" : "n_low",
539
539
                    szExtension, NULL, hecss, HTML_EXPORT_TYPE_BBS, CLASS_BOARD_IMG_HEADER);
540
 
    fputs("<br />\n", pf);
 
540
    fputs("<br/>\n", pf);
541
541
 
542
542
    /* chequers off */
543
543
 
567
567
    } else
568
568
        printImageClass(pf, szImageDir, "c_up_0", szExtension, NULL, hecss, HTML_EXPORT_TYPE_BBS, CLASS_BOARD_IMG);
569
569
 
570
 
    fputs("<br />\n", pf);
 
570
    fputs("<br/>\n", pf);
571
571
 
572
572
    /* end of first row */
573
573
 
596
596
    else
597
597
        printImageClass(pf, szImageDir, "c_blank", szExtension, NULL, hecss, HTML_EXPORT_TYPE_BBS, CLASS_BOARD_IMG);
598
598
 
599
 
    fputs("<br />\n", pf);
 
599
    fputs("<br/>\n", pf);
600
600
 
601
601
    /* end of center row */
602
602
 
632
632
    } else
633
633
        printImageClass(pf, szImageDir, "c_dn_0", szExtension, NULL, hecss, HTML_EXPORT_TYPE_BBS, CLASS_BOARD_IMG);
634
634
 
635
 
    fputs("<br />\n", pf);
 
635
    fputs("<br/>\n", pf);
636
636
 
637
637
    /* point numbers */
638
638
 
654
654
 
655
655
    fprintf(pf, "<span %s>", GetStyle(CLASS_POSITIONID, hecss));
656
656
 
657
 
    fprintf(pf, "%s <tt>%s</tt> %s <tt>%s</tt><br /></span></td></tr></table>\n",
 
657
    fprintf(pf, "%s <tt>%s</tt> %s <tt>%s</tt><br/></span></td></tr></table>\n",
658
658
            _("Position ID:"), PositionID((ConstTanBoard) pms->anBoard), _("Match ID:"), MatchIDFromMatchState(pms));
659
659
 
660
660
}
741
741
    printImage(pf, szImageDir, sz, szExtension,
742
742
               fTurn ? "+-13-14-15-16-17-18-+---+-19-20-21-22-23-24-+" :
743
743
               "+-12-11-10--9--8--7-+---+--6--5--4--3--2--1-+", hecss, HTML_EXPORT_TYPE_FIBS2HTML);
744
 
    fprintf(pf, "<br />\n");
 
744
    fprintf(pf, "<br/>\n");
745
745
 
746
746
    /* cube image */
747
747
 
813
813
 
814
814
    printImage(pf, szImageDir, "b-right", szExtension, "|", hecss, HTML_EXPORT_TYPE_FIBS2HTML);
815
815
 
816
 
    fprintf(pf, "<br />\n");
 
816
    fprintf(pf, "<br/>\n");
817
817
 
818
818
    /* center of board */
819
819
 
843
843
                   "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", hecss, HTML_EXPORT_TYPE_FIBS2HTML);
844
844
        printImage(pf, szImageDir, "b-midr", szExtension, "|", hecss, HTML_EXPORT_TYPE_FIBS2HTML);
845
845
 
846
 
        fprintf(pf, "<br />\n");
 
846
        fprintf(pf, "<br/>\n");
847
847
 
848
848
    } else {
849
849
 
862
862
                   "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", hecss, HTML_EXPORT_TYPE_FIBS2HTML);
863
863
        printImage(pf, szImageDir, "b-midr", szExtension, "|", hecss, HTML_EXPORT_TYPE_FIBS2HTML);
864
864
 
865
 
        fprintf(pf, "<br />\n");
 
865
        fprintf(pf, "<br/>\n");
866
866
 
867
867
    }
868
868
 
933
933
    /* right border */
934
934
 
935
935
    printImage(pf, szImageDir, "b-right", szExtension, "|", hecss, HTML_EXPORT_TYPE_FIBS2HTML);
936
 
    fprintf(pf, "<br />\n");
 
936
    fprintf(pf, "<br/>\n");
937
937
 
938
938
    /* bottom */
939
939
 
945
945
               fTurn ?
946
946
               "+-12-11-10--9--8--7-+---+--6--5--4--3--2--1-+" :
947
947
               "+-13-14-15-16-17-18-+---+-19-20-21-22-23-24-+", hecss, HTML_EXPORT_TYPE_FIBS2HTML);
948
 
    fprintf(pf, "<br />\n");
 
948
    fprintf(pf, "<br/>\n");
949
949
 
950
950
    /* pip counts */
951
951
 
952
952
    printImage(pf, szImageDir, "b-indent", szExtension, "", hecss, HTML_EXPORT_TYPE_FIBS2HTML);
953
953
 
954
954
    PipCount((ConstTanBoard) anBoard, anPips);
955
 
    fprintf(pf, _("Pip counts: %s %u, %s %u<br />\n"), ap[0].szName, anPips[1], ap[1].szName, anPips[0]);
 
955
    fprintf(pf, _("Pip counts: %s %u, %s %u<br/>\n"), ap[0].szName, anPips[1], ap[1].szName, anPips[0]);
956
956
 
957
957
    /* position ID */
958
958
 
959
959
    printImage(pf, szImageDir, "b-indent", szExtension, "", hecss, HTML_EXPORT_TYPE_FIBS2HTML);
960
960
    fprintf(pf, "<span %s>", GetStyle(CLASS_POSITIONID, hecss));
961
961
 
962
 
    fprintf(pf, _("Position ID: <tt>%s</tt> Match ID: <tt>%s</tt><br />\n"),
 
962
    fprintf(pf, _("Position ID: <tt>%s</tt> Match ID: <tt>%s</tt><br/>\n"),
963
963
            PositionID((ConstTanBoard) pms->anBoard), MatchIDFromMatchState(pms));
964
964
 
965
965
    fprintf(pf, "</span>");
1374
1374
    fputs("<p>", pf);
1375
1375
 
1376
1376
    PipCount((ConstTanBoard) anBoard, anPips);
1377
 
    fprintf(pf, _("Pip counts: %s %u, %s %u<br />\n"), ap[0].szName, anPips[1], ap[1].szName, anPips[0]);
 
1377
    fprintf(pf, _("Pip counts: %s %u, %s %u<br/>\n"), ap[0].szName, anPips[1], ap[1].szName, anPips[0]);
1378
1378
 
1379
1379
    /* position ID */
1380
1380
 
1381
1381
    fprintf(pf, "<span %s>", GetStyle(CLASS_POSITIONID, hecss));
1382
1382
 
1383
 
    fprintf(pf, _("Position ID: <tt>%s</tt> Match ID: <tt>%s</tt><br />\n"),
 
1383
    fprintf(pf, _("Position ID: <tt>%s</tt> Match ID: <tt>%s</tt><br/>\n"),
1384
1384
            PositionID((ConstTanBoard) pms->anBoard), MatchIDFromMatchState(pms));
1385
1385
 
1386
1386
    fprintf(pf, "</span>");
1436
1436
    fputs("\n<!-- Header -->\n\n", pf);
1437
1437
 
1438
1438
    if (fHR)
1439
 
        fputs("<hr />\n", pf);
 
1439
        fputs("<hr/>\n", pf);
1440
1440
 
1441
1441
    fputs("<p>", pf);
1442
1442
 
1519
1519
            "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" "
1520
1520
            "lang=\"en\">\n"
1521
1521
            "<head>\n"
1522
 
            "<meta name=\"generator\" content=\"%s\" />\n"
 
1522
            "<meta name=\"generator\" content=\"%s\"/>\n"
1523
1523
            "<meta http-equiv=\"Content-Type\" "
1524
 
            "content=\"text/html; charset=%s\" />\n"
1525
 
            "<meta name=\"keywords\" content=\"%s, %s, %s\" />\n"
 
1524
            "content=\"text/html; charset=%s\"/>\n"
 
1525
            "<meta name=\"keywords\" content=\"%s, %s, %s\"/>\n"
1526
1526
            "<meta name=\"description\" "
1527
1527
            "content=\"",
1528
1528
            VERSION_STRING,
1530
1530
 
1531
1531
    fprintf(pf, _("%s (analysed by %s)"), szTitle, VERSION_STRING);
1532
1532
 
1533
 
    fprintf(pf, "\" />\n" "<title>%s</title>\n", szTitle);
 
1533
    fprintf(pf, "\"/>\n" "<title>%s</title>\n", szTitle);
1534
1534
 
1535
1535
    if (hecss == HTML_EXPORT_CSS_HEAD)
1536
1536
        WriteStyleSheet(pf, hecss);
1537
1537
    else if (hecss == HTML_EXPORT_CSS_EXTERNAL)
1538
 
        fputs("<link title=\"CSS stylesheet\" rel=\"stylesheet\" " "href=\"gnubg.css\" type=\"text/css\" />\n", pf);
 
1538
        fputs("<link title=\"CSS stylesheet\" rel=\"stylesheet\" " "href=\"gnubg.css\" type=\"text/css\"/>\n", pf);
1539
1539
 
1540
1540
    fprintf(pf, "</head>\n" "\n" "<body %s>\n" "<h1>", GetStyle(CLASS_FONT_FAMILY, hecss));
1541
1541
 
1550
1550
    for (i = 0; i < 4; i++)
1551
1551
        if (aszLinks && aszLinks[i]) {
1552
1552
            if (fFirst) {
1553
 
                fprintf(pf, "<hr />\n");
 
1553
                fprintf(pf, "<hr/>\n");
1554
1554
                fputs("<p>\n", pf);
1555
1555
                fFirst = FALSE;
1556
1556
            }
1580
1580
    int fFirst;
1581
1581
    int i;
1582
1582
 
1583
 
    const char szVersion[] = "$Revision: 1.242 $";
 
1583
    const char szVersion[] = "$Revision: 1.243 $";
1584
1584
    int iMajor, iMinor;
1585
1585
 
1586
1586
    iMajor = atoi(strchr(szVersion, ' '));
1595
1595
    for (i = 0; i < 4; i++)
1596
1596
        if (aszLinks && aszLinks[i]) {
1597
1597
            if (fFirst) {
1598
 
                fprintf(pf, "<hr />\n");
 
1598
                fprintf(pf, "<hr/>\n");
1599
1599
                fputs("<p>\n", pf);
1600
1600
                fFirst = FALSE;
1601
1601
            }
1608
1608
 
1609
1609
    time(&t);
1610
1610
 
1611
 
    fputs("<hr />\n" "<address>", pf);
 
1611
    fputs("<hr/>\n" "<address>", pf);
1612
1612
 
1613
1613
    fprintf(pf,
1614
1614
            _("Output generated %s by "
1624
1624
            "<a href=\"http://validator.w3.org/check?uri=referer\">"
1625
1625
            "<img style=\"border:0;width:88px;height:31px\" "
1626
1626
            "src=\"http://www.w3.org/Icons/valid-xhtml10\" "
1627
 
            "alt=\"%s\" /></a>\n"
 
1627
            "alt=\"%s\"/></a>\n"
1628
1628
            "<a href=\"http://jigsaw.w3.org/css-validator/check/referer\">"
1629
1629
            "<img style=\"border:0;width=88px;height:31px\" "
1630
1630
            "src=\"http://jigsaw.w3.org/css-validator/images/vcss\" "
1631
 
            "alt=\"%s\" />" "</a>\n" "</p>\n" "</body>\n" "</html>\n", _("Valid XHTML 1.0 Strict!"), _("Valid CSS!"));
 
1631
            "alt=\"%s\"/>" "</a>\n" "</p>\n" "</body>\n" "</html>\n", _("Valid XHTML 1.0 Strict!"), _("Valid CSS!"));
1632
1632
 
1633
1633
 
1634
1634
}
1650
1650
 
1651
1651
    time_t t;
1652
1652
 
1653
 
    const char szVersion[] = "$Revision: 1.242 $";
 
1653
    const char szVersion[] = "$Revision: 1.243 $";
1654
1654
    int iMajor, iMinor;
1655
1655
    char *pc;
1656
1656
 
2598
2598
        while (*sz) {
2599
2599
 
2600
2600
            if (*sz == '\n')
2601
 
                fputs("<br />\n", pf);
 
2601
                fputs("<br/>\n", pf);
2602
2602
            else
2603
2603
                fputc(*sz, pf);
2604
2604
 
2633
2633
    ppch = g_strsplit(sz, "\n", -1);
2634
2634
    for (i = 0; (pchToken = ppch[i]); ++i) {
2635
2635
        if (i)
2636
 
            fputs("<br />\n", pf);
 
2636
            fputs("<br/>\n", pf);
2637
2637
        fputs(pchToken, pf);
2638
2638
    }
2639
2639
 
2659
2659
 
2660
2660
    fputs("\n<!-- Match Information -->\n\n", pf);
2661
2661
 
2662
 
    fputs("<hr />", pf);
 
2662
    fputs("<hr/>", pf);
2663
2663
 
2664
2664
    fprintf(pf, "<h2>%s</h2>\n", _("Match Information"));
2665
2665
 
2836
2836
        /* match statistics */
2837
2837
        header = ms.nMatchTo ? _("Match statistics") : _("Session statistics");
2838
2838
 
2839
 
        fprintf(pf, "<hr />\n");
 
2839
        fprintf(pf, "<hr/>\n");
2840
2840
        HTMLDumpStatcontext(pf, &scTotal, msOrig.nMatchTo, -1, hecss, header);
2841
2841
        psc_rel = relational_player_stats_get(ap[0].szName, ap[1].szName);
2842
2842
        if (psc_rel) {