Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Apps.Contentful/Apps.Contentful.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<Product>Contentful</Product>
<Description>The headless content management system</Description>
<Version>1.8.15</Version>
<Version>1.8.16</Version>
<AssemblyName>Apps.Contentful</AssemblyName>
</PropertyGroup>

Expand Down
3 changes: 3 additions & 0 deletions Apps.Contentful/HtmlHelpers/EntryToJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ private static JToken ParseValueFromNode(HtmlNode node)

if (bool.TryParse(textValue, out var boolValue))
return JValue.FromObject(boolValue);

if (decimal.TryParse(textValue, out var decimalValue))
return JValue.FromObject(decimalValue);

return JValue.FromObject(textValue);
}
Expand Down
4 changes: 2 additions & 2 deletions Tests.Contentful/EntryActionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ public async Task GetEntryLocalizableFieldsAsHtmlFile_WithoutReferenceEntries_Sh
var entryActions = new EntryActions(InvocationContext, FileManager);
var entryIdentifier = new DownloadContentInput()
{
Environment = "dev",
ContentId = "70rcIvfhhD9VjLlMTA3YPz",
Environment = "master",
ContentId = "4phPDNKF6oE6x7bexnmgGS",
Locale = "en-US"
};
var request = new GetEntryAsHtmlRequest();
Expand Down
7 changes: 5 additions & 2 deletions Tests.Contentful/EntryTranslationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ public class EntryTranslationTests : TestBase
public async Task Translate_standard_html_file()
{
var actions = new EntryActions(InvocationContext, FileManager);
await actions.SetEntryLocalizableFieldsFromHtmlFile(new Apps.Contentful.Models.Requests.Tags.UploadEntryRequest { Content = new FileReference { Name = "contentful-pseudo.html" }, Locale = "de" });

await actions.SetEntryLocalizableFieldsFromHtmlFile(
new Apps.Contentful.Models.Requests.Tags.UploadEntryRequest
{
Content = new FileReference { Name = "json_fields.html" }, Locale = "en-US"
});
}

[TestMethod]
Expand Down
22 changes: 22 additions & 0 deletions Tests.Contentful/TestFiles/Input/json_fields.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<html lang="en-US">
<head>
<meta name="blackbird-entry-id" content="4phPDNKF6oE6x7bexnmgGS">
<meta name="blackbird-locale" content="en-US">
<meta name="blackbird-ucid" content="4phPDNKF6oE6x7bexnmgGS">
<meta name="blackbird-content-name" content="">
<meta name="blackbird-admin-url"
content="https://app.contentful.com/spaces/12ktqqmw656e/environments/master/entries/4phPDNKF6oE6x7bexnmgGS">
<meta name="blackbird-system-name" content="Contentful">
<meta name="blackbird-system-ref" content="https://www.contentful.com">
</head>
<body its-rev-tool="Contentful" its-rev-tool-ref="https://www.contentful.com" its-rev-person="Cecilia Nistal">
<div data-contentful-entry-id="4phPDNKF6oE6x7bexnmgGS">
<div data-contentful-field-type="Object" data-contentful-field-id="spotlightCta" data-contentful-json-object="true">
<dl>
<dd data-json-key="enabled"><span>True</span></dd>
<dd data-json-key="testNumber"><span>123.45</span></dd>
</dl>
</div>
</div>
</body>
</html>