[med-svn] [Git][med-team/ncbi-entrez-direct][master] 4 commits: New upstream version 19.2.20230331+dfsg

Aaron M. Ucko (@ucko) gitlab at salsa.debian.org
Fri Mar 31 22:55:22 BST 2023



Aaron M. Ucko pushed to branch master at Debian Med / ncbi-entrez-direct


Commits:
a0dd7d23 by Aaron M. Ucko at 2023-03-31T17:34:25-04:00
New upstream version 19.2.20230331+dfsg
- - - - -
e0cc5c7b by Aaron M. Ucko at 2023-03-31T17:35:37-04:00
Merge tag 'upstream/19.2.20230331+dfsg'

Upstream version 19.2.20230331(+dfsg).

- - - - -
abcf4cae by Aaron M. Ucko at 2023-03-31T17:48:12-04:00
xtract.1: Update for new release (19.2.20230331[+dfsg]).

Add Tag and Attribute Construction (-tag, -att, -cls, -slf, -end)
between (high-level) XML Generation and Element Selection and a Full
Exploration Command Precedence rundown between Validation and
Documentation (per upstream help, taking advantage of a stray .PD).

- - - - -
bc90e02f by Aaron M. Ucko at 2023-03-31T17:53:02-04:00
Finalize ncbi-entrez-direct 19.2.20230331+dfsg-1

... still to experimental.

- - - - -


5 changed files:

- debian/changelog
- debian/man/xtract.1
- eutils/misc.go
- eutils/xplore.go
- help/xtract-help.txt


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+ncbi-entrez-direct (19.2.20230331+dfsg-1) experimental; urgency=medium
+
+  * New upstream point release, still to experimental.
+  * debian/man/xtract.1: Update for new release.
+
+ -- Aaron M. Ucko <ucko at debian.org>  Fri, 31 Mar 2023 17:53:02 -0400
+
 ncbi-entrez-direct (19.2.20230330+dfsg-1) experimental; urgency=medium
 
   * New upstream incremental release; initially uploading to experimental


=====================================
debian/man/xtract.1
=====================================
@@ -1,4 +1,4 @@
-.TH XTRACT 1 2023-02-26 NCBI "NCBI Entrez Direct User's Manual"
+.TH XTRACT 1 2023-03-31 NCBI "NCBI Entrez Direct User's Manual"
 .SH NAME
 xtract \- NCBI Entrez Direct XML conversion and transformation tool
 .SH SYNOPSIS
@@ -64,6 +64,11 @@ xtract \- NCBI Entrez Direct XML conversion and transformation tool
 [\|\fB\-pkg\fP\ \fItag\fP\|]
 [\|\fB\-fwd\fP\ \fIstr\fP\|]
 [\|\fB\-awd\fP\ \fIstr\fP\|]
+[\|\fB\-tag\fP\ \fItag\fP\|]
+[\|\fB\-att\fP\ \fIkey\fP\ \fIvalue\fP\|]
+[\|\fB\-cls\fP\|]
+[\|\fB\-slf\fP\|]
+[\|\fB\-end\fP\ \fItag\fP\|]
 [\|\fB\-element\fP\ \fIelement\fP\|]
 [\|\fB\-first\fP\ \fIelement\fP\|]
 [\|\fB\-last\fP\ \fIelement\fP\|]
@@ -367,6 +372,22 @@ Foreword to print before subset.
 .TP
 \fB\-awd\fP\ \fIstr\fP
 Afterword to print after subset.
+.SS Tag and Attribute Construction
+.TP
+\fB\-tag\fP\ \fItag\fP
+Start with \fB<\fP\fItag\fP.
+.TP
+\fB\-att\fP\ \fIkey\fP\ \fIvalue\fP
+Attribute key and value.
+.TP
+\fB\-cls\fP
+Close with \fB>\fP.
+.TP
+\fB\-slf\fP
+Self\-close with \fB/>\fP.
+.TP
+\fB\-end\fP\ \fItag\fP
+End contents with \fB</\fP\fItag\fP\fB>\fP.
 .SS Element Selection
 .TP
 \fB\-element\fP\ \fIelement\fP
@@ -744,6 +765,26 @@ Display individual XML paths.
 .TP
 \fB\-contour\fP\ [\|\fIdelimiter\fP\|]
 Display XML paths to leaf nodes (delimited by \fB/\fP by default).
+.SS Full Exploration Command Precedence
+.PD 0
+.TP
+\fB\-pattern\fP
+.TP
+\fB\-path\fP
+.TP
+\fB\-division\fP
+.TP
+\fB\-group\fP
+.TP
+\fB\-branch\fP
+.TP
+\fB\-block\fP
+.TP
+\fB\-section\fP
+.TP
+\fB\-subset\fP
+.TP
+\fB\-unit\fP
 .PD
 .SS Documentation
 .TP


=====================================
eutils/misc.go
=====================================
@@ -2206,6 +2206,18 @@ func IsAllDigitsOrPeriod(str string) bool {
 	return true
 }
 
+// IsAllLettersOrDigits matches letters or digits
+func IsAllLettersOrDigits(str string) bool {
+
+	for _, ch := range str {
+		if !unicode.IsLetter(ch) && !unicode.IsDigit(ch) {
+			return false
+		}
+	}
+
+	return true
+}
+
 // IsNotASCII returns true for any character greater than 7-bits
 func IsNotASCII(str string) bool {
 


=====================================
eutils/xplore.go
=====================================
@@ -144,6 +144,11 @@ const (
 	TAB
 	RET
 	LBL
+	TAG
+	ATT
+	CLS
+	SLF
+	END
 	CLR
 	PFC
 	DEQ
@@ -429,6 +434,11 @@ var argTypeIs = map[string]ArgumentType{
 	"-tab":          CUSTOMIZATION,
 	"-ret":          CUSTOMIZATION,
 	"-lbl":          CUSTOMIZATION,
+	"-tag":          CUSTOMIZATION,
+	"-att":          CUSTOMIZATION,
+	"-cls":          CUSTOMIZATION,
+	"-slf":          CUSTOMIZATION,
+	"-end":          CUSTOMIZATION,
 	"-clr":          CUSTOMIZATION,
 	"-pfc":          CUSTOMIZATION,
 	"-deq":          CUSTOMIZATION,
@@ -503,6 +513,11 @@ var opTypeIs = map[string]OpType{
 	"-tab":          TAB,
 	"-ret":          RET,
 	"-lbl":          LBL,
+	"-tag":          TAG,
+	"-att":          ATT,
+	"-cls":          CLS,
+	"-slf":          SLF,
+	"-end":          END,
 	"-clr":          CLR,
 	"-pfc":          PFC,
 	"-deq":          DEQ,
@@ -1451,12 +1466,17 @@ func ParseArguments(cmdargs []string, pttrn string) *Block {
 				fmt.Fprintf(os.Stderr, "\nERROR: Unexpected position for %s command\n", txt)
 				os.Exit(1)
 			} else if txt == "-clr" {
-				// main loop runs out after trailing -clr, add another so this one will be executed
+				// main loop runs out after trailing -clr, add another one so this one will be executed
 				arguments = append(arguments, "-clr")
 				max++
+			} else if txt == "-cls" || txt == "-slf" {
+				// okay at end
 			} else if max < 2 || arguments[max-2] != "-lbl" {
 				fmt.Fprintf(os.Stderr, "\nERROR: Item missing after %s command\n", txt)
 				os.Exit(1)
+			} else if max < 3 || arguments[max-3] != "-att" {
+				fmt.Fprintf(os.Stderr, "\nERROR: Item missing after %s command\n", txt)
+				os.Exit(1)
 			}
 		}
 
@@ -1481,7 +1501,15 @@ func ParseArguments(cmdargs []string, pttrn string) *Block {
 				comm = append(comm, op)
 				status = UNSET
 			case ELEMENT:
-			case TAB, RET, PFX, SFX, SEP, LBL, PFC, DEQ, PLG, ELG, WRP, ENC, DEF, REG, EXP, COLOR:
+			case TAB, RET, PFX, SFX, SEP, LBL, TAG, ATT, END, PFC, DEQ, PLG, ELG, WRP, ENC, DEF, REG, EXP, COLOR:
+			case CLS:
+				op := &Operation{Type: LBL, Value: ">"}
+				comm = append(comm, op)
+				status = UNSET
+			case SLF:
+				op := &Operation{Type: LBL, Value: " />"}
+				comm = append(comm, op)
+				status = UNSET
 			case FWD, AWD, PKG:
 			case UNSET:
 				fmt.Fprintf(os.Stderr, "\nERROR: No -element before '%s'\n", str)
@@ -1676,6 +1704,24 @@ func ParseArguments(cmdargs []string, pttrn string) *Block {
 				op := &Operation{Type: status, Value: ConvertSlash(str)}
 				comm = append(comm, op)
 				status = UNSET
+			case TAG:
+				op := &Operation{Type: LBL, Value: "<" + ConvertSlash(str)}
+				comm = append(comm, op)
+				status = UNSET
+			case ATT:
+				op := &Operation{Type: LBL, Value: " " + ConvertSlash(str) + "="}
+				comm = append(comm, op)
+				if idx < max {
+					val := arguments[idx]
+					idx++
+					op := &Operation{Type: LBL, Value: "\"" + ConvertSlash(val) + "\""}
+					comm = append(comm, op)
+				}
+				status = UNSET
+			case END:
+				op := &Operation{Type: LBL, Value: "</" + ConvertSlash(str) + ">"}
+				comm = append(comm, op)
+				status = UNSET
 			case FWD:
 				cmds.Foreword = ConvertSlash(str)
 				status = UNSET
@@ -1841,6 +1887,7 @@ func ParseArguments(cmdargs []string, pttrn string) *Block {
 
 	// check for no -element or multiple -pattern commands
 	noElement := true
+	noClose := true
 	numPatterns := 0
 	for _, txt := range cmdargs {
 		if argTypeIs[txt] == EXTRACTION {
@@ -1851,6 +1898,8 @@ func ParseArguments(cmdargs []string, pttrn string) *Block {
 		} else if txt == "-select" {
 			noElement = false
 			head.Position = "select"
+		} else if txt == "-cls" || txt == "-slf" {
+			noClose = false
 		}
 	}
 
@@ -1864,7 +1913,7 @@ func ParseArguments(cmdargs []string, pttrn string) *Block {
 		os.Exit(1)
 	}
 
-	if noElement {
+	if noElement && noClose {
 		fmt.Fprintf(os.Stderr, "\nERROR: No -element statement in argument list\n")
 		os.Exit(1)
 	}
@@ -2310,7 +2359,27 @@ var (
 )
 
 // processClause handles comma-separated -element arguments
-func processClause(curr *XMLNode, stages []*Step, mask, prev, pfx, sfx, plg, sep, def, reg, exp string, wrp bool, status OpType, index, level int, variables map[string]string, transform map[string]string, srchr *FSMSearcher, histogram map[string]int) (string, bool) {
+func processClause(
+	curr *XMLNode,
+	stages []*Step,
+	mask string,
+	prev string,
+	pfx string,
+	sfx string,
+	plg string,
+	sep string,
+	def string,
+	reg string,
+	exp string,
+	wrp bool,
+	status OpType,
+	index int,
+	level int,
+	variables map[string]string,
+	transform map[string]string,
+	srchr *FSMSearcher,
+	histogram map[string]int,
+) (string, bool) {
 
 	if curr == nil || stages == nil {
 		return "", false
@@ -4661,7 +4730,20 @@ func processClause(curr *XMLNode, stages []*Step, mask, prev, pfx, sfx, plg, sep
 }
 
 // processInstructions performs extraction commands on a subset of XML
-func processInstructions(commands []*Operation, curr *XMLNode, mask, tab, ret string, index, level int, variables map[string]string, transform map[string]string, srchr *FSMSearcher, histogram map[string]int, accum func(string)) (string, string) {
+func processInstructions(
+	commands []*Operation,
+	curr *XMLNode,
+	mask string,
+	tab string,
+	ret string,
+	index int,
+	level int,
+	variables map[string]string,
+	transform map[string]string,
+	srchr *FSMSearcher,
+	histogram map[string]int,
+	accum func(string),
+) (string, string) {
 
 	if accum == nil {
 		return tab, ret
@@ -5433,7 +5515,19 @@ func conditionsAreSatisfied(conditions []*Operation, curr *XMLNode, mask string,
 // RECURSIVELY PROCESS EXPLORATION COMMANDS AND XML DATA STRUCTURE
 
 // processCommands visits XML nodes, performs conditional tests, and executes data extraction instructions
-func processCommands(cmds *Block, curr *XMLNode, tab, ret string, index, level int, variables map[string]string, transform map[string]string, srchr *FSMSearcher, histogram map[string]int, accum func(string)) (string, string) {
+func processCommands(
+	cmds *Block,
+	curr *XMLNode,
+	tab string,
+	ret string,
+	index int,
+	level int,
+	variables map[string]string,
+	transform map[string]string,
+	srchr *FSMSearcher,
+	histogram map[string]int,
+	accum func(string),
+) (string, string) {
 
 	if accum == nil {
 		return tab, ret


=====================================
help/xtract-help.txt
=====================================
@@ -114,6 +114,14 @@ XML Generation
   -fwd             Foreword to print before subset
   -awd             Afterword to print after subset
 
+Tag and Attribute Construction
+
+  -tag             Start with "<" + object name
+  -att             Attribute key and value
+  -cls             Close with ">"
+  -slf             Self-close with " />"
+  -end             End contents with "</" + object name + ">"
+
 Element Selection
 
   -element         Print all items that match tag name
@@ -304,6 +312,19 @@ Summary
   -contour         Display XML paths to leaf nodes
                      [delimiter]
 
+Full Exploration Command Precedence
+
+  -pattern
+  -path
+  -division
+  -group
+  -branch
+  -block
+  -section
+  -subset
+  -unit
+  -element
+
 Documentation
 
   -help            Print this document



View it on GitLab: https://salsa.debian.org/med-team/ncbi-entrez-direct/-/compare/3ddd4a2587fadda06932d9940a49fa3038b602ed...bc90e02f24494bc0226ba30860eda29009710578

-- 
View it on GitLab: https://salsa.debian.org/med-team/ncbi-entrez-direct/-/compare/3ddd4a2587fadda06932d9940a49fa3038b602ed...bc90e02f24494bc0226ba30860eda29009710578
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20230331/c74705a1/attachment-0001.htm>


More information about the debian-med-commit mailing list