Disallow leading space on prefix and trailing space on suffix
See original GitHub issueIn the MLZ extended schema, I’ve introduced a constraint to disallow leading space on (most) prefixes and trailing space on (most) suffixes, as described in this post to an earlier xbiblio-devel thread and this followup.
This renders most (if not all) styles in the official repo invalid under this schema version, but it will prevent the issues flagged by Andrea in the thread from arising in the MLZ styles. Adjusting the main repo styles to satisfy this constraint would require a large (maybe prohibitively large) amount of work, but as Andrea noted, the resulting styles would be cleaner.
Anyway, here’s the patch for reference:
commit bf62c155531bdad482a780f11be92abcf2948c4f
Author: Frank <biercenator@gmail.com>
Date: Thu Sep 22 01:00:32 2011 +0000
Treat unnecessary leading prefix and trailing suffix spaces as invalid.
diff --git a/csl.rnc b/csl.rnc
index 9020579..9514bac 100644
--- a/csl.rnc
+++ b/csl.rnc
@@ -255,6 +255,11 @@ div {
(localized-terms? & localized-dates* & localized-options?)
}
+
+ ## Strings for use in affixes
+ nospace-prefix = xsd:string { pattern = "([^ ].*)*" }
+ nospace-suffix = xsd:string { pattern = "(.*[^ ])*" }
+
localized-terms = element cs:terms { (simple-term | compound-term)+ }
term-attributes =
(( attribute form { cs-term-forms }?,
@@ -307,7 +312,7 @@ div {
font-formatting,
delimiter,
element cs:date-part {
- affixes, text-case, font-formatting, (month | day | year)
+ date-affixes, text-case, font-formatting, (month | day | year)
}+
}
@@ -520,7 +525,7 @@ div {
names =
element cs:names {
names-attributes,
- ((name?, et-al?, institution?) & name-label*),
+ (name-label-before?, name?, et-al?, institution?, name-label-after?),
substitute?
}
@@ -554,8 +559,16 @@ div {
}
## Similar to label as below, but inherits variable from <names> tag
- name-label = element cs:label {
+ name-label-before = element cs:label {
attribute form { cs-term-forms }?,
+ attribute prefix { nospace-prefix}?,
+ attribute suffix { text }?,
+ label-primitives
+ }
+ name-label-after = element cs:label {
+ attribute form { cs-term-forms }?,
+ attribute prefix { text }?,
+ attribute suffix { nospace-suffix }?,
label-primitives
}
@@ -636,7 +649,7 @@ div {
## order, the relevant `date-part`-elements, and by applying formatting,
## affixes on cs:date and cs:date-part.
element cs:date-part {
- affixes, text-case, font-formatting, (month | day | year)
+ date-affixes, text-case, font-formatting, (month | day | year)
}+,
delimiter)),
affixes,
@@ -740,11 +753,11 @@ div {
label =
element cs:label {
label-primitives,
+ affixes,
attribute variable { cs-numbers | "locator" | "page" },
attribute form { "long" | "short" | "symbol" }?
}
label-primitives =
- affixes,
font-formatting,
text-case,
strip-periods,
@@ -1031,6 +1044,9 @@ div {
## Formatting attributes.
div {
affixes =
+ attribute prefix { nospace-prefix }?,
+ attribute suffix { nospace-suffix }?
+ date-affixes =
attribute prefix { text }?,
attribute suffix { text }?
delimiter = attribute delimiter { text }?
Issue Analytics
- State:
- Created 12 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Removing Leading and Trailing Spaces in Excel & Google Docs
Learn a few simple techniques to ensure that all your text data in Excel or Google Docs is clean and tidy by eliminating...
Read more >Remove Spaces in Excel - Leading, Trailing and Double
In this tutorial, you will learn how to remove spaces in Excel. Trim function can remove leading and trailing spaces in text, double...
Read more >How to remove spaces in Excel - leading, trailing, non-breaking
You will learn how to delete leading and trailing spaces in a cell, eliminate extra spaces between words, get rid of non-breaking white...
Read more >Remove leading and trailing spaces from text - Excel formula
The TRIM function is fully automatic. It removes removes both leading and trailing spaces from text, and also "normalizes" multiple spaces between words...
Read more >How to remove leading and/or trailing spaces of a string in T ...
The example below removes the space at the end of each company by using RTRIM() function. FROM company; The query returns the name...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bdarcus I suggest we close this. Thoughts?
I also think we should keep this. While using groups is indeed best practice, there are a lot of cases where a simple affix is way easier.