From de0390f9547ec35dab1c16c7dc59f46cf7e2a45a Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Sun, 25 Apr 2021 09:23:19 -0300 Subject: [PATCH] Reference ranges of two elements no longer represented as ranges. Examples: "R1-R2" is now "R1 R2", "R1-R3" remains unchanged. --- CHANGELOG.md | 2 ++ kibot/bom/bom.py | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1e182d1..f8d39dc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Errors and warnings from KiAuto now are printed as errors and warnings. - Schematic dependencies are sorted in the generated Makefiles. - Makefile variables KIBOT, DEBUG and LOGFILE can be defined from outside. +- Reference ranges of two elements no longer represented as ranges. + Examples: "R1-R2" is now "R1 R2", "R1-R3" remains unchanged. ### Fixed - Problem when using E/DRC filters and the output dir didn't exist. diff --git a/kibot/bom/bom.py b/kibot/bom/bom.py index 13d853f7..3173bcf1 100644 --- a/kibot/bom/bom.py +++ b/kibot/bom/bom.py @@ -137,12 +137,17 @@ class Joiner: if c != 0: refstr += sep S, E = Q + refstr += S[0]+str(S[1]) if S == E: - refstr += "%s%d" % S + # Only one element c += 1 + elif S[1]+1 == E[1]: + # Two elements, I think this is better than pretending this is a real range + refstr += sep+E[0]+str(E[1]) + c += 2 else: - # Do we have space? - refstr += "%s%d%s%s%d" % (S[0], S[1], dash, E[0], E[1]) + # A range + refstr += dash+E[0]+str(E[1]) c += 2 return refstr