Skip to content

Commit 38b62ce

Browse files
author
Shailesh Mishra
authored
Merge pull request #10 from contentstack/next
CS-38901 : Nested Asset & Break Line Tag implementation
2 parents c989425 + 297b8c9 commit 38b62ce

15 files changed

Lines changed: 126 additions & 39 deletions

File tree

.github/workflows/sca-scan.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

ContentstackUtils.podspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'ContentstackUtils'
3-
s.version = '1.2.1'
3+
s.version = '1.3.0'
44
s.summary = 'Contentstack is a headless CMS with an API-first approach that puts content at the centre.'
55

66
s.description = <<-DESC
@@ -16,10 +16,10 @@ s.source = { :git => 'https://github.com/contentstack/contentstack-uti
1616
s.social_media_url = 'https://twitter.com/Contentstack'
1717
s.swift_version = '5.0'
1818

19-
s.ios.deployment_target = '10.1'
20-
s.osx.deployment_target = '10.12'
21-
s.tvos.deployment_target = "10.0"
22-
s.watchos.deployment_target = "3.0"
19+
s.ios.deployment_target = '11.0'
20+
s.osx.deployment_target = '10.13'
21+
s.tvos.deployment_target = "11.0"
22+
s.watchos.deployment_target = "4.0"
2323

2424
s.source_files = 'Sources/**/*.{swift}'
2525
s.framework = "Foundation"

ContentstackUtils.xcodeproj/project.pbxproj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@
590590
INFOPLIST_FILE = ContentstackUtils.xcodeproj/ContentstackUtils_Info.plist;
591591
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
592592
LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx";
593-
MACOSX_DEPLOYMENT_TARGET = 10.10;
593+
MACOSX_DEPLOYMENT_TARGET = 10.13;
594594
MARKETING_VERSION = 1.2.1;
595595
OTHER_CFLAGS = "$(inherited)";
596596
OTHER_LDFLAGS = "$(inherited)";
@@ -604,8 +604,8 @@
604604
SWIFT_INSTALL_OBJC_HEADER = NO;
605605
SWIFT_VERSION = 5.0;
606606
TARGET_NAME = ContentstackUtils;
607-
TVOS_DEPLOYMENT_TARGET = 9.0;
608-
WATCHOS_DEPLOYMENT_TARGET = 2.0;
607+
TVOS_DEPLOYMENT_TARGET = 11.0;
608+
WATCHOS_DEPLOYMENT_TARGET = 4.0;
609609
};
610610
name = Debug;
611611
};
@@ -622,7 +622,7 @@
622622
INFOPLIST_FILE = ContentstackUtils.xcodeproj/ContentstackUtils_Info.plist;
623623
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
624624
LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx";
625-
MACOSX_DEPLOYMENT_TARGET = 10.10;
625+
MACOSX_DEPLOYMENT_TARGET = 10.13;
626626
MARKETING_VERSION = 1.2.1;
627627
OTHER_CFLAGS = "$(inherited)";
628628
OTHER_LDFLAGS = "$(inherited)";
@@ -636,8 +636,8 @@
636636
SWIFT_INSTALL_OBJC_HEADER = NO;
637637
SWIFT_VERSION = 5.0;
638638
TARGET_NAME = ContentstackUtils;
639-
TVOS_DEPLOYMENT_TARGET = 9.0;
640-
WATCHOS_DEPLOYMENT_TARGET = 2.0;
639+
TVOS_DEPLOYMENT_TARGET = 11.0;
640+
WATCHOS_DEPLOYMENT_TARGET = 4.0;
641641
};
642642
name = Release;
643643
};
@@ -646,6 +646,7 @@
646646
buildSettings = {
647647
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2";
648648
LD = /usr/bin/true;
649+
MACOSX_DEPLOYMENT_TARGET = 10.13;
649650
OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -package-description-version 5.1";
650651
SWIFT_VERSION = 5.0;
651652
};
@@ -656,6 +657,7 @@
656657
buildSettings = {
657658
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2";
658659
LD = /usr/bin/true;
660+
MACOSX_DEPLOYMENT_TARGET = 10.13;
659661
OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -package-description-version 5.1";
660662
SWIFT_VERSION = 5.0;
661663
};

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016-2021 Contentstack
3+
Copyright (c) 2016-2023 Contentstack
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Package.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ let provider: [SystemPackageProvider] = [
2828
#endif
2929
let package = Package(
3030
name: "ContentstackUtils",
31-
platforms: [.macOS(.v10_12),
32-
.iOS(.v10),
33-
.tvOS(.v10),
34-
.watchOS(.v3)],
31+
platforms: [.macOS(.v10_13),
32+
.iOS(.v11),
33+
.tvOS(.v11),
34+
.watchOS(.v4)],
3535

3636
products: [
3737
// Products define the executables and libraries a package produces, and make them visible to other packages.

SECURITY.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Security
2+
3+
Contentstack takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations.
4+
5+
If you believe you have found a security vulnerability in any Contentstack-owned repository, please report it to us as described below.
6+
7+
## Reporting Security Issues
8+
9+
**Please do not report security vulnerabilities through public GitHub issues.**
10+
11+
Send email to [security@contentstack.com](mailto:security@contentstack.com).
12+
13+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message.
14+
15+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
16+
17+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
18+
* Full paths of source file(s) related to the manifestation of the issue
19+
* The location of the affected source code (tag/branch/commit or direct URL)
20+
* Any special configuration required to reproduce the issue
21+
* Step-by-step instructions to reproduce the issue
22+
* Proof-of-concept or exploit code (if possible)
23+
* Impact of the issue, including how an attacker might exploit the issue
24+
25+
This information will help us triage your report more quickly.
26+
27+
[https://www.contentstack.com/trust/](https://www.contentstack.com/trust/)

Scripts/run-test-case.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ xcodebuild \
3636
-project ContentstackUtils.xcodeproj \
3737
-scheme "ContentstackUtils-Package" \
3838
test \
39-
-destination "OS=14.1,name=iPhone 11" \
39+
-destination "OS=16.2,name=iPhone 14" \
4040
-resultBundlePath "$TEST_BUNDLE_PATH/$FILE_NAME-iOS.xcresult" \
4141
| xcpretty \
4242
--color \
@@ -52,7 +52,7 @@ xcodebuild \
5252
-project ContentstackUtils.xcodeproj \
5353
-scheme "ContentstackUtils-Package" \
5454
test \
55-
-destination "OS=14.0,name=Apple TV 4K" \
55+
-destination "OS=16.1,name=Apple TV 4K (3rd generation)" \
5656
-resultBundlePath "$TEST_BUNDLE_PATH/$FILE_NAME-tvOS.xcresult" \
5757
| xcpretty \
5858
--color \

Sources/ContentstackUtils/ContentstackUtils.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ public struct ContentstackUtils {
9494

9595
static private func textNodeToHtml(_ textNode: TextNode, _ option: Option) -> String {
9696
var text = textNode.text
97+
if (textNode.break) {
98+
text = option.renderMark(markType: .break, text: text)
99+
}
97100
if (textNode.superscript) {
98101
text = option.renderMark(markType: .superscript, text: text)
99102
}
@@ -131,6 +134,11 @@ public struct ContentstackUtils {
131134
return option.renderItem(embeddedObject: embedModel.first!, metadata: metadata) ?? ""
132135
}
133136
}
137+
if let attType = node.attrs["type"] as? String, attType == "asset" {
138+
return option.renderNode(nodeType: NodeType.image.rawValue, node: node) { children in
139+
return nodeChildrenToHtml(children: children, option)
140+
}
141+
}
134142
return ""
135143
}
136144

Sources/ContentstackUtils/MarkType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
//
77

88
public enum MarkType: String {
9-
case bold, italic, underline, strikethrough, inlineCode, `subscript`, superscript
9+
case bold, italic, underline, strikethrough, inlineCode, `subscript`, superscript, `break`
1010
}

Sources/ContentstackUtils/Option.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ open class Option: Renderable {
5959
return "<sub>\(text)</sub>"
6060
case .superscript:
6161
return "<sup>\(text)</sup>"
62+
case .break:
63+
return "<br />\(text)"
6264
}
6365
}
6466

@@ -69,7 +71,7 @@ open class Option: Renderable {
6971
case NodeType.link.rawValue:
7072
return "<a href=\"\(node.attrs["href"] ?? "")\">\(next(node.children))</a>"
7173
case NodeType.image.rawValue:
72-
return "<img src=\"\(node.attrs["src"] ?? "")\" />\(next(node.children))"
74+
return "<img src=\"\(node.attrs["src"] ?? node.attrs["asset-link"] ?? "")\" />\(next(node.children))"
7375
case NodeType.embed.rawValue:
7476
return "<iframe src=\"\(node.attrs["src"] ?? "")\">\(next(node.children))</iframe>"
7577
case NodeType.heading_1.rawValue:

0 commit comments

Comments
 (0)