1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-10-05 16:57:12 +03:00

Update indents

This commit is contained in:
Daniil Manin 2021-10-04 17:58:51 +07:00
parent cc7513b663
commit dfcfdbe25b
2 changed files with 14 additions and 14 deletions

View File

@ -69,7 +69,7 @@ class CSSParser {
return .byTag(text)
}
func getStyles(element: XMLHash.XMLElement) -> [String: String] {
func getStyles(element: XMLHash.XMLElement) -> [String: String] {
var styleAttributes = [String: String]()
if let styles = stylesByTag[element.name] {

View File

@ -138,7 +138,7 @@ open class SVGParser {
}
let parsedXml = config.parse(xmlString)
var svgElement: XMLHash.XMLElement?
var svgElement: XMLHash.XMLElement?
for child in parsedXml.children {
if let element = child.element {
if element.name == "svg" {
@ -203,7 +203,7 @@ open class SVGParser {
}
}
fileprivate func parseViewBox(_ element: XMLHash.XMLElement) throws -> SVGNodeLayout? {
fileprivate func parseViewBox(_ element: XMLHash.XMLElement) throws -> SVGNodeLayout? {
let widthAttributeNil = element.allAttributes["width"] == nil
let heightAttributeNil = element.allAttributes["height"] == nil
let viewBoxAttributeNil = element.allAttributes["viewBox"] == nil
@ -508,7 +508,7 @@ open class SVGParser {
return Group(contents: groupNodes, place: getPosition(element), tag: getTag(element))
}
fileprivate func getPosition(_ element: XMLHash.XMLElement) -> Transform {
fileprivate func getPosition(_ element: XMLHash.XMLElement) -> Transform {
guard let transformAttribute = element.allAttributes["transform"]?.text else {
return Transform.identity
}
@ -666,7 +666,7 @@ open class SVGParser {
}
fileprivate func getStyleAttributes(_ groupAttributes: [String: String],
element: XMLHash.XMLElement) -> [String: String] {
element: XMLHash.XMLElement) -> [String: String] {
var styleAttributes: [String: String] = groupAttributes
for (att, val) in styles.getStyles(element: element) {
@ -896,7 +896,7 @@ open class SVGParser {
return 0
}
fileprivate func getTag(_ element: XMLHash.XMLElement) -> [String] {
fileprivate func getTag(_ element: XMLHash.XMLElement) -> [String] {
let id = element.allAttributes["id"]?.text
return id.map { [$0] } ?? []
}
@ -1081,7 +1081,7 @@ open class SVGParser {
return Align.min
}
fileprivate func parseSimpleText(_ text: XMLHash.XMLElement,
fileprivate func parseSimpleText(_ text: XMLHash.XMLElement,
textAnchor: String?,
fill: Fill?,
stroke: Stroke?,
@ -1156,7 +1156,7 @@ open class SVGParser {
baseline: .alphabetic,
place: place,
opacity: opacity)
} else if let tspanElement = element as? XMLHash.XMLElement,
} else if let tspanElement = element as? XMLHash.XMLElement,
tspanElement.name == "tspan" {
// parse as <tspan> element
// ultimately skip it if it cannot be parsed
@ -1187,7 +1187,7 @@ open class SVGParser {
return collection
}
fileprivate func parseTspan(_ element: XMLHash.XMLElement,
fileprivate func parseTspan(_ element: XMLHash.XMLElement,
withWhitespace: Bool = false,
textAnchor: String?,
fill: Fill?,
@ -1242,7 +1242,7 @@ open class SVGParser {
weight: getFontWeight(attributes) ?? fontWeight ?? "normal")
}
fileprivate func getTspanPosition(_ element: XMLHash.XMLElement,
fileprivate func getTspanPosition(_ element: XMLHash.XMLElement,
bounds: Rect,
previousCollectedTspan: Node?,
withWhitespace: inout Bool) -> Transform {
@ -1653,14 +1653,14 @@ open class SVGParser {
return .none
}
fileprivate func getDoubleValue(_ element: XMLHash.XMLElement, attribute: String) -> Double? {
fileprivate func getDoubleValue(_ element: XMLHash.XMLElement, attribute: String) -> Double? {
guard let attributeValue = element.allAttributes[attribute]?.text else {
return .none
}
return doubleFromString(attributeValue)
}
fileprivate func getDimensionValue(_ element: XMLHash.XMLElement, attribute: String) -> SVGLength? {
fileprivate func getDimensionValue(_ element: XMLHash.XMLElement, attribute: String) -> SVGLength? {
guard let attributeValue = element.allAttributes[attribute]?.text else {
return .none
}
@ -1701,7 +1701,7 @@ open class SVGParser {
}
}
fileprivate func getDoubleValueFromPercentage(_ element: XMLHash.XMLElement, attribute: String) -> Double? {
fileprivate func getDoubleValueFromPercentage(_ element: XMLHash.XMLElement, attribute: String) -> Double? {
guard let attributeValue = element.allAttributes[attribute]?.text else {
return .none
}
@ -1716,7 +1716,7 @@ open class SVGParser {
return .none
}
fileprivate func getIntValue(_ element: XMLHash.XMLElement, attribute: String) -> Int? {
fileprivate func getIntValue(_ element: XMLHash.XMLElement, attribute: String) -> Int? {
if let attributeValue = element.allAttributes[attribute]?.text {
if let doubleValue = Double(attributeValue) {
return Int(doubleValue)