Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Tools/MarkDown/MarkDown Test
Function:
Required plugins for this example: MBS Tools Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Tools/MarkDown/MarkDown Test
This example is the version from Tue, 13th Apr 2015.
Project "MarkDown Test.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control TabPanel1 Inherits TabPanel
ControlInstance TabPanel1 Inherits TabPanel
End Control
Control HTMLViewer1 Inherits HTMLViewer
ControlInstance HTMLViewer1 Inherits HTMLViewer
End Control
Control Result Inherits TextArea
ControlInstance Result Inherits TextArea
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub ExpandRow(row As Integer) dim v as Variant = me.RowTag(row) Add v End EventHandler
End Control
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() run End EventHandler
End Control
Sub Add(v as Variant) if v isa MarkdownFootnoteMBS then dim f as MarkdownFootnoteMBS List.AddRow "Flags", str(f.Flags) List.AddRow "Height", str(f.Height) List.AddRow "Link", f.Link List.AddRow "RefNumber", str(f.RefNumber) List.AddRow "Tag", f.Tag List.AddRow "Title", f.Title List.AddRow "Width", str(f.Width) elseif v isa MarkdownLineMBS then dim l as MarkdownLineMBS = v List.AddRow "Count", str(l.Count) List.AddRow "DLE", str(l.DLE) List.AddRow "Flags", str(l.Flags) List.AddRow "Kind", str(l.Kind) List.AddFolder "NextLine", l.NextLine List.AddRow "Text", l.Text elseif v isa MarkdownParagraphMBS then dim p as MarkdownParagraphMBS = v List.AddRow "Align", str(p.Align) List.AddFolder "Down",p.Down List.AddRow "hNumber", str(p.hNumber) List.AddRow "Ident", p.Ident List.AddFolder "NextParagraph", p.NextParagraph List.AddFolder "Text", p.Text List.AddRow "Typ", str(p.Typ) elseif v isa MarkdownDocumentMBS then dim m as MarkdownDocumentMBS = v List.AddFolder "Author", m.Author List.AddFolder "Code", m.Code List.AddRow "Compiled", str(m.Compiled) List.AddFolder "Date", m.Date List.AddRow "HasHTML", str(m.HasHTML) List.AddFolder "Title", m.Title List.AddRow "URLBase", m.URLBase end if End Sub
Sub run() dim t as string = TextArea1.text t = ReplaceLineEndings(t, EndOfLine.UNIX) m = new MarkdownDocumentMBS(t) if m.Compile then dim lines() as string lines.Append "<html>" lines.Append "<head>" lines.Append m.CSS lines.Append "</head>" lines.Append "<body>" lines.Append m.Document lines.Append "</body>" lines.Append "</head>" dim s as string = Join(lines,EndOfLine) HTMLViewer1.LoadPage s, nil Result.text = s list.DeleteAllRows Add m else MsgBox "Failed to process data" end if End Sub
Property m As MarkdownDocumentMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Module UtilModule
Sub AddFolder(extends list as listbox, text as string, tag as Variant) if tag = nil then list.AddRow text, "n/a" else List.AddFolder text List.RowTag(list.LastIndex) = tag end if End Sub
End Module
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Tools Plugin.




Links
MBS Xojo Chart Plugins