Add words_to_urls() similar to urlize() but for patterns with blanks. - plumb - Open certain URL patterns with an ad-hoc opener (plumber)
 (HTM) hg clone https://bitbucket.org/iamleot/plumb
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) changeset 252ad827ffad07291ee45d181d912a3b3ee835ab
 (DIR) parent 4c58d0558e91b05305c2df2af8189db99cad828d
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Sun,  1 Apr 2018 01:23:16 
       
       Add words_to_urls() similar to urlize() but for patterns with blanks.
       
       Add initial support for patterns with blanks via words_to_urls() function.
       Adjust pipes in main() accordingly.
       
       Diffstat:
        dplumb |  14 ++++++++++++++
        1 files changed, 14 insertions(+), 0 deletions(-)
       ---
       diff -r 4c58d0558e91 -r 252ad827ffad dplumb
       --- a/dplumb    Sat Mar 31 01:15:44 2018 +0200
       +++ b/dplumb    Sun Apr 01 01:23:16 2018 +0200
       @@ -51,6 +51,18 @@
               tr -s '[:space:]' '\n'
        }
        
       +
       +#
       +# Parse words with blanks and urlize them without any blanks.
       +#
       +words_to_urls()
       +{
       +
       +       sed \
       +           -E -e 's;RFC[[:blank:]]+([0-9]+);rfc://\1 ;g'
       +}
       +
       +
        #
        # Convert predefined patterns to user-defined URLs.
        #
       @@ -122,12 +134,14 @@
        
               if [ "$dplumb_list" = "yes" ]; then
                       lines |
       +               words_to_urls |
                       one_word_per_line |
                       urlize |
                       extract_urls
               else
                       plumb "$(
                           lines |
       +                   words_to_urls |
                           one_word_per_line |
                           urlize |
                           extract_urls |