pdf documentation of qb64
#9
I hesitate to post this but @SMcNeill had posted something awhile ago about accessing the QB64 Wiki for a copy in case it went down, here is my copy and you will at the very least need to update the address but I found it helpful when I wanted to make a list of QB64 command words both underlined and not but no GL.

So this will help get contents and then you can mod as you see fit?

Code: (Select All)
Const SleepSet = 0 'to sleep between each keyword so we can see them and read them
Const SaveTo = "wiki.txt" '"SCRN:" to display to the screen, or insert a filename to save the list to disk

Screen _NewImage(1024, 720, 256)
Print "DOWNLOAD STARTING"
file$ = "QB64WikiList.txt"
'Increase the 2-second time limit here if you need to.
DownloadRSS "http://qb64.org/wiki/Keyword_Reference_-_Alphabetical", file$, 2
Print "DOWNLOAD FINISHED"
Print


Open file$ For Binary As #1
temp$ = Space$(LOF(1))
Get #1, , temp$
Close #1
l = 0
finish$ = "<div id=" + Chr$(34) + "symbols" + Chr$(34) + "></div>"
finish = InStr(temp$, finish$) 'No need to parse anything after we get down to the symbol section of the wiki page

Open SaveTo For Output As #1


Do
    l = InStr(l, temp$, "<li>")
    If l >= finish Then Exit Do
    If l Then
        l2 = InStr(l + 5, temp$, "</li>"): If l2 = 0 Then l2 = Len(temp$)
        work$ = Mid$(temp$, l + 4, l2 - l - 5)
        li1 = InStr(work$, Chr$(34)): li2 = InStr(li1 + 1, work$, Chr$(34))
        link$ = Mid$(work$, li1 + 1, li2 - li1 - 1)
        If InStr(link$, "&amp") Then link$ = "Page does not exist yet."
        link$ = StripCRLF(link$)
        k1 = InStr(li2 + 1, work$, ">"): k2 = InStr(k1 + 1, work$, "<")
        keyword$ = Mid$(work$, k1 + 1, k2 - k1 - 1)
        keyword$ = StripCRLF(keyword$)
        d = InStr(k2 + 1, work$, "<span"): d1 = InStr(d + 1, work$, ">"): d2 = InStr(d1 + 1, work$, "</span")
        desc$ = Mid$(work$, d1 + 1, d2 - d1 - 1)
        desc$ = StripCRLF(desc$)
        Print #1, keyword$
        Print #1, "         http://qb64.org"; link$
        Print #1, "         "; desc$
        If SleepSet Then Sleep
        l = l2 + 1
    End If
Loop Until l = 0
Close

Sleep
System


Sub DownloadRSS (url$, file$, timelimit)
    link$ = url$
    Dim l As _Integer64, lod As _Integer64

    url2$ = RTrim$(LTrim$(link$))
    url4$ = RTrim$(LTrim$(link$))
    If Left$(UCase$(url2$), 7) = "HTTP://" Then url4$ = Mid$(url2$, 8)
    x = InStr(url4$, "/")
    If x Then url2$ = Left$(url4$, x - 1)
    NewsClient = _OpenClient("TCP/IP:80:" + url2$)
    If NewsClient = 0 Then Exit Sub
    e$ = Chr$(13) + Chr$(10) ' end of line characters
    url3$ = Right$(url4$, Len(url4$) - x + 1)
    x$ = "GET " + url3$ + " HTTP/1.1" + e$
    x$ = x$ + "Host: " + url2$ + e$ + e$
    Put #NewsClient, , x$

    Open file$ For Output As #1: Close #1
    Open file$ For Binary As #1

    t! = Timer ' start time
    head$ = ""
    cont_type$ = ""
    Do
        _Limit 20
        Get #NewsClient, , a$
        If LTrim$(a$) > "" Then Put #1, , a$
    Loop Until Timer > t! + timelimit And timelimit > 0 ' (in seconds)
    Close #NewsClient
    Close #1
End Sub

Function StripCRLF$ (text$)
    'The wiki seems to contain stray CRLF characters at the dangest spots.
    'Why it has them, I don't know, but we need to filter them out so our information will load and display properly.
    li1 = 0
    Do
        li1 = InStr(li1 + 1, text$, Chr$(13) + Chr$(10))
        If li1 Then
            l$ = Left$(text$, li1 - 1)
            r$ = Mid$(text$, li1 + 2)
            text$ = l$ + r$
        End If
    Loop Until li1 = 0

    'Also some of the descriptions and such contain links to different keywords.
    'We want to just strip those links and use a normal word replacement for ease of display, since we're not going to be displaying in
    'an html editor/viewer.

    li1 = 0
    Do
        li1 = InStr(li1 + 1, text$, "<a href")
        If li1 Then
            li2 = InStr(li1 + 1, text$, "</a>")
            li3 = InStr(li1 + 1, text$, ">")
            l$ = Left$(text$, li1 - 1)
            m$ = Mid$(text$, li3 + 1, li2 - li3 - 1)
            r$ = Mid$(text$, li2 + 4)
            text$ = l$ + m$ + r$
        End If
    Loop Until li1 = 0

    StripCRLF$ = text$
End Function
Reply


Messages In This Thread
pdf documentation of qb64 - by Coolman - 04-28-2022, 07:25 PM
RE: pdf documentation of qb64 - by Jack - 04-28-2022, 08:15 PM
RE: pdf documentation of qb64 - by Coolman - 04-29-2022, 11:24 AM
RE: pdf documentation of qb64 - by euklides - 04-29-2022, 06:33 AM
RE: pdf documentation of qb64 - by Coolman - 04-29-2022, 08:48 AM
RE: pdf documentation of qb64 - by Jack - 04-29-2022, 12:01 PM
RE: pdf documentation of qb64 - by Coolman - 04-29-2022, 12:30 PM
RE: pdf documentation of qb64 - by Coolman - 04-29-2022, 02:48 PM
RE: pdf documentation of qb64 - by bplus - 04-29-2022, 05:33 PM
RE: pdf documentation of qb64 - by Coolman - 04-29-2022, 06:54 PM
RE: pdf documentation of qb64 - by Pete - 04-29-2022, 06:16 PM
RE: pdf documentation of qb64 - by bplus - 04-29-2022, 06:24 PM
RE: pdf documentation of qb64 - by CharlieJV - 04-30-2022, 06:20 PM
RE: pdf documentation of qb64 - by Pete - 04-29-2022, 07:08 PM
RE: pdf documentation of qb64 - by bplus - 04-29-2022, 07:34 PM
RE: pdf documentation of qb64 - by Coolman - 04-29-2022, 09:59 PM
RE: pdf documentation of qb64 - by SMcNeill - 04-29-2022, 10:08 PM
RE: pdf documentation of qb64 - by Coolman - 04-29-2022, 11:19 PM
RE: pdf documentation of qb64 - by Coolman - 04-30-2022, 12:02 PM
RE: pdf documentation of qb64 - by bplus - 04-30-2022, 05:59 PM
RE: pdf documentation of qb64 - by Coolman - 05-01-2022, 09:04 AM
RE: pdf documentation of qb64 - by bplus - 05-01-2022, 04:41 PM
RE: pdf documentation of qb64 - by Coolman - 05-01-2022, 08:24 PM
RE: pdf documentation of qb64 - by Coolman - 05-04-2022, 02:00 PM
RE: pdf documentation of qb64 - by euklides - 05-04-2022, 02:44 PM



Users browsing this thread: 10 Guest(s)