Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
internal_link2 [2009/08/03 09:49] clare created |
internal_link2 [2009/08/03 10:17] clare created |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | Attribute VB_Name = "Word2DokuWikiv3" | + | ====== Convert HTML to DokuWiki ====== |
- | Sub Word2DokuWiki() | + | An idea for converting existing documents to text files with [[http://www.dokuwiki.org/tips:dokuwiki|DokuWiki]] [[http://www.dokuwiki.org/tips:syntax|syntax]] using an HTML to Text converter. I've set up a config file for the tool available at [[http://www.mbayer.de/html2text/|http://www.mbayer.de/html2text/]] which produces some usable results: [[http://www.dokuwiki.org/_media/wiki:text2html.rc|text2html.rc]]. |
- | Application.ScreenUpdating = False | + | |
- | ReplaceQuotes | + | |
- | DokuWikiEscapeChars | + | |
- | DokuWikiConvertHyperlinks | + | |
- | DokuWikiConvertH1 | + | |
- | DokuWikiConvertH2 | + | |
- | DokuWikiConvertH3 | + | |
- | DokuWikiConvertH4 | + | |
- | DokuWikiConvertH5 | + | |
- | DokuWikiConvertItalic | + | |
- | DokuWikiConvertBold | + | |
- | DokuWikiConvertUnderline | + | |
- | DokuWikiConvertStrikeThrough | + | |
- | DokuWikiConvertSuperscript | + | |
- | DokuWikiConvertSubscript | + | |
- | DokuWikiConvertLists | + | |
- | DokuWikiConvertTable | + | |
- | UndoDokuWikiEscapeChars | + | |
- | ' Copy to clipboard | + | |
- | ActiveDocument.Content.Copy | + | |
- | Application.ScreenUpdating = True | + | |
- | End Sub | + | |
- | Private Sub DokuWikiConvertH1() | + | Thomas J. Messenger made a Perl module to convert HTML to DokuWiki's syntax available at [[http://www.citlink.net/%7Emessengertj/|http://www.citlink.net/~messengertj/]] (see [[http://bugs.splitbrain.org/index.php?do=details&task_id=81|81]], too) |
- | ReplaceHeading wdStyleHeading1, "======" | + | |
- | End Sub | + | |
- | Private Sub DokuWikiConvertH2() | + | Or the one at CPAN: [[http://search.cpan.org/%7Ediberri/HTML-WikiConverter-0.61/lib/HTML/WikiConverter.pm|http://search.cpan.org/~diberri/HTML-WikiConverter-0.61/lib/HTML/WikiConverter.pm]] |
- | ReplaceHeading wdStyleHeading2, "=====" | + | |
- | End Sub | + | |
- | Private Sub DokuWikiConvertH3() | + | A web interface used to convert pasted text or a webpage page is available at [[http://diberri.dyndns.org/html2wiki.html|http://diberri.dyndns.org/html2wiki.html]] |
- | ReplaceHeading wdStyleHeading3, "====" | + | |
- | End Sub | + | |
- | Private Sub DokuWikiConvertH4() | + | A Converter Tool (HTML>DokuWiki, UTF8, Tablespacing) [[http://runtime-basic.net/Projekt:WikiTool|WikiTool]] |
- | ReplaceHeading wdStyleHeading4, "===" | + | |
- | End Sub | + | |
- | Private Sub DokuWikiConvertH5() | + | ===== Html2DokuWiki Converter GUI for Win32 ===== |
- | ReplaceHeading wdStyleHeading5, "==" | + | |
- | End Sub | + | |
- | Private Sub DokuWikiConvertH6() | + | Html2DokuWiki is a free HTML to DokuWiki converter for Win32 platforms. It is very simple to install and extremely easy to use. Just extract the executable from the archive, double-click to start, and Html2DokuWiki is ready to go. |
- | ReplaceHeading wdStyleHeading5, "=" | + | |
- | End Sub | + | |
- | Private Sub DokuWikiConvertBold() | + | To start converting, just type HTML into the upper edit. The converted DokuWiki syntax will immediately appear in the lower edit. Then select (''CTRL+A'') the converted document and copy / paste it into any DokuWiki site. Larger HTML documents can also be pasted into the HTML input. |
- | ActiveDocument.Select | + | |
- | With Selection.Find | + | |
- | .ClearFormatting | + | |
- | .Font.Bold = True | + | |
- | .Text = "" | + | |
- | .Format = True | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | + | ||
- | Do While .Execute | + | |
- | With Selection | + | |
- | If Len(.Text) > 1 And InStr(1, .Text, vbCr) Then | + | |
- | ' Just process the chunk before any newline characters | + | |
- | ' We'll pick-up the rest with the next search | + | |
- | .Collapse | + | |
- | .MoveEndUntil vbCr | + | |
- | End If | + | |
- | + | ||
- | ' Don't bother to markup newline characters (prevents a loop, as well) | + | |
- | + | ||
- | If Not .Text = vbCr Then | + | |
- | If Not Left(.Text, 2) = "**" Then | + | |
- | .InsertBefore "**" | + | |
- | End If | + | |
- | If Not Right(.Text, 2) = "**" Then | + | |
- | .InsertAfter "**" | + | |
- | End If | + | |
- | End If | + | |
- | + | ||
- | .Style = ActiveDocument.Styles("Default Paragraph Font") | + | |
- | .Font.Bold = False | + | |
- | End With | + | |
- | Loop | + | |
- | End With | + | |
- | End Sub | + | |
- | + | ||
- | Private Sub DokuWikiConvertItalic() | + | |
- | ActiveDocument.Select | + | |
- | + | ||
- | With Selection.Find | + | |
- | + | ||
- | .ClearFormatting | + | |
- | .Font.Italic = True | + | |
- | .Text = "" | + | |
- | + | ||
- | .Format = True | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | + | ||
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | + | ||
- | Do While .Execute | + | |
- | With Selection | + | |
- | If Len(.Text) > 1 And InStr(1, .Text, vbCr) Then | + | |
- | ' Just process the chunk before any newline characters | + | |
- | ' We'll pick-up the rest with the next search | + | |
- | .Collapse | + | |
- | .MoveEndUntil vbCr | + | |
- | End If | + | |
- | + | ||
- | ' Don't bother to markup newline characters (prevents a loop, as well) | + | |
- | If Not .Text = vbCr Then | + | |
- | If Not Left(.Text, 2) = "//" Then | + | |
- | .InsertBefore "//" | + | |
- | End If | + | |
- | If Not Right(.Text, 2) = "//" Then | + | |
- | .InsertAfter "//" | + | |
- | End If | + | |
- | End If | + | |
- | + | ||
- | .Style = ActiveDocument.Styles("Default Paragraph Font") | + | |
- | .Font.Italic = False | + | |
- | End With | + | |
- | Loop | + | |
- | End With | + | |
- | End Sub | + | |
- | + | ||
- | Private Sub DokuWikiConvertUnderline() | + | |
- | ActiveDocument.Select | + | |
- | + | ||
- | With Selection.Find | + | |
- | + | ||
- | .ClearFormatting | + | |
- | .Font.Underline = True | + | |
- | .Text = "" | + | |
- | + | ||
- | .Format = True | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | + | ||
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | + | ||
- | Do While .Execute | + | |
- | With Selection | + | |
- | If Len(.Text) > 1 And InStr(1, .Text, vbCr) Then | + | |
- | ' Just process the chunk before any newline characters | + | |
- | ' We'll pick-up the rest with the next search | + | |
- | .Collapse | + | |
- | .MoveEndUntil vbCr | + | |
- | End If | + | |
- | + | ||
- | ' Don't bother to markup newline characters (prevents a loop, as well) | + | |
- | If Not .Text = vbCr Then | + | |
- | If Not Left(.Text, 2) = "__" Then | + | |
- | .InsertBefore "__" | + | |
- | End If | + | |
- | If Not Right(.Text, 2) = "__" Then | + | |
- | .InsertAfter "__" | + | |
- | End If | + | |
- | End If | + | |
- | + | ||
- | .Style = ActiveDocument.Styles("Default Paragraph Font") | + | |
- | .Font.Underline = False | + | |
- | End With | + | |
- | Loop | + | |
- | End With | + | |
- | End Sub | + | |
- | + | ||
- | Private Sub DokuWikiConvertStrikeThrough() | + | |
- | ActiveDocument.Select | + | |
- | + | ||
- | With Selection.Find | + | |
- | + | ||
- | .ClearFormatting | + | |
- | .Font.StrikeThrough = True | + | |
- | .Text = "" | + | |
- | + | ||
- | .Format = True | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | + | ||
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | + | ||
- | Do While .Execute | + | |
- | With Selection | + | |
- | If Len(.Text) > 1 And InStr(1, .Text, vbCr) Then | + | |
- | ' Just process the chunk before any newline characters | + | |
- | ' We'll pick-up the rest with the next search | + | |
- | .Collapse | + | |
- | .MoveEndUntil vbCr | + | |
- | End If | + | |
- | + | ||
- | ' Don't bother to markup newline characters (prevents a loop, as well) | + | |
- | If Not .Text = vbCr Then | + | |
- | If Not Left(.Text, 2) = "<del>" Then | + | |
- | .InsertBefore "<del>" | + | |
- | End If | + | |
- | If Not Right(.Text, 2) = "</del>" Then | + | |
- | .InsertAfter "</del>" | + | |
- | End If | + | |
- | End If | + | |
- | + | ||
- | .Style = ActiveDocument.Styles("Default Paragraph Font") | + | |
- | .Font.StrikeThrough = False | + | |
- | End With | + | |
- | Loop | + | |
- | End With | + | |
- | End Sub | + | |
- | + | ||
- | Private Sub DokuWikiConvertSuperscript() | + | |
- | ActiveDocument.Select | + | |
- | + | ||
- | With Selection.Find | + | |
- | + | ||
- | .ClearFormatting | + | |
- | .Font.Superscript = True | + | |
- | .Text = "" | + | |
- | + | ||
- | .Format = True | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | + | ||
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | + | ||
- | Do While .Execute | + | |
- | With Selection | + | |
- | .Text = Trim(.Text) | + | |
- | If Len(.Text) > 1 And InStr(1, .Text, vbCr) Then | + | |
- | ' Just process the chunk before any newline characters | + | |
- | ' We'll pick-up the rest with the next search | + | |
- | .Collapse | + | |
- | .MoveEndUntil vbCr | + | |
- | End If | + | |
- | + | ||
- | ' Don't bother to markup newline characters (prevents a loop, as well) | + | |
- | If Not .Text = vbCr Then | + | |
- | If Not Left(.Text, 2) = "<sup>" Then | + | |
- | .InsertBefore "<sup>" | + | |
- | End If | + | |
- | If Not Right(.Text, 2) = "</sup>" Then | + | |
- | .InsertAfter "</sup>" | + | |
- | End If | + | |
- | End If | + | |
- | + | ||
- | .Style = ActiveDocument.Styles("Default Paragraph Font") | + | |
- | .Font.Superscript = False | + | |
- | End With | + | |
- | Loop | + | |
- | End With | + | |
- | End Sub | + | |
- | + | ||
- | Private Sub DokuWikiConvertSubscript() | + | |
- | ActiveDocument.Select | + | |
- | + | ||
- | With Selection.Find | + | |
- | + | ||
- | .ClearFormatting | + | |
- | .Font.Subscript = True | + | |
- | .Text = "" | + | |
- | + | ||
- | .Format = True | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | + | ||
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | + | ||
- | Do While .Execute | + | |
- | With Selection | + | |
- | .Text = Trim(.Text) | + | |
- | If Len(.Text) > 1 And InStr(1, .Text, vbCr) Then | + | |
- | ' Just process the chunk before any newline characters | + | |
- | ' We'll pick-up the rest with the next search | + | |
- | .Collapse | + | |
- | .MoveEndUntil vbCr | + | |
- | End If | + | |
- | + | ||
- | ' Don't bother to markup newline characters (prevents a loop, as well) | + | |
- | If Not .Text = vbCr Then | + | |
- | If Not Left(.Text, 2) = "<sub>" Then | + | |
- | .InsertBefore "<sub>" | + | |
- | End If | + | |
- | If Not Right(.Text, 2) = "</sub>" Then | + | |
- | .InsertAfter "</sub>" | + | |
- | End If | + | |
- | End If | + | |
- | + | ||
- | .Style = ActiveDocument.Styles("Default Paragraph Font") | + | |
- | .Font.Subscript = False | + | |
- | End With | + | |
- | Loop | + | |
- | End With | + | |
- | End Sub | + | |
- | + | ||
- | Private Sub DokuWikiConvertLists() | + | |
- | Dim para As Paragraph | + | |
- | For Each para In ActiveDocument.ListParagraphs | + | |
- | With para.Range | + | |
- | .InsertBefore " " | + | |
- | If .ListFormat.ListType = wdListBullet Then | + | |
- | .InsertBefore "*" | + | |
- | Else | + | |
- | .InsertBefore "-" | + | |
- | End If | + | |
- | For i = 1 To .ListFormat.ListLevelNumber | + | |
- | .InsertBefore " " | + | |
- | Next i | + | |
- | .ListFormat.RemoveNumbers | + | |
- | End With | + | |
- | Next para | + | |
- | End Sub | + | |
- | + | ||
- | Private Sub DokuWikiConvertHyperlinks() | + | |
- | Dim hyperCount As Integer | + | |
- | + | ||
- | hyperCount = ActiveDocument.Hyperlinks.Count | + | |
- | + | ||
- | For i = 1 To hyperCount | + | |
- | With ActiveDocument.Hyperlinks(1) | + | |
- | Dim addr As String | + | |
- | addr = .Address | + | |
- | .Delete | + | |
- | .Range.InsertBefore "[" | + | |
- | .Range.InsertAfter "-" & addr & "]" | + | |
- | End With | + | |
- | Next i | + | |
- | End Sub | + | |
- | + | ||
- | ' Replace all smart quotes with their dumb equivalents | + | |
- | Private Sub ReplaceQuotes() | + | |
- | Dim quotes As Boolean | + | |
- | quotes = Options.AutoFormatAsYouTypeReplaceQuotes | + | |
- | Options.AutoFormatAsYouTypeReplaceQuotes = False | + | |
- | ReplaceString ChrW(8220), """" | + | |
- | ReplaceString ChrW(8221), """" | + | |
- | ReplaceString "ë", "'" | + | |
- | ReplaceString "í", "'" | + | |
- | Options.AutoFormatAsYouTypeReplaceQuotes = quotes | + | |
- | End Sub | + | |
- | + | ||
- | Private Sub DokuWikiEscapeChars() | + | |
- | EscapeCharacter "*" | + | |
- | EscapeCharacter "#" | + | |
- | EscapeCharacter "_" | + | |
- | EscapeCharacter "-" | + | |
- | EscapeCharacter "+" | + | |
- | EscapeCharacter "{" | + | |
- | EscapeCharacter "}" | + | |
- | EscapeCharacter "[" | + | |
- | EscapeCharacter "]" | + | |
- | EscapeCharacter "~" | + | |
- | EscapeCharacter "^^" | + | |
- | EscapeCharacter "|" | + | |
- | EscapeCharacter "'" | + | |
- | End Sub | + | |
- | + | ||
- | Private Function ReplaceHeading(styleHeading As String, headerPrefix As String) | + | |
- | Dim normalStyle As Style | + | |
- | Set normalStyle = ActiveDocument.Styles(wdStyleNormal) | + | |
- | + | ||
- | ActiveDocument.Select | + | |
- | + | ||
- | With Selection.Find | + | |
- | + | ||
- | .ClearFormatting | + | |
- | .Style = ActiveDocument.Styles(styleHeading) | + | |
- | .Text = "" | + | |
- | + | [[http://www.yunqa.de/delphi/downloads/Html2DokuWiki.zip|Click here to download Html2DokuWiki]]. | |
- | .Format = True | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | + | ||
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | + | ||
- | Do While .Execute | + | |
- | With Selection | + | |
- | If InStr(1, .Text, vbCr) Then | + | |
- | ' Just process the chunk before any newline characters | + | |
- | ' We'll pick-up the rest with the next search | + | |
- | .Collapse | + | |
- | .MoveEndUntil vbCr | + | |
- | End If | + | |
- | + | ||
- | ' Don't bother to markup newline characters (prevents a loop, as well) | + | |
- | If Not .Text = vbCr Then | + | |
- | .InsertBefore headerPrefix | + | |
- | .InsertBefore vbCr | + | |
- | .InsertAfter headerPrefix | + | |
- | End If | + | |
- | .Style = normalStyle | + | |
- | End With | + | |
- | Loop | + | |
- | End With | + | |
- | End Function | + | |
- | Private Sub DokuWikiConvertTable() | + | **Supported** **HTML** **Elements** |
- | Dim TotTables As Long | + | |
- | Do While ActiveDocument.Tables.Count() > 0 | + | |
- | ActiveDocument.Tables(1).Range.Select | + | |
- | Selection.Find.ClearFormatting | + | |
- | Selection.Find.Replacement.ClearFormatting | + | |
- | With Selection.Find | + | |
- | .Text = " $s$|$s$ " | + | |
- | .Replacement.Text = "I" | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | Selection.Find.ClearFormatting | + | |
- | Selection.Find.Replacement.ClearFormatting | + | |
- | With Selection.Find | + | |
- | .Text = " $s$^^$s$ " | + | |
- | .Replacement.Text = "/\" | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | Selection.Find.ClearFormatting | + | |
- | Application.DefaultTableSeparator = "|" | + | |
- | Selection.Rows.ConvertToText Separator:=wdSeparateByDefaultListSeparator, NestedTables:=True | + | |
- | Selection.Find.ClearFormatting | + | |
- | Selection.Find.Replacement.ClearFormatting | + | |
- | With Selection.Find | + | |
- | .Text = "^p" | + | |
- | .Replacement.Text = "|^p|" | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindStop | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | Selection.InsertBefore ("|") | + | |
- | Selection.InsertParagraphAfter | + | |
- | Selection.Find.ClearFormatting | + | |
- | Selection.Find.Replacement.ClearFormatting | + | |
- | With Selection.Find | + | |
- | .Text = "^p|^p" | + | |
- | .Replacement.Text = "^p" | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindStop | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | Selection.Find.ClearFormatting | + | |
- | Selection.Find.Replacement.ClearFormatting | + | |
- | With Selection.Find | + | |
- | .Text = "$s$blank$s$" | + | |
- | .Replacement.Text = "" | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | Selection.Find.ClearFormatting | + | |
- | Selection.Find.Replacement.ClearFormatting | + | |
- | With Selection.Find | + | |
- | .Text = "||" | + | |
- | .Replacement.Text = "| |" | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindStop | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | With Selection.Find | + | |
- | .Text = "||" | + | |
- | .Replacement.Text = "| |" | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindStop | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | Selection.Find.ClearFormatting | + | |
- | Selection.Find.Replacement.ClearFormatting | + | |
- | With Selection.Find | + | |
- | .Text = "| |" | + | |
- | .Replacement.Text = "| |" | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindStop | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | With Selection.Find | + | |
- | .Text = "| |" | + | |
- | .Replacement.Text = "| |" | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindStop | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | Selection.Paragraphs(1).Range.Select | + | |
- | Selection.Find.ClearFormatting | + | |
- | Selection.Find.Replacement.ClearFormatting | + | |
- | With Selection.Find | + | |
- | .Text = "|" | + | |
- | .Replacement.Text = "^^" | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindStop | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | Loop | + | |
- | End Sub | + | |
- | Private Sub UndoDokuWikiEscapeChars() | + | |
- | UndoEscapeCharacter "*" | + | [[http://www.dokuwiki.org/lib/exe/fetch.php?cache=nocache&media=http%3A%2F%2Fwww.yunqa.de%2Fsoftware%2FHtml2DokuWiki.png|{{ Convert%20HTML%20to%20DokuWiki_files:image002.gif?250x208|Html2DokuWiki}}]]Html2DokuWiki converts all HTML elements currently supported by DokuWiki: |
- | UndoEscapeCharacter "#" | + | |
- | UndoEscapeCharacter "_" | + | |
- | UndoEscapeCharacter "-" | + | |
- | UndoEscapeCharacter "+" | + | |
- | UndoEscapeCharacter "{" | + | |
- | UndoEscapeCharacter "}" | + | |
- | UndoEscapeCharacter "[" | + | |
- | UndoEscapeCharacter "]" | + | |
- | UndoEscapeCharacter "~" | + | |
- | UndoEscapeCharacter "^^" | + | |
- | UndoEscapeCharacter "|" | + | |
- | UndoEscapeCharacter "'" | + | |
- | End Sub | + | * **<A>** → links, outputs multiple links for formatting |
+ | * **<B>** → ''%%**%%'' | ||
+ | * **<BLOCKQUOTE>** → ''>'', including nested quotes | ||
+ | * **<BR>** → new line ''\\'' | ||
+ | * **%%<CODE>%%** → ''%%''%%'' | ||
+ | * **<DEL>** → ''<del>'' | ||
+ | * **<DL>, <DT>, and <DD>** → Simulate output as simple unnumbered lists with ''<DT>'' as bold. | ||
+ | * **<H1>** … **<H5>** → ''%%======%%'' to ''%%==%%'' | ||
+ | * **<I>** → ''%%//%%'' | ||
+ | * **<IMG>** → images | ||
+ | * **<LI>** → list items, including nested lists | ||
+ | * **<OL>** → numbered lists | ||
+ | * **<P>** → new paragraph | ||
+ | * **<PRE>** → ''%%<code>%%'' | ||
+ | * **<S>** → ''%%**%%'' | ||
+ | * **<STRIKE>** → ''%%//%%'' | ||
+ | * **<STRONG>** → ''%%**%%'' | ||
+ | * **%%<SUB>%%** → ''%%<sub>%%'' | ||
+ | * **%%<SUP>%%** → ''%%<sup>%%'' | ||
+ | * **<TABLE>** → tables | ||
+ | * **<TBODY>** → recognized, but not output | ||
+ | * **<TD>** → table cell, with ''align'' and ''colspan'' support | ||
+ | * **<TFOOT>** → recognized, but not output | ||
+ | * **<TH>** → table header cell, with ''align'' and ''colspan'' support | ||
+ | * **<THEAD>** → recognized, but not output | ||
+ | * **<TR>** → table row, with ''align'' support | ||
+ | * **<TT>** → to ''%%''%%'' | ||
+ | * **<U>** → to ''%%__%%'' | ||
- | Private Function EscapeCharacter(char As String) | + | **Special Features** |
- | ReplaceString char, " $s$" & char & "$s$ " | + | |
- | End Function | + | |
- | Private Function UndoEscapeCharacter(char As String) | + | * Internal links are converted to DokuWiki's '':'' style, external ones are left unchanged. ''mailto'''':'' is removed from e-mail links. |
- | ReplaceString " $s$" & char & "$s$ ", char | + | * Support for alignment in table cells and rows. |
- | End Function | + | * Image properties are converted, including alignment, width, and height. |
+ | * Formatting is only applied where accepted by DokuWiki, but not to ''%%===%% … ==='' and ''%%<code>%% … </code>'', for example. | ||
+ | * Full Unicode support, with optional UTF-8 input or output encoding. | ||
+ | * Option to hide links from DokuWiki syntax. | ||
- | Private Function ReplaceString(findStr As String, replacementStr As String) | + | **Author, Contact, and Development** |
- | Selection.Find.ClearFormatting | + | |
- | Selection.Find.Replacement.ClearFormatting | + | |
- | With Selection.Find | + | |
- | .Text = findStr | + | |
- | .Replacement.Text = replacementStr | + | |
- | .Forward = True | + | |
- | .Wrap = wdFindContinue | + | |
- | .Format = False | + | |
- | .MatchCase = False | + | |
- | .MatchWholeWord = False | + | |
- | .MatchWildcards = False | + | |
- | .MatchSoundsLike = False | + | |
- | .MatchAllWordForms = False | + | |
- | End With | + | |
- | Selection.Find.Execute Replace:=wdReplaceAll | + | |
- | End Function | + | |
+ | Html2DokuWiki is developed by Ralf Junker. You can contact the author via the [[http://www.freelists.org/list/yunqa|Yunqa]][[http://www.freelists.org/list/yunqa| mailing list]]. Feel free to report praise, bugs, or suggestions about Html2DokuWiki. | ||
+ | |||
+ | The converter might also be available as a software library %%(*%%.DLL, *.DCU, or Delphi source code). Please get in touch if interested. | ||
+ | |||
+ | **Version History** | ||
+ | |||
+ | 2007-08-27 | ||
+ | |||
+ | * Add inline formatting to table cells. | ||
+ | * New UTF-8 input encoding. | ||
+ | * Fix paragraph problems with alternating inline-tags and block-tags. | ||
+ | * Do not escape ''%%//%%'' to ''<nowiki>%%</nowiki>%%//%%<nowiki>%%</nowiki>'' if part of an external URI. | ||
+ | * Escape ''<nowiki>%%</nowiki>'' to ''<nowiki>%%<nowiki>''. | ||
+ | * Empty heading elements separate paragraphs. | ||
+ | |||
+ | 2007-10-22 | ||
+ | |||
+ | * New: Support for ''<DL>'', ''<DT>'', and ''<DD>''. Simulate output as simple unnumbered lists with ''<DT>'' as bold. | ||
+ | * Improve: Empty paragraph inserts line break. | ||
+ | * Improve: Recognize DokuWiki internal escapes ''<nowiki>%%</nowiki>'', ''<nowiki>'', and ''</nowiki>'' and escape them properly. | ||
+ | * Improve: Escape table markup (''%%|%%'' and ''%%^%%'') when inside a table. | ||
+ | * Improve: Escape double parenthesis ''%%((%%'', which starts a DokuWiki footnote. | ||
+ | * Improve: Suppress DokuWiki escapes and typography in ''<PRE>'' blocks. | ||
+ | * Fix: Newline output for HTML like ''<P><PRE>one</PRE>two</P><BR>three''. | ||
+ | * Fix: ''<TBODY>'' table problem where a new row did not ouput a linebreak. | ||
+ | |||
+ | ===== Workflow Microsoft Word 2 DokuWiki using html2wiki-GUI ===== | ||
+ | |||
+ | I was looking for a way to convert about 150 DOC-files (Microsoft Word2000 or 2003) in our new wiki without too much hazzle. The macros available didn´t work for me. | ||
+ | |||
+ | **Specifications** | ||
+ | |||
+ | * usable for multiple files | ||
+ | * converting tables | ||
+ | * converting images | ||
+ | |||
+ | **suggested** **workflow** (not used excessively yet) | ||
+ | |||
+ | - open word-document in OpenOffice | ||
+ | - save as html (the pictures will be stored in the same folder as the html) | ||
+ | - open html2dokuwiki plugin[[http://www.yunqa.de/delphi/downloads/Html2DokuWiki.zip|Click]] here to download Html2DokuWiki | ||
+ | - [[http://www.yunqa.de/delphi/downloads/Html2DokuWiki.zip|paste and copy html-code in the ]][[http://www.yunqa.de/delphi/downloads/Html2DokuWiki.zip|GUI]] | ||
+ | - [[http://www.yunqa.de/delphi/downloads/Html2DokuWiki.zip|save as txt-file (or create new page for integrity)]] | ||
+ | - [[http://www.yunqa.de/delphi/downloads/Html2DokuWiki.zip|copy txt-file in the DATA/PAGES/NAMESPACE-folder and Pictures in the DATA/MEDIA/NAMESPACE-folder]] | ||
+ | |||
+ | [[http://www.yunqa.de/delphi/downloads/Html2DokuWiki.zip|Is there a faster way (2009/07/18 by ]][[http://www.yunqa.de/delphi/downloads/Html2DokuWiki.zip|bobeck]][[http://www.yunqa.de/delphi/downloads/Html2DokuWiki.zip|)]] |