• MakeHTML

    From Nick Andre@1:229/426 to All on Sun Feb 20 16:43:40 2022
    I had a need to do a quick-n-dirty export of a directory of files into a raw HTML table output.

    The idea is that you have a header file and a footer. You run this to create the body, then bring it all together via COPY HEADER.HTM + MAKEHTML.HTM + FOOTER.HTM SOMESITE.HTM

    If Files.bbs exists in the directory, it will read it for one-liner descriptions.

    If the file MAKEHTML.--- exists, it will instead read the contents of this file for generating the table. This is so you can sort the results, ie. DIR
    /B /O:-D DB\FILEECHO\NODEDIFF > MAKEHTML.---

    The results can be seen at https://fido-z1.darkrealms.ca

    Enjoy...

    program makehtml;
    uses sysutils,dos;

    var p,w : string;
    dirinfo : SearchRec;
    ft : tdatetime;
    h,t,t2 : text;
    const df = 'mm"/"dd"/"yyyy';

    procedure make_html(what : string ; ts : longint);
    var d,ds : string;
    begin
    d:='';
    assign(t,p+'files.bbs');
    (*$I-*) reset(t);
    if ioresult=0 then
    begin
    while not eof(t) and (d='') do
    begin
    readln(t,w);
    if (pos(uppercase(what),w)>0) then d:=copy(w,length(what)+2,length(w));
    end;
    close(t);
    end;
    if (uppercase(paramstr(4))<>'N') and (uppercase(what)<>'FILES.BBS') then
    begin
    ft:=FileDateToDateTime(ts);ds:=FormatDateTime(df,ft);
    writeln(h,'<tr><td><a href='+paramstr(3)+what+'>'+what+'</a></td><td>'+ds+'</td><td>'+d+'</td></tr>' );
    writeln('Adding '+what+' '+ds+' '+d);
    end;
    end;

    begin
    writeln('MakeHTML 1.0/Win32 Copyright (c) by Nick J. Andre, Ltd.');
    writeln;
    if (paramstr(1)>'') and (paramstr(2)>'') and (paramstr(3)>'') then
    begin
    p:=paramstr(2);if p[length(p)]<>'\' then p:=p+'\';
    assign(h,paramstr(1));
    (*$I-*) rewrite(h);
    writeln(h,'<th>File</th><th>Date</th><th>Description</th>');
    assign(t2,'makehtml.---');
    (*$I-*) reset(t2);
    if ioresult=0 then
    begin
    while not eof(t2) do
    begin
    readln(t2,w);
    findfirst(p+w,archive,dirinfo);
    if DOSerror=0 then make_html(dirinfo.name,dirinfo.time);
    findclose(dirinfo);
    end;
    close(t2);
    end
    else
    begin
    findfirst(p+'*.*',archive,dirinfo);
    if DOSerror=0 then make_html(dirinfo.name,dirinfo.time);
    while (DOSerror=0) do
    begin
    findnext(dirinfo);
    make_html(dirinfo.name,dirinfo.time);
    end;
    findclose(dirinfo);
    end;
    writeln(h,'</table>');close(h);
    end
    else
    begin
    writeln('Usage: MAKEHTML [Html table file] [Path] [Base] [BBS]');writeln;
    writeln('MAKEHTML creates an HTML table from files in Path using Base.');
    writeln('Optional BBS means include listing files.bbs, [Y]es or [N]o.');
    end;
    end.

    Nick

    --- Renegade vY2Ka2
    * Origin: Joey, do you like movies about gladiators? (1:229/426)
  • From T.J. Mcmillen@1:129/305 to Nick Andre on Sun Feb 20 17:24:30 2022
    const df = 'mm"/"dd"/"yyyy';
    ^^^^^^^^^^^^^^^^

    God Bless you for this! ;) Aren't you missing the " before and after the date tho?

    end.

    END. ;)

    ... WOMEN-Wierd Obnoxious Male Enticing Nymphs

    --- Renegade v1.30r1/Exp
    * Origin: The Titantic BBS Telnet - ttb.rgbbs.info (1:129/305)
  • From Nick Andre@1:229/426 to T.J. Mcmillen on Sun Feb 20 18:00:57 2022
    On 20 Feb 22 17:24:30, T.J. Mcmillen said the following to Nick Andre:

    const df = 'mm"/"dd"/"yyyy';
    ^^^^^^^^^^^^^^^^

    God Bless you for this! ;) Aren't you missing the " before and after the date tho?

    Nope.

    END. ;)

    THE end.

    Nick

    --- Renegade vY2Ka2
    * Origin: Joey, do you like movies about gladiators? (1:229/426)
  • From mark lewis@1:3634/12.73 to T.J. Mcmillen on Mon Feb 21 04:15:52 2022

    On 2022 Feb 20 17:24:30, you wrote to Nick Andre:

    const df = 'mm"/"dd"/"yyyy';
    ^^^^^^^^^^^^^^^^

    God Bless you for this! ;) Aren't you missing the " before and after the
    date tho?

    no, he's not... if he were to use " instead of ', there'd be quite many more " in use in that line...

    )\/(ark

    "The soul of a small kitten in the body of a mighty dragon. Look on my majesty, ye mighty, and despair! Or bring me catnip. Your choice. Oooh, a shiny thing!"
    ... Waiter! Another round for my friends here!
    ---
    * Origin: (1:3634/12.73)
  • From Nick Andre@1:229/426 to Mark Lewis on Mon Feb 21 08:46:51 2022
    On 21 Feb 22 04:15:52, Mark Lewis said the following to T.J. Mcmillen:

    no, he's not... if he were to use " instead of ', there'd be quite many mor in use in that line...

    There is only one quote master and I'm replying to him. :)

    Nick

    --- Renegade vY2Ka2
    * Origin: Joey, do you like movies about gladiators? (1:229/426)
  • From mark lewis@1:3634/12.73 to Nick Andre on Mon Feb 21 16:53:24 2022

    On 2022 Feb 21 08:46:50, you wrote to me:

    no, he's not... if he were to use " instead of ', there'd be quite
    many mor in use in that line...

    There is only one quote master and I'm replying to him. :)

    :)

    )\/(ark

    "The soul of a small kitten in the body of a mighty dragon. Look on my majesty, ye mighty, and despair! Or bring me catnip. Your choice. Oooh, a shiny thing!"
    ... Facts are stubborn little bastards. Be careful with them.
    ---
    * Origin: (1:3634/12.73)
  • From T.J. Mcmillen@1:129/305 to Mark Lewis on Mon Feb 21 16:11:11 2022
    const df = 'mm"/"dd"/"yyyy';
    ^^^^^^^^^^^^^^^^

    God Bless you for this! ;) Aren't you missing the " before and aft
    the
    date tho?

    no, he's not... if he were to use " instead of ', there'd be quite many mo in use in that line...

    I noticed that after I posted it. I was just so excite to see the date in the correct format. ;)

    ... So many books, so little time.

    --- Renegade v1.30r1/Exp
    * Origin: The Titantic BBS Telnet - ttb.rgbbs.info (1:129/305)
  • From mark lewis@1:3634/12.73 to T.J. Mcmillen on Tue Feb 22 07:51:28 2022

    On 2022 Feb 21 16:11:10, you wrote to me:

    no, he's not... if he were to use " instead of ', there'd be quite
    many mo in use in that line...

    I noticed that after I posted it.

    :)

    I was just so excite to see the date in the correct format. ;)

    i think some would disagree with you on that ;)

    eg: YYYYMMDD FTW and properly sortable in its natural state ;)

    )\/(ark

    "The soul of a small kitten in the body of a mighty dragon. Look on my majesty, ye mighty, and despair! Or bring me catnip. Your choice. Oooh, a shiny thing!"
    ... Are you sure that Grape Nuts isn't a social disease???
    ---
    * Origin: (1:3634/12.73)