Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.sao.ru/hq/sts/linux/doc/nedit/macro/4/4-18.shtml
Дата изменения: Unknown
Дата индексирования: Sat Sep 11 22:18:12 2010
Кодировка:

Поисковые слова: voyager
NEdit.org

.
.   
NEdit.org
   .

Home
 - News - Download - Documentation - Search - FTP     
.
.
  

Run par

[Back]

Here are two macros that will interface to the par paragraph reformatter. Source code for Par can be found here.

If no selection exists, they will select the current paragraph.

The first macro (Alt+Q) will simply run par with some default options. The second (Shift+Alt+Q) will prompt you for additional options.

Format paragraph:Alt+Q::: {
   # If no selection, select paragraph
   if ($selection_start == -1) {
      # select paragraph
      start = search("^$", $cursor, "regex", "backward")+1
      end = search("^$", $cursor, "regex")
      select(start,end)
   }

   # Get input and run par
   input=get_selection()
   result=shell_command("par -rTbgqR -B=.\\\\?_A_a -Q=_s\\\\>\\\\|",input)

   # Check for errors and replace text
   if ( $shell_cmd_status != 0 ) {
      dialog(result,"Ok")
   } else {
      set_cursor_pos($selection_end+1)
      replace_selection(result)
   }
}
Format para. w/options:Shift+Alt+Q::: {
   # If no selection, select paragraph
   if ($selection_start == -1) {
      # select paragraph
      start = search("^$", $cursor, "regex", "backward")+1
      end = search("^$", $cursor, "regex")
      select(start,end)
   }

   # Get input and run par
   input=get_selection()
   options=string_dialog("Par Options:","Ok","Cancel")
   if  ( $string_dialog_button == 2 ) {
      return
   }
   result=shell_command("par -rTbgqR -B=.\\\\?_A_a -Q=_s\\\\>\\\\| " options,input)

   # Check for errors and replace text
   if ( $shell_cmd_status != 0 ) {
      dialog(result,"Ok")
   } else {
      set_cursor_pos($selection_end+1)
      replace_selection(result)
   }
}
[Back]

. Released on  Wed, 21 Nov 2001  by C. Denat  

  
Visit our sponsor
Check Metrolink

© NEdit.org
1999-2001
All rights reserved


.