![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Open Source Projects The place to discuss Basic4ppc open source applications. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I have started creating a Personal Wiki.
I decided to post it here under Open Source so all can use this program if they wish, but PLEASE post any improvements you make here. Goals
This program is really coming along now. Thanks to Digitaldon37 and Klaus for there help. Thanks to agraham for his Web Browser. I use this wiki for everything now. I organise my work documentation, instructions sheets, Product pictures and descriptions. Have Birthday lists, XMas card lists, Bank details. It is great for gathering all you info in one place. I have bucked what seems to be the standard and included all library files in the zip. I just think its easier. Regards Tony Steward Last Updated 6:00pm 5th Jan 2009 Attachment includes both PPC and Desktop versions. You will need to add "System.Data.SQLite.dll" its not in the zip because its too large Last edited by tsteward : 02-13-2009 at 11:39 AM. |
|
|||
|
Version 1 Realeased
![]() Known Bugs:
Last edited by tsteward : 01-05-2009 at 06:49 AM. |
|
|||
|
Struggling with the interpreter for reading in bladewiki files, but getting there slowly.
Currently I load a line from the file then process that line character by character to find the markup. + = <h1> Header Level 1 ++ = <h2> Header Level 2 - = <li> list item [ = Start of link to another file ] = end of link to another file There is more but that's enough for now. Here is my interpreter so far. Code:
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
|
|
|||
|
Hi Tony,
I noticed that you are reading the wiki file one line at a time. There are some pros and cons to that, but my opinion is that you may want to read the whole file at once and then parse. The reason is that you don't have to write the wiki text with the closing tags all on one line. I created two new procedures that you may want to look at Read File Code:
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 Code:
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 Last edited by digitaldon37 : 08-01-2008 at 06:24 PM. |
|
|||
|
Yes I agree reading the whole file at once would be better and generally speeds up programs and is usually less drain on resources.
Thanks for that code suggestion I'll look at it. It seems less confusing than what I did. |
|
|||
|
Damn
Ok we need to work on a way to communicate on who is doing what. I have a version working beautifully on my desktop but not running on ppc. I haven't looked at your code above yet but will do so. Have to go out for the day will do more tonight. about 6 hrs time Thanks Tony This is where I was up to (your changes not included yet) |
|
|||
|
Ok the error causing PPPCWiki not to run on ppc is:
Code:
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 ![]() Its around line 56, just comment it out and all is fine but of course the css won't be working. |
|
||||
|
Quote:
I havent search for one, but i'm sure that they are available, and mos surelly, for free too...
__________________
Paulo Gomes Porto, Portugal "The Past is nothing more than the constructions of a Present that was once called Future" Desktop PC: Currently NONE Mobile Device: QTEK S200, WinMo 6.5 Laptop: Toshiba NB100-130 DLL Version Listing |
|
||||
|
__________________
Paulo Gomes Porto, Portugal "The Past is nothing more than the constructions of a Present that was once called Future" Desktop PC: Currently NONE Mobile Device: QTEK S200, WinMo 6.5 Laptop: Toshiba NB100-130 DLL Version Listing |
|
|||
|
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 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Another Pocket Wiki | digitaldon37 | Open Source Projects | 4 | 12-30-2009 03:12 AM |
| Written a Personal Wiki? | tsteward | Questions & Help Needed | 3 | 08-01-2008 05:34 AM |
| Pocket Chess Database | JamesC | Share Your Creations | 3 | 07-27-2008 05:07 AM |
| B4P Wiki | meinewelle | Questions & Help Needed | 5 | 05-30-2008 07:55 AM |
| print class for pocket pc | tanrikuluahmet | Basic4ppc Wishlist | 1 | 10-01-2007 10:10 AM |