Convert to HTML Macro for Writers

Get help using and writing Nisus Writer Pro macros.
Post Reply
User avatar
loulesko
Posts: 89
Joined: 2008-01-20 11:08:35
Location: California
Contact:

Convert to HTML Macro for Writers

Post by loulesko » 2013-10-20 15:55:22

Hi there,

This post was updated to a newer version of this macro on 2/25/2017

This is a refined version of a macro I started a while back. It converts your Nisus document text to HTML (including links), headers 1-6, tables, numbered and bullet lists all get converted.

It also does some nice things for writers like converting opening and closing quotes to their proper HTML entities, it also does the same for ampersands, EM dashes and EN dashes. It also puts in paragraph tags and double carriage returns between paragraphs for cleaner text that you can easily read after pasting.

This macro requires that you have your styles for headings listed as "Heading 1", "Heading 2". "Heading 3" etc, "Blockquote", "Bullet List", "Number List" in your style sheet - these are all the default names, so you probably won't have to do a thing.

This latest version uploaded 2/25/17 fixes a few annoyances like if a list was that the end of a document and didn't have a following carriage return, the last list item tag would get swapped with the OL or UL tag, that is now not problem.

best
Lou
Attachments
Copy-as-HTML.nwm.zip
(3.85 KiB) Downloaded 84 times
Last edited by loulesko on 2017-02-25 17:47:58, edited 4 times in total.

User avatar
martin
Official Nisus Person
Posts: 4370
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Convert to HTML Macro for Writers

Post by martin » 2013-10-30 14:28:46

Thanks for sharing this Lou! Even though NWP does have a built-in HTML export, it tends to be rather overwrought in terms of CSS/HTML tags because it's produced by Apple's WebKit, intended to be shown/interpreted by web browsers. It's not the kind of thing that's very pleasant to hand edit. Your macro does a much better job of producing simple hand-editable HTML.

ptram
Posts: 279
Joined: 2007-10-21 14:59:09

Re: Convert to HTML Macro for Writers

Post by ptram » 2014-05-17 07:31:56

Lou, thank you very much. Very useful!

Paolo

User avatar
loulesko
Posts: 89
Joined: 2008-01-20 11:08:35
Location: California
Contact:

Re: Convert to HTML Macro for Writers

Post by loulesko » 2014-05-28 17:38:35

My pleasure Paolo, I 'm thrilled you find it useful.

Lou

Post Reply