Compare commits
	
		
			7 Commits
		
	
	
		
			v2.1.1
			...
			c2f99c259d
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| c2f99c259d | |||
| c6e9cb3af4 | |||
| 70bba87946 | |||
| aacbf51475 | |||
| 2136ba3f69 | |||
| 9eafbe43eb | |||
| 
						 | 
					4a8e51c3c9 | 
							
								
								
									
										37
									
								
								Changelog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Changelog
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					2.3:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * New: access 'url' entry in sqlite databases.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2.2.1:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * Fix: Missing quotes in filter interpreter.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2.2:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * New: Allow for the value of other entries to be in the 'sed' command of a
 | 
				
			||||||
 | 
						 filter. (May break existing configurations in cases where sed command
 | 
				
			||||||
 | 
						 uses a '%'.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2.1.5:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * Fixed: Properly escape entries with a '%'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2.1.4:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * New: Allow for comma separated list of references in aux_cmd.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2.1.3:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * Fixed: entries that contain a '%' do not cause a failure.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * New: access 'bibtex' entry in sqlite databases
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2.1.2:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * Fixed: 'extra' entries would override database entries if they shared the
 | 
				
			||||||
 | 
					           same token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
## Copyright Ian Jauslin 2015-2017
 | 
					## Copyright Ian Jauslin 2015-2023
 | 
				
			||||||
## 
 | 
					## 
 | 
				
			||||||
## Licensed under the Apache License, Version 2.0 (the "License");
 | 
					## Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
## you may not use this file except in compliance with the License.
 | 
					## you may not use this file except in compliance with the License.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								NOTICE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								NOTICE
									
									
									
									
									
								
							@@ -1,2 +1,2 @@
 | 
				
			|||||||
BBlog
 | 
					BBlog
 | 
				
			||||||
Copyright Ian Jauslin 2015-2017
 | 
					Copyright Ian Jauslin 2015-2023
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										41
									
								
								bin/BBlog
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								bin/BBlog
									
									
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Copyright Ian Jauslin 2015-2017
 | 
					## Copyright Ian Jauslin 2015-2023
 | 
				
			||||||
## 
 | 
					## 
 | 
				
			||||||
## Licensed under the Apache License, Version 2.0 (the "License");
 | 
					## Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
## you may not use this file except in compliance with the License.
 | 
					## you may not use this file except in compliance with the License.
 | 
				
			||||||
@@ -16,10 +16,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# directory containing the engine files
 | 
					# directory containing the engine files
 | 
				
			||||||
enginedir=/usr/share/BBlog/engines
 | 
					enginedir=/usr/share/BBlog/engines
 | 
				
			||||||
enginedir=/home/ian/Programs/BBlog2/engines
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# version
 | 
					# version
 | 
				
			||||||
version=2.1
 | 
					version=2.3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function print_config {
 | 
					function print_config {
 | 
				
			||||||
  echo "engine: $engine"
 | 
					  echo "engine: $engine"
 | 
				
			||||||
@@ -223,11 +222,16 @@ function replace_format {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # apply filter
 | 
					    # apply filter
 | 
				
			||||||
    if [ -n "$filter" ]; then
 | 
					    if [ -n "$filter" ]; then
 | 
				
			||||||
      sed_cmd=$(eval "echo \$filter_$filter")
 | 
					      # replace '%' inside filter text
 | 
				
			||||||
 | 
					      sed_cmd=$(replace_format "$(eval echo \$filter_$filter)")
 | 
				
			||||||
      replacement=$(eval "echo \$$field" | sed -r "$sed_cmd" )
 | 
					      replacement=$(eval "echo \$$field" | sed -r "$sed_cmd" )
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      replacement=$(eval "echo \$$field")
 | 
					      replacement=$(eval "echo \$$field")
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    # escape '%' in replacement
 | 
				
			||||||
 | 
					    replacement="${replacement//\%/::iansays:percent::}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    out="${out//\%$command\%/$replacement}"
 | 
					    out="${out//\%$command\%/$replacement}"
 | 
				
			||||||
  done
 | 
					  done
 | 
				
			||||||
@@ -235,6 +239,10 @@ function replace_format {
 | 
				
			|||||||
  # finish replacing newlines
 | 
					  # finish replacing newlines
 | 
				
			||||||
  out="${out//\\n/%}"
 | 
					  out="${out//\\n/%}"
 | 
				
			||||||
  out=$(echo "$out" | tr "%" "\n")
 | 
					  out=$(echo "$out" | tr "%" "\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # un-escape '%' in replacement
 | 
				
			||||||
 | 
					  out="${out//::iansays:percent::/\%}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  echo "$out"
 | 
					  echo "$out"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -266,17 +274,20 @@ function inverse_map_citeref {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  foundref=0
 | 
					  foundref=0
 | 
				
			||||||
  # sift through aux file
 | 
					  # sift through aux file
 | 
				
			||||||
  grep -h "$aux_cmd" $aux | while read -r ref; do
 | 
					  grep -h "$aux_cmd" $aux | while read -r refs; do
 | 
				
			||||||
    eval "ref=\${ref#$aux_cmd}"
 | 
					    eval "refs=\${refs#$aux_cmd}"
 | 
				
			||||||
    ref="${ref%\}}"
 | 
					    refs="${ref%\}}"
 | 
				
			||||||
    # replace the ref via the ref_map
 | 
					    # can be a comma separated list
 | 
				
			||||||
    possibleref=$(map_citeref "$ref")
 | 
					    for ref in $(echo -n "$refs" | tr ',' '\n'); do
 | 
				
			||||||
    # check whether the ref is the right one
 | 
					      # replace the ref via the ref_map
 | 
				
			||||||
    if [ "$possibleref" = "$newref" ]; then
 | 
					      possibleref=$(map_citeref "$ref")
 | 
				
			||||||
      echo "$ref"
 | 
					      # check whether the ref is the right one
 | 
				
			||||||
      foundref=1
 | 
					      if [ "$possibleref" = "$newref" ]; then
 | 
				
			||||||
      return 1
 | 
						echo "$ref"
 | 
				
			||||||
    fi
 | 
						foundref=1
 | 
				
			||||||
 | 
						return 1
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					    done
 | 
				
			||||||
  done && echo "$foundref$newref"
 | 
					  done && echo "$foundref$newref"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
base_SQL="SELECT title,author,journal,year,token,doi,arxiv,citeref,prauth FROM bibliography"
 | 
					base_SQL="SELECT title,author,journal,year,token,doi,arxiv,citeref,prauth,bibtex,url FROM bibliography"
 | 
				
			||||||
base_SQL_noprauth="SELECT title,author,journal,year,token,doi,arxiv,citeref FROM bibliography"
 | 
					base_SQL_noprauth="SELECT title,author,journal,year,token,doi,arxiv,citeref,bibtex,url FROM bibliography"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# add quotes
 | 
					# add quotes
 | 
				
			||||||
function SQL_addquotes {
 | 
					function SQL_addquotes {
 | 
				
			||||||
@@ -23,32 +23,36 @@ function generate_SQL_alpha {
 | 
				
			|||||||
  exists_citeref=0
 | 
					  exists_citeref=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # sift through aux file
 | 
					  # sift through aux file
 | 
				
			||||||
  grep -h "$aux_cmd" $aux | while read -r citeref; do
 | 
					  grep -h "$aux_cmd" $aux | while read -r citerefs; do
 | 
				
			||||||
    eval "citeref=\${citeref#$aux_cmd}"
 | 
					    eval "citerefs=\${citerefs#$aux_cmd}"
 | 
				
			||||||
    citeref="${citeref%\}}"
 | 
					    citerefs="${citerefs%\}}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # replace the citeref with a ref_map if there is any
 | 
					    # can be a comma separated list
 | 
				
			||||||
    if [ -n "$ref_map" ]; then
 | 
					    for citeref in $(echo -n "$citerefs" | tr ',' '\n'); do
 | 
				
			||||||
      citeref=$(map_citeref "$citeref")
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Only query the db if there is no matching extra entry
 | 
					      # replace the citeref with a ref_map if there is any
 | 
				
			||||||
    foundit=0
 | 
					      if [ -n "$ref_map" ]; then
 | 
				
			||||||
    if [ ${#extra} -gt 0 ]; then
 | 
						citeref=$(map_citeref "$citeref")
 | 
				
			||||||
      for entry in "${extra[@]}"; do
 | 
					      fi
 | 
				
			||||||
	ref="${entry#*:*:}"
 | 
					
 | 
				
			||||||
	ref="${ref%%:*}"
 | 
					      # Only query the db if there is no matching extra entry
 | 
				
			||||||
	if [ "$ref" = "$citeref" ]; then
 | 
					      foundit=0
 | 
				
			||||||
	  foundit=1
 | 
					      if [ ${#extra} -gt 0 ]; then
 | 
				
			||||||
	  break
 | 
						for entry in "${extra[@]}"; do
 | 
				
			||||||
	fi
 | 
						  ref="${entry#*:}"
 | 
				
			||||||
      done
 | 
						  ref="${ref%%:*}"
 | 
				
			||||||
    fi
 | 
						  if [ "$ref" = "$citeref" ]; then
 | 
				
			||||||
    
 | 
						    foundit=1
 | 
				
			||||||
    if [ "$foundit" = 0 ]; then
 | 
						    break
 | 
				
			||||||
      echo -n "$citeref' OR citeref='"
 | 
						  fi
 | 
				
			||||||
      exists_citeref=1
 | 
						done
 | 
				
			||||||
    fi
 | 
					      fi
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      if [ "$foundit" = 0 ]; then
 | 
				
			||||||
 | 
						echo -n "$citeref' OR citeref='"
 | 
				
			||||||
 | 
						exists_citeref=1
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					    done
 | 
				
			||||||
  done
 | 
					  done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # if there are no citerefs close '
 | 
					  # if there are no citerefs close '
 | 
				
			||||||
@@ -70,46 +74,50 @@ function fetch_BBlog_entries_appearance {
 | 
				
			|||||||
  citeref_list=""
 | 
					  citeref_list=""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # sift through aux file
 | 
					  # sift through aux file
 | 
				
			||||||
  grep -h "$aux_cmd" $aux | while read -r citeref; do
 | 
					  grep -h "$aux_cmd" $aux | while read -r citerefs; do
 | 
				
			||||||
    eval "citeref=\${citeref#$aux_cmd}"
 | 
					    eval "citerefs=\${citerefs#$aux_cmd}"
 | 
				
			||||||
    citeref="${citeref%\}}"
 | 
					    citerefs="${citerefs%\}}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # replace the citeref with a ref_map if there is any
 | 
					    # can be a comma separated list
 | 
				
			||||||
    if [ -n "$ref_map" ]; then
 | 
					    for citeref in $(echo -n "$citerefs" | tr ',' '\n'); do
 | 
				
			||||||
      citeref=$(map_citeref "$citeref")
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # check whether the reference was already cited
 | 
					      # replace the citeref with a ref_map if there is any
 | 
				
			||||||
    citeref_list="$citeref_list;"
 | 
					      if [ -n "$ref_map" ]; then
 | 
				
			||||||
    if $(echo "$citeref_list" | grep -q ";$citeref;"); then
 | 
						citeref=$(map_citeref "$citeref")
 | 
				
			||||||
      # remove trailing ';'
 | 
					 | 
				
			||||||
      citeref_list="${citeref_list%;}"
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      citeref_list="$citeref_list$citeref"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      # Only query the db if there is no matching extra entry
 | 
					 | 
				
			||||||
      foundit=0
 | 
					 | 
				
			||||||
      if [ ${#extra} -gt 0 ]; then
 | 
					 | 
				
			||||||
	for entry in "${extra[@]}"; do
 | 
					 | 
				
			||||||
	  ref="${entry#*:}"
 | 
					 | 
				
			||||||
	  ref="${ref%%:*}"
 | 
					 | 
				
			||||||
	  if [ "$ref" = "$citeref" ]; then
 | 
					 | 
				
			||||||
	    foundit=1
 | 
					 | 
				
			||||||
	    break
 | 
					 | 
				
			||||||
	  fi
 | 
					 | 
				
			||||||
	done
 | 
					 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
      
 | 
					
 | 
				
			||||||
      if [ "$foundit" = 0 ]; then
 | 
					      # check whether the reference was already cited
 | 
				
			||||||
	SQL="$base_SQL_noprauth WHERE citeref='$citeref'"
 | 
					      citeref_list="$citeref_list;"
 | 
				
			||||||
	sqlite3 -line "$db" "$SQL" | SQL_addquotes
 | 
					      if $(echo "$citeref_list" | grep -q ";$citeref;"); then
 | 
				
			||||||
 | 
						# remove trailing ';'
 | 
				
			||||||
 | 
						citeref_list="${citeref_list%;}"
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
	echo "citeref=$citeref"
 | 
						citeref_list="$citeref_list$citeref"
 | 
				
			||||||
      fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # add an empty line
 | 
						# Only query the db if there is no matching extra entry
 | 
				
			||||||
      echo ""
 | 
						foundit=0
 | 
				
			||||||
    fi
 | 
						if [ ${#extra} -gt 0 ]; then
 | 
				
			||||||
 | 
						  for entry in "${extra[@]}"; do
 | 
				
			||||||
 | 
						    ref="${entry#*:}"
 | 
				
			||||||
 | 
						    ref="${ref%%:*}"
 | 
				
			||||||
 | 
						    if [ "$ref" = "$citeref" ]; then
 | 
				
			||||||
 | 
						      foundit=1
 | 
				
			||||||
 | 
						      break
 | 
				
			||||||
 | 
						    fi
 | 
				
			||||||
 | 
						  done
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if [ "$foundit" = 0 ]; then
 | 
				
			||||||
 | 
						  SQL="$base_SQL_noprauth WHERE citeref='$citeref'"
 | 
				
			||||||
 | 
						  sqlite3 -line "$db" "$SQL" | SQL_addquotes
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						  echo "citeref=$citeref"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# add an empty line
 | 
				
			||||||
 | 
						echo ""
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					    done
 | 
				
			||||||
  done
 | 
					  done
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
.Dd $Mdocdate: May 2 2017 $
 | 
					.Dd $Mdocdate: July 26 2023 $
 | 
				
			||||||
.Dt BBLOG 2.1
 | 
					.Dt BBLOG 2.3
 | 
				
			||||||
.Os
 | 
					.Os
 | 
				
			||||||
.Sh NAME
 | 
					.Sh NAME
 | 
				
			||||||
.Nm BBlog
 | 
					.Nm BBlog
 | 
				
			||||||
@@ -194,6 +194,6 @@ automatically adds a letter (from 'b' to 'z') at the end of non-unique tokens, i
 | 
				
			|||||||
.Nm
 | 
					.Nm
 | 
				
			||||||
was written by Ian Jauslin.
 | 
					was written by Ian Jauslin.
 | 
				
			||||||
.Sh COPYRIGHT
 | 
					.Sh COPYRIGHT
 | 
				
			||||||
copyright Ian Jauslin 2015-2017
 | 
					copyright Ian Jauslin 2015-2023
 | 
				
			||||||
.Sh SEE ALSO
 | 
					.Sh SEE ALSO
 | 
				
			||||||
.Sx BBlog-sqlite Ns (7)
 | 
					.Sx BBlog-sqlite Ns (7)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
.Dd $Mdocdate: May 2 2017 $
 | 
					.Dd $Mdocdate: July 26 2023 $
 | 
				
			||||||
.Dt BBLOG-sqlite
 | 
					.Dt BBLOG-sqlite
 | 
				
			||||||
.Os
 | 
					.Os
 | 
				
			||||||
.Sh DESCRIPTION
 | 
					.Sh DESCRIPTION
 | 
				
			||||||
@@ -28,11 +28,13 @@ label of the reference
 | 
				
			|||||||
.It prauth
 | 
					.It prauth
 | 
				
			||||||
bibliography entries are ordered alphabetically with respect to this entry
 | 
					bibliography entries are ordered alphabetically with respect to this entry
 | 
				
			||||||
label of the reference
 | 
					label of the reference
 | 
				
			||||||
 | 
					.It url
 | 
				
			||||||
 | 
					link to paper
 | 
				
			||||||
.El
 | 
					.El
 | 
				
			||||||
.Sh AUTHORS
 | 
					.Sh AUTHORS
 | 
				
			||||||
The sqlite BBlog engine was written by Ian Jauslin.
 | 
					The sqlite BBlog engine was written by Ian Jauslin.
 | 
				
			||||||
.Sh COPYRIGHT
 | 
					.Sh COPYRIGHT
 | 
				
			||||||
copyright Ian Jauslin 2015-2017
 | 
					copyright Ian Jauslin 2015-2023
 | 
				
			||||||
.Sh SEE ALSO
 | 
					.Sh SEE ALSO
 | 
				
			||||||
.Sx BBlog Ns (1) ,
 | 
					.Sx BBlog Ns (1) ,
 | 
				
			||||||
.Sx sqlite3 Ns (1)
 | 
					.Sx sqlite3 Ns (1)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user