Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

Does anybody know how to write a DU conversion program

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » Archives » General Discussion (1/22-2007 thru 12/14/2010) Donate to DU
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 12:51 PM
Original message
Does anybody know how to write a DU conversion program
that would take standard HTML article and convert it to the specialized commands that DU uses for HTML?

I crosspost things from my blog to DU, as do others, and having to reformat the text is a major pain..
Printer Friendly | Permalink |  | Top
Tandalayo_Scheisskopf Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 12:54 PM
Response to Original message
1. What sort of commands?
Edited on Tue Mar-11-08 12:54 PM by Tandalayo_Scheisskop
Like & and an amp and whatnot?

That's UTF-8 text encoding commands.
Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 01:23 PM
Response to Reply #1
9. No,
Stuff like converting <blockquote> to the {div class="excerpt"}{/div} (I used "{} instead of "[" in order to show the command) and http links to the DU convention.
Printer Friendly | Permalink |  | Top
 
Matariki Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 12:55 PM
Response to Original message
2. Couldn't you run it through MS Word using find and replace?
Edited on Tue Mar-11-08 01:00 PM by kineta
i.e. replace <b> with [b] etc

Printer Friendly | Permalink |  | Top
 
k8conant Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 01:03 PM
Response to Reply #2
3. I think you just need to change [ to < and ] to >
Edited on Tue Mar-11-08 01:12 PM by k8conant
The Message options say: "HTML tags can be used in your
message simply by using [ and ] symbols in place of < and
> symbols, respectively."
Printer Friendly | Permalink |  | Top
 
Matariki Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 01:11 PM
Response to Reply #3
4. I think we're saying the same thing -
but i'm not sure ;-)
Printer Friendly | Permalink |  | Top
 
k8conant Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 01:14 PM
Response to Reply #4
5. Yes we are, but I had to switch to plain text to show it correctly...n/t
Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 01:16 PM
Response to Reply #2
7. Yes, that is how I do it now
but when you have a long post with lots of links and blockquotes it gets tedious. I have to believe someone may have written a script or short prog, or can whip one up with a a small exertion of their hacker fu to address this annoyance. :)
Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 01:26 PM
Response to Reply #2
10. Also
some of the DU HTML commands don't lend themselves to straight "search & replace". Hyperlinks for example:

{link:www.dcscripts.com|DCScripts}

as opposed to:

<a href="" target="_blank"></a>
Printer Friendly | Permalink |  | Top
 
AlCzervik Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 01:16 PM
Response to Original message
6. this might be helpful or then again maybe it's not.
Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 01:20 PM
Response to Reply #6
8. If I am using this right
it doesn't seem to do what I want. Thanks for the link though.
Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 03:51 PM
Response to Original message
11. Kick for the late afternoon shift to read
Printer Friendly | Permalink |  | Top
 
seemslikeadream Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 03:55 PM
Response to Reply #11
12. mogster might have what you're looking for
Edited on Tue Mar-11-08 03:56 PM by seemslikeadream
http://journals.democraticunderground.com/mogster

DU-o-matic codificator (DC-board codewrapper w/text tools)
http://www.iterapi.com/dccode.html
Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 07:29 PM
Response to Reply #12
14. This has been recommended
but I don't quite see how it works. It seems to be for writing posts and using it to insert the right DU codes. I have already written the post in standard HTML and am looking for something to take my text and convert it to the DU code without having to write to separate posts for two separate places.
Printer Friendly | Permalink |  | Top
 
IDemo Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 04:23 PM
Response to Original message
13. I use a utility I created in Visual Basic
Here's a screenshot (with a small character map that has since been expanded):


Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 07:32 PM
Response to Reply #13
15. Again, I think your tool
is for writing posts that insert the commands as you go. I have already written the posts using regular HTML for my blog. I would like to cross-post to DU without re-typing all the commands. I have been using "Search & Replace" but it is a tedious and imperfect solution.

I need a tool (on or offline) that will take an existing HTML doc and convert the codes to the DU style codes.
Printer Friendly | Permalink |  | Top
 
IDemo Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 08:06 PM
Response to Reply #15
18. I'm kind of limited in my programming abilities to Visual Basic
Edited on Tue Mar-11-08 08:43 PM by IDemo
If you have either VB 6.0 or Microsoft Office, you can create a .exe or a VBA macro and use the "Replace" command. It will replace every instance of all terms you include in a single pass, instead of having to use multiple "search and replace" operations in Word.

Example:

Private Sub HTML_to_DU( )
Dim HTML as string
Dim DU as string

HTML = "blah blah blah <blockquote> blah blah blah </blockquote>" ' or you could paste your html into a textbox and read it from there
DU = Replace( HTML, "<blockquote>", "{div class="excerpt"}")
DU = Replace( DU, "</blockquote>", "{/div}")
DU = Replace( DU, "the next item to replace", "what to replace it with")
' repeat above line as many times as needed
Text1.text = DU

End sub
Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 10:13 PM
Response to Reply #18
20. The problem gets real tricky with the hyperlink command
since you can't do a straight substitution.

Aaaargh! :(
Printer Friendly | Permalink |  | Top
 
ChromeFoundry Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 07:42 PM
Response to Original message
16. what operating system do you use?
Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 10:13 PM
Response to Reply #16
21. Windows 2000 pro
Printer Friendly | Permalink |  | Top
 
Ghost in the Machine Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 07:55 PM
Response to Original message
17. Have you tried Simple Search & Replace?
Simple Search-Replace v1.03
If you need to find and replace text, or just find text, this utility is a must have. It is significantly faster and easier to use than any other search and replace utility out there.


© Copyright 2004, RJL Software, Inc.


--------------------------------------------------------------------------------

Product Description
Simple Search/Replace is like a replacement for the Windows "containing text" option found in their search window. It is extremely fast and allows for the option of replacing that text with different text. There are many features of this free software such as backup support, case sensitivity, multiple file types, subdirectory support and more. After searching or replacing the results tab will allow you to open the matched file(s) and view the contents as well as edit them.

Simple Search/Replace was designed for searching plain-ASCII text files, such as source code, TXT, HTML, RTF, batch files or any other text file you might have. Simple Search/Replace is a FREE software program. If you need to find and replace text, or just find text, this utility is a must have. It is significantly faster and easier to use than any other search and replace utility out there.

Product License
Freeware

How to Close
Click the File menu option and then choose Exit

Command Line Options
None

Requirements
Minimum System:


Pentium III 800MHz
128 MB RAM
327KB free disk space
Windows compatible mouse
Supported Operating System(s):

Windows 95
Windows 98
Windows ME
Windows XP
Windows NT
Windows 2000
Windows 2003

File Specifics
Windows Installer Size:
4451 KB

Compressed ZIP file size:
334 KB

Compressed EXE file size:
346 KB

Fully extracted file size:
327 KB

File Date:
Tuesday, September 14, 2004 at 9:14:04 PM


http://www.rjlsoftware.com/?search

Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 10:14 PM
Response to Reply #17
22. Discussed in an earlier post
works for simple commands, but not for complex commands like hyperlinks.
Printer Friendly | Permalink |  | Top
 
merh Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 08:30 PM
Response to Original message
19. use the site that mogster set up for all of us to use
Edited on Tue Mar-11-08 08:33 PM by merh
http://www.iterapi.com/dccode.html

It makes formatting so easy.

Edited to add: I see others have provided you with mogster's link. Maybe you can pmail him and he can give you suggestions. He knows some stuff.



Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 10:16 PM
Response to Reply #19
23. Thanks!
I will. Mogster's program is great if you are wrint up your post from scratch, but I have already written in in standard HTML for my blog, and wish to cross-post to DU, so I need a converter.
Printer Friendly | Permalink |  | Top
 
Make7 Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Mar-11-08 10:20 PM
Response to Original message
24. Some info that might be useful...
Edited on Tue Mar-11-08 10:21 PM by Make7
Before I begin, is www.thoughtcrimes.org the blog you are referring to?


Many HTML tags will work just fine at DU - for instance, the [blockquote] tag will work, you really don't have to change it to a [div class="excerpt"] element.

The standard anchor tag will also work here. The following two commands will function identically:

     [link:www.google.com|Google]

     [a href="http://www.google.com"]Google[/a]

I'm not sure if DU will ignore the onclick and target attributes of the anchor tag, but it can't hurt to just try it to see what happens.


A big problem is with how standard HTML will handle line breaks compared to DU. When you enter a carriage return/line feed (i.e. hit the enter key) here, it automatically creates a line break in the page code, but in normal HTML source code line breaks occur when a tag forces one. So copying source code from your blog over here will likely result in extra spacing between lines (of which I'm sure you are aware).


If I were you, I would install the Signature extension in FireFox and define your blog's normal sections and special formatting as "signatures" to automatically insert the code for you and just copy and paste the text from each section of your blog posts. (After a brief glance over there, it looks like most of the formatting is pretty basic.) I would use the standard HTML anchor tag format to make the copy and pasting easier.

Hopefully at least some of that was worth reading and perhaps will save you some time when cross posting.

- Make7
Printer Friendly | Permalink |  | Top
 
Kelvin Mace Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Mar-12-08 09:59 AM
Response to Reply #24
25. Thanks!
If this works, they must have changed something on the back end, as it didn't when I tried it a while back.

I'll give it a try today.
Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Fri Apr 19th 2024, 03:45 AM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » Archives » General Discussion (1/22-2007 thru 12/14/2010) Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC