Using Macros or other features to insert html code

Everything related to our flagship word processor.
Post Reply
tarakananda
Posts: 33
Joined: 2005-09-11 12:51:57
Contact:

Using Macros or other features to insert html code

Post by tarakananda »

Friends,

I have found a method using search and replace to insert html paragraph coding to a document, saving me time when I work in DreamWeaver.

I would like to save even more time by being able to automatically find italic phrases and inserting <i> before and </I> after. The same applies to bolded text. I am able to find all italic or bold text using the select character attributes button on the bottom of the page, but that does not help me isolate individual italic or bold phrases, and thereby enable me to add the html coding before and after each phrase.

When I figured out how to do this for paragraphs, I was saved an enormous amount of time in html coding. I could do in 10 seconds what would have taken hours to do otherwise.

Is there an easy method to accomplish this for bold and italic phrases?
rmark
Official Nisus Person
Posts: 428
Joined: 2003-02-11 10:49:05
Location: Solana Beach, CA
Contact:

Re: Using Macros or other features to insert html code

Post by rmark »

Tarakanda,

Have you tried this macro expression?

Code: Select all

Find and Replace '(.+)', '<i>\\1</i>', 'Eau'
Be sure to select the

Code: Select all

'(.+)'
and have it match the attribute in your document (either italic or bold, or whatever, and then change the HTML code to match.
Write On!
Mark Hurvitz
Nisus Software Inc.
tarakananda
Posts: 33
Joined: 2005-09-11 12:51:57
Contact:

Re: Using Macros or other features to insert html code

Post by tarakananda »

Mark, Thanks for your reply. Unfortunately, I am not familiar with the meaning of the various bits of code in the find and replace. Let's break this down into baby sized bits so that I can digest the ideas:

First, what does '(.+)' mean?
Second, the '\\1' ?
Third, 'Eau" ?

Specifically, how do I implement the code? I am by no mean a power user, only learning those bits which can help in a specific situation. Your patience is appreciated.

Code: Select all

Find and Replace '(.+)', '<i>\\1</i>', 'Eau'

Be sure to select the

Code: Select all

'(.+)'
rmark
Official Nisus Person
Posts: 428
Joined: 2003-02-11 10:49:05
Location: Solana Beach, CA
Contact:

Re: Using Macros or other features to insert html code

Post by rmark »

tarakananda,

I apologize for "assuming too much".

Do you know what I mean by "macro"?

Do you know how to create a macro in Nisus Writer Pro?

Perhaps the easiest way to solve this would be for you to create a new macro using the command in the Find/Replace window.

But, at the moment, it would be simpler if you email me at <support@nisus.com> and I can send you more detailed instructions with multiple step-by-step illustrations via email.

Perhaps then we can distill the instructions and post them here for others to learn more.

Thank you for your patience and your willingness to learn.
Write On!
Mark Hurvitz
Nisus Software Inc.
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Using Macros or other features to insert html code

Post by martin »

tarakananda wrote:Let's break this down into baby sized bits so that I can digest the ideas:

First, what does '(.+)' mean?
Second, the '\\1' ?
These are both PowerFind Pro expressions (more commonly known as regular expressions). It's a huge subject, but quickly ".+" means roughly "any text" and the surrounding parentheses mean to capture it for later use (in the replacement expression).
Third, 'Eau" ?
These are Nisus Writer "Find" command arguments. "E" means use PowerFind Pro, "a" means replace all, and "u" means attribute sensitive (eg: consider text formatting applied to the find expression).
Specifically, how do I implement the code?
You can download the macro I'll attach here, which contains the code:
HTML Tags - Italic and Bold.nwm
(20.84 KiB) Downloaded 557 times
You can then add the macro to Nisus Writer Pro. Once you've installed the macro it will always be available in the Macros menu.

I hope that helps. Let us know if you have any further questions!
tarakananda
Posts: 33
Joined: 2005-09-11 12:51:57
Contact:

Re: Using Macros or other features to insert html code

Post by tarakananda »

This is astounding! I formatted and entire 78 page document in seconds. I ran your bold and italic html conversion macro, and then my own paragraph html macro, and what used to take me ages is done in a blink of an eye.

I am grateful beyond expression.

Kudos to Mark and all the team at Nisus for such help.
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Using Macros or other features to insert html code

Post by martin »

That's great to hear- we're happy to help :)
jtranter
Posts: 38
Joined: 2010-03-12 00:37:07

Re: Using Macros or other features to insert html code

Post by jtranter »

Please be aware that there are hundreds more characters in a DOC file that need conversion to HTML other than italics and bold text.

The Wc3 have a page of recommended convertor files here:
http://www.w3.org/Tools/Word_proc_filters.html

And here you can find the actual characters and their HTML equivalents:
http://www.w3schools.com/tags/ref_entities.asp

Some examples:

Reserved Characters in HTML

Some characters are reserved in HTML and XHTML. For example, you cannot use the greater than or less than signs within your text because the browser could mistake them for markup.

HTML and XHTML processors must support the five special characters listed in the table below:
Character Entity Number Entity Name Description
" " " quotation mark
' ' &apos; (does not work in IE) apostrophe
& & & ampersand
< < < less-than
> > > greater-than

Note: Entity names are case sensitive!
ISO 8859-1 Symbols
Character Entity Number Entity Name Description
&#160; &nbsp; non-breaking space
¡ &#161; &iexcl; inverted exclamation mark
¢ &#162; &cent; cent
£ &#163; &pound; pound
¤ &#164; &curren; currency
¥ &#165; &yen; yen
¦ &#166; &brvbar; broken vertical bar
§ &#167; &sect; section
¨ &#168; &uml; spacing diaeresis
© &#169; &copy; copyright
ª &#170; &ordf; feminine ordinal indicator
« &#171; &laquo; angle quotation mark (left)
¬ &#172; &not; negation
­ &#173; &shy; soft hyphen
® &#174; &reg; registered trademark
¯ &#175; &macr; spacing macron
° &#176; &deg; degree
± &#177; &plusmn; plus-or-minus
² &#178; &sup2; superscript 2
³ &#179; &sup3; superscript 3
´ &#180; &acute; spacing acute
µ &#181; &micro; micro
¶ &#182; &para; paragraph
· &#183; &middot; middle dot
¸ &#184; &cedil; spacing cedilla
¹ &#185; &sup1; superscript 1
º &#186; &ordm; masculine ordinal indicator
» &#187; &raquo; angle quotation mark (right)
¼ &#188; &frac14; fraction 1/4
½ &#189; &frac12; fraction 1/2
¾ &#190; &frac34; fraction 3/4
¿ &#191; &iquest; inverted question mark
× &#215; &times; multiplication
÷ &#247; &divide; division
ISO 8859-1 Characters
Character Entity Number Entity Name Description
À &#192; &Agrave; capital a, grave accent
Á &#193; &Aacute; capital a, acute accent
 &#194; &Acirc; capital a, circumflex accent
à &#195; &Atilde; capital a, tilde
Ä &#196; &Auml; capital a, umlaut mark
Å &#197; &Aring; capital a, ring
Æ &#198; &AElig; capital ae
Ç &#199; &Ccedil; capital c, cedilla
È &#200; &Egrave; capital e, grave accent
É &#201; &Eacute; capital e, acute accent
Ê &#202; &Ecirc; capital e, circumflex accent
Ë &#203; &Euml; capital e, umlaut mark
Ì &#204; &Igrave; capital i, grave accent
Í &#205; &Iacute; capital i, acute accent
Î &#206; &Icirc; capital i, circumflex accent
Ï &#207; &Iuml; capital i, umlaut mark
Ð &#208; &ETH; capital eth, Icelandic
Ñ &#209; &Ntilde; capital n, tilde
Ò &#210; &Ograve; capital o, grave accent
Ó &#211; &Oacute; capital o, acute accent
Ô &#212; &Ocirc; capital o, circumflex accent
Õ &#213; &Otilde; capital o, tilde
Ö &#214; &Ouml; capital o, umlaut mark
Ø &#216; &Oslash; capital o, slash
Ù &#217; &Ugrave; capital u, grave accent
Ú &#218; &Uacute; capital u, acute accent
Û &#219; &Ucirc; capital u, circumflex accent
Ü &#220; &Uuml; capital u, umlaut mark
Ý &#221; &Yacute; capital y, acute accent
Þ &#222; &THORN; capital THORN, Icelandic
ß &#223; &szlig; small sharp s, German
à &#224; &agrave; small a, grave accent
á &#225; &aacute; small a, acute accent
â &#226; &acirc; small a, circumflex accent
ã &#227; &atilde; small a, tilde
ä &#228; &auml; small a, umlaut mark
å &#229; &aring; small a, ring
æ &#230; &aelig; small ae
ç &#231; &ccedil; small c, cedilla
è &#232; &egrave; small e, grave accent
é &#233; &eacute; small e, acute accent
ê &#234; &ecirc; small e, circumflex accent
ë &#235; &euml; small e, umlaut mark
ì &#236; &igrave; small i, grave accent
í &#237; &iacute; small i, acute accent
î &#238; &icirc; small i, circumflex accent
ï &#239; &iuml; small i, umlaut mark
ð &#240; &eth; small eth, Icelandic
ñ &#241; &ntilde; small n, tilde
ò &#242; &ograve; small o, grave accent
ó &#243; &oacute; small o, acute accent
ô &#244; &ocirc; small o, circumflex accent
õ &#245; &otilde; small o, tilde
ö &#246; &ouml; small o, umlaut mark
ø &#248; &oslash; small o, slash
ù &#249; &ugrave; small u, grave accent
ú &#250; &uacute; small u, acute accent
û &#251; &ucirc; small u, circumflex accent
ü &#252; &uuml; small u, umlaut mark
ý &#253; &yacute; small y, acute accent
þ &#254; &thorn; small thorn, Icelandic
ÿ &#255; &yuml; small y, umlaut mark
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Using Macros or other features to insert html code

Post by martin »

That's true, and if you have a complicated document, it may be more appropriate to use Nisus Writer's HTML export to save your document.
Post Reply