Titanium JIRA Archive
Alloy (ALOY)

[ALOY-793] Build fails if using ' ' character as text in styles .tss

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-07-01T15:27:32.000+0000
Affected Version/sAlloy 1.2.1, Alloy 1.2.0, Alloy 1.1.3
Fix Version/sAlloy 1.5.0
ComponentsStyling
Labelsqe-3.4.0, qe-manualtest
ReporterFederico Casali
AssigneeFeon Sua Xin Miao
Created2013-08-17T00:52:25.000+0000
Updated2014-09-12T16:38:38.000+0000

Description

Problem description

When using the ' \ ' character in some text defined in the styles .tss files, Alloy compiler fails instead of ignoring it. If setting it in the view .xml (for example as a Label text), the \ character is ignored as expected.

Steps to reproduce

1. Use following sample

index.xml
<Alloy>
	<Window>
		<Label top=5 id='topLabel'></Label>
		<View id='mainview'>
			<Label id='label'>foo \ bar</Label>
		</View>
	</Window>
</Alloy>
app.tss
"Label":{
	font:{
		fontSize:'18dp'
	}
}

"#topLabel":{
	text:'foo \ bar'
}

2. Build and run (any platform/device)

Result: Alloy compile fails.
[INFO] :   ----- MVC GENERATION -----
[INFO] :   [app.tss] global style processing...
[ERROR] :  [ERROR] Error processing style "/Users/fcasali/Documents/Appcelerator_Studio_Workspace_5/alloySamples/app/styles/app.tss"
[ERROR] :  [ERROR] Expected "Alloy", "L", "Ti", "Titanium", "WPATH", "[", "false", "null", "true", "{", comment, end of line, number, string or whitespace but "'" found.
[ERROR] :  [ERROR] 
[ERROR] :  [ERROR] - line:    9
[ERROR] :  [ERROR] - column:  7
[ERROR] :  [ERROR] - offset:  64
[ERROR] :  Alloy compiler failed

3. Change

text:'foo \ bar'
to
text:"foo \ bar"
and build. Result: Alloy compile fails with a slightly different error.
[ERROR] :  [ERROR] Expected "Alloy", "L", "Ti", "Titanium", "WPATH", "[", "false", "null", "true", "{", comment, end of line, number, string or whitespace but "\"" found.

4. Delete text:"foo \ bar" from app.tss and build (leave the one in index.xml)

Result: Alloy compiles and app is run. '\' is ignored.

Note

It is also reproducible with previous versions of Alloy, not a regression.

Comments

  1. Feon Sua Xin Miao 2014-07-01

    PR: https://github.com/appcelerator/alloy/pull/467 Test app: https://github.com/feons/alloy/tree/ALOY-793/test/apps/testing/ALOY-793 Functional Test: 1. Run the test app on iOS 2. No compile error and backslash shows up
  2. Tim Poulsen 2014-07-01

    PR reviewed and merged
  3. Federico Casali 2014-09-12

    Verified fixed on iPad iOS 8, Android 4.3 and Mobileweb. TiSDK 3.4.0.v20140911135715 Appcelerator Studio 3.4.0.201409111151 CLI 3.4.0-rc2 Alloy 1.5.0-rc Xcode6-beta7 Closing.

JSON Source