-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from SwedbankPay/feature/dx-1622_diagram_width
DX-1622: Configurable width
- Loading branch information
Showing
30 changed files
with
656 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
# Ruby's Object class. | ||
class Object | ||
# Performs a case insensitive, trimmed comparison of the Object and the | ||
# String 'none' and Symbol :none. Returns true if the comparison is true, | ||
# otherwise false. | ||
# | ||
# @return [Boolean] True if the Object is equal to 'none' or :none, | ||
# otherwise false. | ||
def none_s? | ||
return false if nil? | ||
return true if self == :none | ||
|
||
to_s.strip.casecmp?('none') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'none_s' | ||
|
||
module Kramdown | ||
module PlantUml | ||
# Builds a CSS style string from a hash of style properties. | ||
class StyleBuilder | ||
def initialize | ||
@hash = {} | ||
end | ||
|
||
def []=(key, value) | ||
return if key.nil? | ||
|
||
case key | ||
when :width, :height | ||
if none(value) | ||
@hash.delete(key) | ||
else | ||
@hash[key] = value | ||
end | ||
else | ||
self.style = value | ||
end | ||
end | ||
|
||
def to_s | ||
@hash.sort_by { |key, _| key }.map { |key, value| "#{key}:#{value}" }.join(';') | ||
end | ||
|
||
private | ||
|
||
def none(value) | ||
return true if value.nil? | ||
|
||
value_s = value.to_s.strip | ||
|
||
return true if value_s.empty? || value.none_s? | ||
|
||
false | ||
end | ||
|
||
def style=(style) | ||
return if style.nil? || style.strip.empty? | ||
|
||
style.split(';').each do |pair| | ||
key, value = pair.split(':') | ||
key = key.strip.to_sym | ||
value = value.strip | ||
@hash[key] = value | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.