for details see: https://github.com/moosotc/llpp/issues/45#issuecomment-1028683741
Unified · Split
| @@ -172,7 +172,7 @@ o Text searching is very naive|} · 171 unmodified lines | ||
| 172 | 172 | open Utils |
| 173 | 173 | |
| 174 | 174 | let gotourl launcher url = |
| 175 | − let command = Str.global_replace Utils.Re.percent url launcher in | |
| 175 | + let command = Str.global_replace Utils.Re.percents url launcher in | |
| 176 | 176 | try ignore @@ spawn command [] |
| 177 | 177 | with exn -> dolog "failed to execute `%s': %s" command @@ exntos exn |
| 178 | 178 | |
| @@ -61,7 +61,17 @@ let launchpath () = · 60 unmodified lines | ||
| 61 | 61 | if emptystr conf.pathlauncher |
| 62 | 62 | then adderrmsg "path launcher" "command set" |
| 63 | 63 | else |
| 64 | − let cmd = Str.global_replace Re.percent !S.path conf.pathlauncher in | |
| 64 | + let n = | |
| 65 | + match !S.layout with | |
| 66 | + | l :: _ -> string_of_int l.pageno | |
| 67 | + | _ -> E.s | |
| 68 | + in | |
| 69 | + let cmd = Str.global_replace Re.percents !S.path conf.pathlauncher in | |
| 70 | + let cmd = | |
| 71 | + if nonemptystr n | |
| 72 | + then Str.global_replace Re.percentp n cmd | |
| 73 | + else cmd | |
| 74 | + in | |
| 65 | 75 | match spawn cmd [] with |
| 66 | 76 | | exception exn -> |
| 67 | 77 | adderrfmt "spawn" "failed to execute `%s': %s" cmd @@ exntos exn |
| @@ -2790,7 +2800,7 @@ let gotounder = function · 2722 unmodified lines | ||
| 2790 | 2800 | "don't know where to save attachment" |
| 2791 | 2801 | else |
| 2792 | 2802 | let filename = Ffi.getfileannot opaque slinkindex in |
| 2793 | − let savecmd = Str.global_replace Re.percent filename conf.savecmd in | |
| 2803 | + let savecmd = Str.global_replace Re.percents filename conf.savecmd in | |
| 2794 | 2804 | let path = |
| 2795 | 2805 | getcmdoutput |
| 2796 | 2806 | (adderrfmt savecmd |
| @@ -3118,7 +3128,7 @@ let save () = · 321 unmodified lines | ||
| 3118 | 3128 | then adderrmsg "savepath-command is empty" |
| 3119 | 3129 | "don't know where to save modified document" |
| 3120 | 3130 | else |
| 3121 | − let savecmd = Str.global_replace Re.percent !S.path conf.savecmd in | |
| 3131 | + let savecmd = Str.global_replace Re.percents !S.path conf.savecmd in | |
| 3122 | 3132 | let path = |
| 3123 | 3133 | getcmdoutput |
| 3124 | 3134 | (adderrfmt savecmd "failed to obtain path to the saved copy: %s") |
| @@ -113,7 +113,8 @@ let getenvdef name def = · 112 unmodified lines | ||
| 113 | 113 | |
| 114 | 114 | module Re = struct |
| 115 | 115 | let crlf = Str.regexp "[\r\n]" |
| 116 | − let percent = Str.regexp "%s" | |
| 116 | + let percents = Str.regexp "%s" | |
| 117 | + let percentp = Str.regexp "%p" | |
| 117 | 118 | let whitespace = Str.regexp "[ \t]" |
| 118 | 119 | end |
| 119 | 120 | |
| @@ -41,7 +41,8 @@ val getenvdef : string -> string -> string · 40 unmodified lines | ||
| 41 | 41 | module Re : |
| 42 | 42 | sig |
| 43 | 43 | val crlf : Str.regexp |
| 44 | − val percent : Str.regexp | |
| 44 | + val percents : Str.regexp | |
| 45 | + val percentp : Str.regexp | |
| 45 | 46 | val whitespace : Str.regexp |
| 46 | 47 | end |
| 47 | 48 | val addchar : string -> char -> string |