Skip to content

Commit 2d3fa46

Browse files
committed
[refactor] Extracted OpenXml::Element and concerns to openxml-package (1h)
1 parent a83d95a commit 2d3fa46

108 files changed

Lines changed: 236 additions & 544 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
source 'https://rubygems.org'
1+
source "https://rubygems.org"
22

33
gemspec
4+
5+
# Optional: use the development version of openxml-package
6+
# gem "openxml-package", github: "openxml/openxml-package", branch: "master"
7+
8+
# Optional: use the development version of openxml-drawingml
9+
# gem "openxml-drawingml", github: "openxml/openxml-drawingml", branch: "master"

Gemfile.lock

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PATH
33
specs:
44
openxml-docx (0.10.6)
55
nokogiri
6+
openxml-drawingml
67
openxml-package (>= 0.2.2)
78
ox (~> 2.4.3, < 2.4.10)
89

@@ -17,7 +18,10 @@ GEM
1718
mini_portile2 (2.2.0)
1819
nokogiri (1.8.0)
1920
mini_portile2 (~> 2.2.0)
20-
openxml-package (0.2.8)
21+
openxml-drawingml (0.1.0)
22+
nokogiri
23+
openxml-package (~> 0.2.9)
24+
openxml-package (0.2.9)
2125
nokogiri
2226
ox
2327
rubyzip (~> 1.2.1)

lib/openxml/docx.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ module Docx
2323
bmp: "image/bmp".freeze,
2424
tiff: "image/tiff".freeze
2525
}
26+
27+
THEME_COLORS = %i(accent1 accent2 accent3 accent4 accent5 accent6 background1 background2 dark1 dark2 followedHyperlink hyperlink light1 light2 none text1 text2).freeze
28+
29+
BORDER_TYPES = %i(apples archedScallops babyPacifier babyRattle balloons3Colors balloonsHotAir basicBlackDashes basicBlackDots basicBlackSquares basicThinLines basicWhiteDashes basicWhiteDots basicWhiteSquares basicWideInline basicWideMidline basicWideOutline bats birds birdsFlight cabins cakeSlice candyCorn celticKnotwork certificateBanner chainLink champagneBottle checkedBarBlack checkedBarColor checkered christmasTree circlesLines circlesRectangles classicalWave clocks compass confetti confettiGrays confettiOutlines confettiStreamers confettiWhite cornerTriangles couponCutoutDashes couponCutoutDots crazyMaze creaturesButterfly creaturesFish creaturesInsects creaturesLadyBug crossStitch cup custom dashDotStroked dashed dashSmallGap decoArch decoArchColor decoBlocks diamondsGray dotDash dotDotDash dotted double doubleD doubleDiamonds doubleWave earth1 earth2 earth3 eclipsingSquares1 eclipsingSquares2 eggsBlack fans film firecrackers flowersBlockPrint flowersDaisies flowersModern1 flowersModern2 flowersPansy flowersRedRose flowersRoses flowersTeacup flowersTiny gems gingerbreadMan gradient handmade1 handmade2 heartBalloon heartGray hearts heebieJeebies holly houseFunky hypnotic iceCreamCones inset lightBulb lightning1 lightning2 mapleLeaf mapleMuffins mapPins marquee marqueeToothed moons mosaic musicNotes nil none northwest outset ovals packages palmsBlack palmsColor paperClips papyrus partyFavor partyGlass pencils people peopleHats peopleWaving poinsettias postageStamp pumpkin1 pushPinNote1 pushPinNote2 pyramids pyramidsAbove quadrants rings safari sawtooth sawtoothGray scaredCat seattle shadowedSquares shapes1 shapes2 sharksTeeth shorebirdTracks single skyrocket snowflakeFancy snowflaskes sombrero southwest stars stars3d starsBlack starsShadowed starsTop sun swirligig thick thickThinLargeGap thickThinMediumGap thickThinSmallGap thinThickLargeGap thinThickMediumGap thinThickSmallGap thinThickThinLargeGap thinThickThinMediumGap thinThickThinSmallGap threeDEmboss threeDEngrave tornPaper tornPaperBlack trees triangle1 triangle2 triangleCircle1 triangleCircle2 triangleParty triangle triple twistedLines1 twistedLines2 vine wave waveline weavingAngles weavingBraid weavingRibbon weavingStrips whiteFlowers woodwork xIllusions zanyTriangles zigZag zigZagStitch).freeze
2630
end
2731
end
2832

29-
require "openxml/docx/attribute_builder"
30-
require "openxml/docx/property_builder"
33+
require "openxml/docx/has_properties"
3134
require "openxml/docx/properties"
3235
require "openxml/docx/root_namespaces"
3336
require "openxml/docx/elements"

lib/openxml/docx/attribute_builder.rb

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

lib/openxml/docx/element.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require "openxml/element"
2+
3+
module OpenXml
4+
module Docx
5+
class Element < ::OpenXml::Element
6+
namespace :w
7+
end
8+
end
9+
end

lib/openxml/docx/elements.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ module Elements
55
end
66
end
77

8-
require "openxml/docx/elements/element"
9-
require "openxml/docx/elements/container"
8+
require "openxml/docx/element"
9+
require "openxml/has_children"
1010
require "openxml/docx/elements/text"
1111
Dir.glob("#{File.join(File.dirname(__FILE__), "elements", "*.rb")}").each do |file|
1212
require file

0 commit comments

Comments
 (0)