[Bin] Fix issue with awiki

This commit fixes an issue with awiki where selecting a page which title
contains whitespace would not open the page in the browser due to
remaining whitespace. This commit fixes it by replacing whitespace with
underscores.
This commit is contained in:
Lucien Cartier-Tilet 2021-01-02 13:22:03 +01:00
parent 182a8e62db
commit a0b258581a
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
1 changed files with 4 additions and 3 deletions

View File

@ -106,9 +106,10 @@ emacsclient -c -e "(delete-frame)" &
The first step is to create the list of all the pages that are currently stored on disk. ~arch-wiki-docs~ stores them in ~/usr/share/doc/arch-wiki/html/en~. A simple ~ls~ piped in three ~sed~ will give us a list of page titles. We then pipe that into rofi in dmenu mode in order to choose the page we want to display. By the way, setting the location of the HTML files will come in handy later.
#+BEGIN_SRC fish
set WLOCATION /usr/share/doc/arch-wiki/html/en/
set WPAGE (/bin/ls $WLOCATION | \
sed -e 's/_/ /g' -e 's/\.html$//' -e 's|.*/\(.*\)|\1|' | \
rofi -dmenu -p "Arch Wiki" -i | sed 's/ +/_/g')
set WPAGE (/bin/ls $WLOCATION | \
sed -e 's/_/ /g' -e 's/\.html$//' -e 's|.*/\(.*\)|\1|' | \
rofi -dmenu -p "Arch Wiki" -i)
set WPAGE (echo $WPAGE | sed -r 's/\s+/_/g')
#+END_SRC
Now, all I need to do is to send this list into rofi and tell it to open the result with our favorite browser with ~xdg-open~.