Added small script to process bibtex files

This commit is contained in:
Jean-Francois Dockes 2018-02-09 09:30:41 +01:00
parent 77a3cc2e01
commit 116318f1f5
4 changed files with 28 additions and 0 deletions

View File

@ -589,6 +589,7 @@ filters/rcl7z \
filters/rclabw \
filters/rclaptosidman \
filters/rclaudio \
filters/rclbibtex.sh \
filters/rclcheckneedretry.sh \
filters/rclchm \
filters/rcldia \

23
src/filters/rclbibtex.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
# Remove unwanted data from bibtex file by deleting "bad" lines and
# cleaning "good" ones.
if test "X$RECOLL_FILTER_FORPREVIEW" = "Xyes" ; then
sed \
-e '/^$/N;/^\n$/D' \
-e '/(bibdsk.*|month|bibsource|crossref|ee|groups|owner|pages|timestamp|url|file|price|citeulike.*|markedentry|posted-at)[[:space:]=]*/I d' \
-e '/@[^{]*{/ d' \
\
-e 's/{//g' \
-e 's/},\?$//g' \
-e 's/^[ ]*//' \
< $1
else
sed -e '/(bibdsk.*|month|bibsource|crossref|ee|groups|owner|pages|timestamp|url|file|price|citeulike.*|markedentry|posted-at)[[:space:]=]*/I d' \
-e '/@[^{]*{/ d' \
\
-e 's/^[^{]*{//g' \
-e 's/},\?$//g' \
-e 's/({|}|=)//g' \
< $1
fi

View File

@ -166,6 +166,7 @@ text/x-c+ = internal
text/x-csharp = internal text/plain
text/css = internal text/plain
application/javascript = internal text/plain
text/x-bibtex = exec rclbibtex.sh ; mimetype = text/plain
text/x-csv = internal text/plain
text/x-fictionbook = exec rclfb2
text/x-gaim-log = exec rclgaim
@ -284,6 +285,7 @@ text/x-fictionbook = document
text/x-html-aptosid-man = aptosid-book
text/x-html-sidux-man = sidux-book
text/x-ini = txt
text/x-bibtex = txt
text/x-lua = source
text/x-java = source
text/x-mail = message
@ -348,6 +350,7 @@ text = \
text/html \
text/plain \
text/rtf \
text/x-bibtex \
text/x-c \
text/x-c++ \
text/x-c+ \

View File

@ -10,6 +10,7 @@
.srt = text/x-srt
.ini = text/x-ini
.csv = text/x-csv
.bib = text/x-bibtex
# Source files.
# Defining them with specific types allows using a specific ext viewer (in