summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/asymptote/plain_strings.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/asymptote/plain_strings.asy')
-rw-r--r--Master/texmf-dist/asymptote/plain_strings.asy11
1 files changed, 5 insertions, 6 deletions
diff --git a/Master/texmf-dist/asymptote/plain_strings.asy b/Master/texmf-dist/asymptote/plain_strings.asy
index a466159d9c7..f4c856e8ad9 100644
--- a/Master/texmf-dist/asymptote/plain_strings.asy
+++ b/Master/texmf-dist/asymptote/plain_strings.asy
@@ -84,7 +84,8 @@ string verbatim(string s)
}
// Split a string into an array of substrings delimited by delimiter
-// If delimiter is an empty string, use space delimiter, discarding duplicates.
+// If delimiter is an empty string, use space delimiter but discard empty
+// substrings.
string[] split(string s, string delimiter="")
{
bool prune=false;
@@ -99,11 +100,9 @@ string[] split(string s, string delimiter="")
int N=length(delimiter);
int n=length(s);
while((i=find(s,delimiter,last)) >= 0) {
- if(i >= last)
+ if(i > last || (i == last && !prune))
S.push(substr(s,last,i-last));
last=i+N;
- if(prune)
- while(substr(s,last,1) == " ") ++last;
}
if(n > last || (n == last && !prune))
S.push(substr(s,last,n-last));
@@ -143,7 +142,7 @@ string italic(string s)
string baseline(string s, string template="\strut")
{
- return s != "" ? "\vphantom{"+template+"}"+s : s;
+ return s != "" && settings.tex != "none" ? "\vphantom{"+template+"}"+s : s;
}
string math(string s)
@@ -221,7 +220,7 @@ string format(real x, string locale="")
string phantom(string s)
{
- return "\phantom{"+s+"}";
+ return settings.tex != "none" ? "\phantom{"+s+"}" : "";
}
restricted int ocgindex=0;