Sub GetFile(file)
file = ProgDir & file
If FileExist (file) = true Then
FileOpen (c1,file,cRead ,, cASCII)
HtmStr = "<html><head><meta http-equiv=" & Chr(34) & "Content-Type" & Chr(34) & " content=" & Chr(34) & "text/html; charset=utf-8" & Chr(34) & ">" & crlf
HtmStr = HtmStr & "<title>homepage</title>" & crlf
HtmStr = HtmStr & "<link rel=" & Chr(34) & "stylesheet" & Chr(34) & " href=" & Chr(34) & "file:///" & ProgDir & "wikistyle.css" & Chr(34) & " Type=" & Chr(34) & "text/css" & Chr(34) & ">" & crlf
HtmStr = HtmStr & "</head><body>" & crlf
line = FileRead (c1)
Do Until line = EOF
If line <> EOF Then ' START PROCESSING LINE
For i = 0 To StrLength(line)-1
If i = 0 AND bullet = True Then ' CHECK TO SEE IF WE SHOULD END BULLET LIST
HtmStr = HtmStr & "</ul>"
bullet = False
End If
If i = 0 AND SubString(line, i, 2) = "++" Then ' START HEADER LEVEL 2
If header2 = False Then
header2 = True
HtmStr = HtmStr & "<h2><a name=" & Chr(43) & currentpage & Chr(34) & ">"
End If
Else If i = 0 AND SubString(line, 0, 1) = "+" Then ' START HEADER LEVER 1
If header1 = False Then
header1 = True
HtmStr = HtmStr & "<h1><a name=" & Chr(43) & currentpage & Chr(34) & ">"
End If
Else If i = 0 AND SubString(line, 0, 1) = "-" Then
If bullet = False Then ' START BULLET LIST
bullet = True
HtmStr = HtmStr & "<ul><li>"
Else ' CONTINUE BULLET
HtmStr = HtmStr & "<li>"
End If
Else
If i = 0 Then
HtmStr = HtmStr & "<p>" ' START PARAGRAPH
paragraph = True
End If
HtmStr = HtmStr & SubString(line, i, 1)
End If
Next ' FINNISHED LINE NOW TIDYUP BEFORE NEXT LINE
End If
If header1 = True Then ' CLOSE HEADER 1
header1 = False
HtmStr = HtmStr & "</a></h1>" & crlf
End If
If header2 = True Then ' CLOSE HEADER 2
header2 = False
HtmStr = HtmStr & "</a></h2>" & crlf
End If
If paragraph = True Then ' CLOSE PARAGRAPH
paragraph = False
HtmStr = HtmStr & "</p>"
End If
HtmStr = HtmStr & crlf ' ADD LINE FEED TO MAKE SOURCE CLEAN
line = FileRead (c1)
Loop
FileClose (c1)
Return HtmStr
End If
End Sub
Sub ReadWikiFile(file)
file = ProgDir & file
If FileExist (file) = true Then
FileOpen (c1, file, cRead ,, cASCII)
wiki = FileReadToEnd(c1)
FileClose (c1)
Return ParseWiki(wiki)
Else
' wiki file doesn't exist - how did that happen?
End If
End Sub
Sub ParseWiki (wiki)
'HTML Header
HtmStr = "<html><head><meta http-equiv=" & Chr(34) & "Content-Type" & Chr(34) & " content=" & Chr(34) & "text/html; charset=utf-8" & Chr(34) & ">" & crlf
HtmStr = HtmStr & "<title>homepage</title>" & crlf
HtmStr = HtmStr & "<link rel=" & Chr(34) & "stylesheet" & Chr(34) & " href=" & Chr(34) & "file:///" & ProgDir & "wikistyle.css" & Chr(34) & " Type=" & Chr(34) & "text/css" & Chr(34) & ">" & crlf
HtmStr = HtmStr & "</head><body>" & crlf
For x=0 To StrLength(wiki)
schr=SubString(wiki,x,1)
' Msgbox(schr)
' --- CONVERT SIMPLE SINGLE CHARACTERS ---
If schr=" " Then
HtmStr=HtmStr & " "
End If
If schr=Chr(13) Then
HtmStr=Htmstr & "<br>"
End If
' --- CONVERT LINK ---
Select schr
Case "["
'If schr="[" Then
If SubString(wiki,x+1,1)="[" Then ' this is reference with differnt text ie [[wiki][welcome to my wiki!]]
End If
y=StrIndexOf(wiki, "]", x)
'Msgbox(x & " " & y)
HtmStr=Htmstr & "<a href='" & SubString(wiki,x+1,y-x-1) & "'>" & SubString(wiki,x+1,y-x-1) & "</a>"
' Msgbox(SubString(wiki,x+1,y-x-1))
'Msgbox(htmstr)
x=y
'End If
Case Else
HtmStr=HtmStr & schr
End Select
Next
'HTML FOOTER
HtmStr=HtmStr & "</body></html>"
Return Htmstr
End Sub
HtmStr = HtmStr & "<link rel=" & Chr(34) & "stylesheet" & Chr(34) & " href=" & Chr(34) & "file:///" & ProgDir & "wikistyle.css" & Chr(34) & " Type=" & Chr(34) & "text/css" & Chr(34) & ">" & crlf
Damn
Ok we need to work on a way to communicate on who is doing what.
Tony
Tony,
I've tried everything I can think of - this works on my PC but I get an "invalid address" on the PDA. I've written and rewritten the web_navigating procedure and get the same results.
Is this working on your PDA?
Don
This URL is not properly formatted.
I'm afraid that as far as I am concerned you are pretty much on your own unless some other guy that knows about this HTML stuff (Alfcen?) can comment. The WebBrowser library has no logic in it, it merely exposes to B4ppc the WeBrowser properties and methods so what you are seeing is what the .NET WebBrowser control does. I know how to write code, I don't know how to write HTML and investigate the functionality of the WebBrowser.:sign0085:
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?