text 2 wiki.awk

Last edit

Summary: text_2_wiki.awk

Added:

> #: Use **{{{|}}}** to make bold; [[...| the \xa0=\240 nbsp; character


#:	C:\#\lib\awk\utl\text_2_wiki.awk
#:	2012-09-15  23:40:11	#:rod.t_2012
#:	This file is http://awk.freeshell.org/text_2_wiki.awk  (g0ph3r_)
#:	Converts text to a format for the awk wiki:  http://awk.freeshell.org/HomePage
#:	See: http://awk.freeshell.org/How_to_edit
#:	Adds a \\ to end of every line to force line break
#:	except those ending in ` or \\ (removes the `)
#:	Converts tabs \t to four spaces.
#:	Converts double spaces to    (nojoy inside [[ ]])
#:	Prints results to stdout and copies to the clipboard.
#:	Remember to escape | \\ // * # == etc. eg {{{|}}}
#:	Use **{{{|}}}** to make bold; [[...| the \xa0=\240 nbsp; character
#: %awk% -f C:\#\lib\awk\utl\text_2_wiki.awk -- C:\###\awk\wiki\FIXES.raw.txt > NUL:
##  _____________________________________________

{
	if($0 ~ /\\\\$/)  {
		s = $0;
	}  else  if($0 ~ /`$/)  {
		s = substr($0, 1, length($0) - 1);
	}  else	s = $0 "\\\\";
	gsub("\t", "    ", s);
	gsub("  ", "\\ \\ ", s);
#:	& Special in gsub, use "\\&"
	t = t ? (t "\n" s) : s;
}

END	{  print(t);  print(t) | "%u%gclip.exe";
}
##  _____________________________________________

#:  Comments:	2012-09-09  15:46:51
#:  paradigm:  A, B.. arrays;  s..v strings;  i..n integers;  w..z reals
#:  regular expression metacharacters: \ ^ $ . [ ] | ( ) * + ?  escape with \
#:  filenames may Not contain:  \  /  :  *  ?  "  <  >  |
#:  cmd.exe special:  &  "  ^  %  <  >  |  =  (  )  @
#:  start ["title"] [/min|/max] [/low|/high] [/wait] [/b] cmd
#:  start /wait exefile & call echo.^%ERRORLEVEL^%
#:  %u%nircmd.exe exec show|hide|min|max exefile opts
#:    shexec open|print filename
#:  \a \007 sp\040 !\041 "\042 #\043 $\044 %\045 &\046
#:  '\047 *\052 +\053 -\055 .\056 /\057 <\074 =\075 >\076
#:  ?\077 @\100 \\134 ^\136 `\140 |\174 ~\176 ' '\240
##  _____________________________________________
#:	EOF