New topic: Stylerun to Mediawiki
<http://forums.realsoftware.com/viewtopic.php?t=38015> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message aamato Post subject: Stylerun to MediawikiPosted: Wed Mar 09, 2011 8:13 am Joined: Tue Feb 12, 2008 6:12 pm Posts: 13 I am trying to modify StyledTextToHtml from Adam Ernst to create a MediaWiki formatting. It should be very easy, as I should only change the bold and italic tags Anyway, I did that, But I noticed bold stylerun is not being recognized, even in unmodified StyledTextToHtml. Is it a bug? Anyone having the same problem ? I am currently using the last Realstudio version. (2011 release 1) This is my current modified code: Code: dim sr, last as StyleRun dim lc,theCount as integer, needFontTag, lastWasInFontTag as boolean dim s1, s2 as string if sd is nil then return "" last = new StyleRun // the use of theCount avoid sr.StyleRunCount to be evaluated at each loop theCount = sd.StyleRunCount-1 for lc = 0 to theCount sr = sd.StyleRun(lc) // Here s1 is used to avoid s2 to be copied each time a line like // s2 = s2 + aString // is encountered. // The bigger theString, the longer the time to copy it. s1 = "" if lastWasInFontTag then needFontTag = not(StyleRunsIdentical(sr, last, true)) else needFontTag = sr.Font <> "" or (sr.Size <> 12 and sr.Size <> 13) or not(colorsEqual(sr.TextColor, &c000000)) end if if needFontTag then if last.Underline then s1 = s1 + "</u>" if last.Italic then s1 = s1 + "''" if last.Bold then s1 = s1 + "'''" ''if lastWasInFontTag then s1 = s1 + "</font>" if sr.Font <> "" or (sr.Size <> 12 and sr.Size <> 13) or not(ColorsEqual(sr.TextColor, &c000000)) then 's1 = s1 + "<font" 'if sr.Font <> "" then s1 = s1 + " face='"+sr.Font+"'" 'if sr.Size <> 12 and sr.Size <> 13 then s1 = s1 + " size='"+str(PointsToHTMLSize(sr.Size))+"'" 'if not colorsEqual(sr.TextColor, &c000000) then s1 = s1 + " color='#"+colorToString(sr.TextColor)+"'" 's1 = s1 + ">" lastWasInFontTag = true else lastWasInFontTag = false end if if sr.italic then s1 = s1 + "''" 'msgbox "italico" end if if sr.underline then s1 = s1 + "<u>" if sr.bold then s1 = s1 + "'''" 'msgbox "bold" end if else if not(sr.Underline) and last.Underline then s1 = s1 + "</u>" if not(sr.Italic) and last.Italic then s1 = s1 + "''" if not(sr.Bold) and last.Bold then s1 = s1 + "'''" if sr.Bold and not(last.Bold) then s1 = s1 + "'''" if sr.italic and not(last.Italic) then s1 = s1 + "''" if sr.underline and not(last.Underline) then s1 = s1 + "<u>" end if last = sr // Here is the only time s2 is copied s2 = s2 + s1 + sr.text' HTMLEscape(sr.Text) next s1 = "" if last.Underline then s1 = s1 + "</u>" if last.Italic then s1 = s1 + "''" if last.Bold then s1 = s1 + "'''" 'if lastWasInFontTag then s1 = s1 + "</font>" return s2 + s1 Thanks for any help in advance Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
