From ddbace25506c3ebd17866e39f2d83958e8680f1d Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Sun, 25 Nov 2018 11:32:24 -0600 Subject: [PATCH 01/17] First commit. Begin changes to numbering (analysis section) documentation --- .eggs/README.txt | 6 ++++++ .gitignore | 1 + docs/dev/analysis/features/.numbering.rst.swp | Bin 0 -> 12288 bytes docs/dev/analysis/features/numbering.rst | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .eggs/README.txt create mode 100644 docs/dev/analysis/features/.numbering.rst.swp diff --git a/.eggs/README.txt b/.eggs/README.txt new file mode 100644 index 000000000..5d0166882 --- /dev/null +++ b/.eggs/README.txt @@ -0,0 +1,6 @@ +This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins. + +This directory caches those eggs to prevent repeated downloads. + +However, it is safe to delete this directory. + diff --git a/.gitignore b/.gitignore index de25a6f76..5a08a3779 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /docs/.build/ /*.egg-info *.pyc +.*.swp _scratch/ Session.vim /.tox/ diff --git a/docs/dev/analysis/features/.numbering.rst.swp b/docs/dev/analysis/features/.numbering.rst.swp new file mode 100644 index 0000000000000000000000000000000000000000..977ac4329f9af43241302797371a744c46f99db8 GIT binary patch literal 12288 zcmeI2y>HV%7>AEC@ckiJU^{{YNGNeyK%s$Fg0fU1q*4nE4CrEClLOlc_PI(Im|z4} zK)?k50%GLP00{&;2qYK~3;fQp6Q@l>Bg6oDPkIu?zP$IokMC?nxmxkkY=xH!#~Ipg z#tN^0T&a$|VJ|i^=8Bp*`rC$n`O190G+CM$+Sl@=qlAU-*5z|nYgsp%e%@)?Z3{1< z<;W#V_`+QdRcI|rp`$>CmLGXF87RMA2tqwHJe?#1WMC}=kzUN7+`*1bj2BIpgSi8I z@1Bcm^`_%wfDDiUGC&5%02v?yWPl9(hX!fDDiUGC&6YK?B0UfBu^oJG2?ea-18^I(Koe9z8GPT)*h6p!Oo1cdFc<@$w_!|B1*gE* zt&F_`Z^29O98|!!EsQ+^XF&n%2m8QB)bkA72ls#j%D~jg0W~r}2FL&zAOmDzhyl(| zTkZHIbjqRfTCQAJZpmrJ(N4E<5WDnrplq$0KCg*TPUXx||i$GVGWDqC^ zlc*bSh0j6pMiXfg9C=-0hMI}=*Hrcj=e^Q#)w4GHO6Q(vr;BTH=;9JJ+|7io5v^Ck zsud95)shR7z4}Av6FL}bscsWtLz z&B%AsTdi5jv5o$FS4M9dwL8+8o_cfc4@ZKhIc1-XTvzI3sP0IpDSK}HBaOCpIvdx` zWiOZU^R&Pls@`ycE|+=Ra~aF`H8yWIq$jv++cIdG-R=twJnGUN@VtdJ&sE5=T|P1o t8tHK5^H6r4z2l|AByTSA+4*XIV)8_>m>)0Thjm|LsJxREpF=RlegPR4z4ZV9 literal 0 HcmV?d00001 diff --git a/docs/dev/analysis/features/numbering.rst b/docs/dev/analysis/features/numbering.rst index 837cf0e9b..0a1bc4f49 100644 --- a/docs/dev/analysis/features/numbering.rst +++ b/docs/dev/analysis/features/numbering.rst @@ -2,7 +2,7 @@ Numbering Part ============== -... having to do with numbering sequences for ordered lists, etc. ... +The numbering part is documented in section 17.9 of ISO-29500-1. Schema excerpt From 821c155478fcf038c632c9a1918f9bc97541697b Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Sun, 25 Nov 2018 20:47:08 -0600 Subject: [PATCH 02/17] Updated Developer Reference section of documentation w/r/t numbering part. Discussing resolution to issues 25 and 122. --- docs/dev/analysis/features/.numbering.rst.swp | Bin 12288 -> 49152 bytes docs/dev/analysis/features/numbering.rst | 546 +++++++++++++++++- 2 files changed, 521 insertions(+), 25 deletions(-) diff --git a/docs/dev/analysis/features/.numbering.rst.swp b/docs/dev/analysis/features/.numbering.rst.swp index 977ac4329f9af43241302797371a744c46f99db8..b516941028925d83b2cceded720b2dc55e896f17 100644 GIT binary patch literal 49152 zcmeI54YXueRp&1x4kRE5ngANtTwaWHKi;eN(O=0+cS5JrNnWPY-K0ASAq%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&zIF z00ttt$u#lDiY+P7L*vt060IPg17b_OjD=i2cGXTGjwiFVHOV>Wl~zC3RP^d%69oHrFy^Wrb|Z#jOXZ5%_Pja-r4Wj`gJ zUz3>GIOhjKvzGjgI63FdGTsOUiAWZP!3>sUMh1TxNgR!YXmGp_SC#Yj^l%l}bxw!o zP(t6u86ohoc1?O^7LUOd$qwRpc}w*Q{P8yeO{EAoPx?wKYH1Xetfk|2u zY;MB@8fdlMk~e1=DX)i8;mD|k775XVaBo?K_R@vLMb~*PUUmi}RuWWF!@oZ2 N-q2e?eXoVy{{udI#nJ!( delta 830 zcmZwE%Wo1<6bA4ElwySfHBq2ZdxL3xU=)$=2!%7RroBS3t=eysXN4;*UPYLA(^_@7;Kz=>2MgRhPkmB!U}Pp)5X=3w)I5cn!WLQui?Jv z>Xj@+Lpv}=4HCjtTXhgUg(q+aYOoA*Fbi3jfpPG`8#~bj_|i-C5N<*lu0jlC_-P}0 z1h-%e4#7b%!dENNDkyNwN^$zWljsAyhZpc1V(_Df=rNoE2|VD2&v^W2umX1>12QyU zORP6mj#|t@9QRk)A$!;o?(fN$bTzALUO&f|_wk;ycK%dzvp;U;QrL@YFRz9BdFFcS z{;)q^n)izKrB}=9m^U(YWlBq?=OVdeDXVTL*g5GtyiiQ3TE3KR4ga?#-VCvIGT>M! zPGq(V1lLAA-J1uZ?1(d8SS+-SJLZAt2{Vck8YjXd{GfVi=%4V`$jvOGb$UFBt8@Mb)yZ@KXtEyvmPO~8a5}bC*knuWgd@?m~b2E{Tz(n7;OJcojY6G zkl@>jj}>M2u4HOn$0yX$@OR91#bsy(4s1&}CUviUp$K ajz#CvIklJ+Y9*~|Wu1t>NfG|&ANUOu`` +whose children are of two main types: ```` and +````, of XML types ``CT_AbstractNum`` and ``CT_Num``, +respectively. Each is identified by a unique +attribute (``w:numId`` and ``w:abstractNumId``, respectively) +of type ``CT_DecimalNumber``. + +A paragraph contained in **document.xml** +is recognized by the user agent as numbered +if its ```` element contains a ```` +element which references the ``numId`` attribute +of the corresponding numbering style. + +.. code-block:: xml + + + + + + + + + + Level one + + + +The numbering style defined by a ```` element +is limited to : + +- A reference to an abstract numbering style; and +- (optionally) level-specific overrides of the abstract style. + +The standard explains the two-level scheme for defining numbering +styles as follows (terminology is introduced):[#first]_ + +*Abstract numbering definitions* + define the appearance and behavior of a specific set of numbered paragraphs in + a document. Because this construct is abstract, they are not be directly referenced by document content, but + rather they shall be inherited by a +*numbering definition instance,* + which itself is referenced by document content. + +A numbering definition, therefore, will usually be of simple form such as +the following, with only a **numId** attribute and an element referring +to an abstract numbering definition: + +.. code-block:: xml + + + + + +The abstract numbering definition contains the substantive styling information +for lists, namely the level-specific display of the bullet or numeral +and its placement. For example, + +.. code-block:: xml + + + + + + + + + + + + + + + + + +Low- to High-level support +-------------------------- + +The structure of the ``docx`` module can be +profitably understood by identifying the +levels of representation that it operates +at, and the subsystem that acts upon +that representation. + +We arrange them in order of increasing abstraction +from a raw WordProcessingML file. + +1. Packaged OPC file **[python-opc]** +2. Serialized XML **[lxml]** +3. Deserialized XML **[xmlchemy]** +4. Module-specific primitives **[python-docx]** +5. High-level representations **[user]** +Support for a given operation can be considered +as a gradient (not Boolean) quality: the fewer +levels of representation a user must traverse +to accomplish an operation, the more +*supported* the operation is. -Schema excerpt --------------- +Issue #122 on the master branch GitHub page +discusses difficulties with creating or styling +complex lists with the ``docx`` module. +Basically, there is no high-level support +for functions such as +creating multi-level lists, nested lists, +and restarting numbering. +The maintainer has commented that: -.. highlight:: xml +- The standard itself involves a highly cumbersome + method for achieving these kinds of effects + (this is indeed true), making it difficult + to decide on the best way to expose the + various functions to users; and +- It is, however, possible to achieve the desired + effects with significant effort: work + on the raw XML representation, given + knowledge of the standard. -:: +The issue is also discussed on StackOverflow +at https://stackoverflow.com/questions/23446268 + + + +Element Semantics +----------------- + +This section contains excerpts from ISO-29500-1 describing +how the user agent should handle +````, ````, ````, and their +descendants (section references are to parts of ISO-29500-1). + +**numPr** (§17.3.1.19) + This element specifies that the current paragraph uses numbering information that is defined by a particular + numbering definition instance. + The presence of this element specifies that the paragraph inherits the properties specified by the numbering + definition in the ``num`` element (§17.9.15) at the level specified by the level specified in the ``lvl`` element (§17.9.6) + and shall have an associated number positioned before the beginning of the text flow in this paragraph. When + this element appears as part of the paragraph formatting for a paragraph style, then any numbering level + defined using the ``ilvl`` element shall be ignored, and the ``pStyle`` element (§17.9.23) on the associated abstract + numbering definition shall be used instead. +``ilvl`` (§17.9.3) + This element specifies the numbering level of the numbering definition instance which shall be applied to the + parent paragraph. +``numId`` (§17.9.18) + This element specifies the numbering definition instance which shall be used for the given parent numbered + paragraph in the WordprocessingML document. +``numberingChange`` + Removed. Previously defined in ECMA-376:2006. +``ins`` (§17.13.5.19) + This element specifies that the numbering information defined by the parent element shall be treated as + numbering information which was recorded as an insertion using revisions. +**num** (§17.9.15) + This element specifies a unique instance of numbering information that can be referenced by zero or more + paragraphs within the parent WordprocessingML document. + This instance requires the referencing of a base abstract numbering definition through the ``abstractNumId`` child + element (§17.9.2). This element also can be used to specify a set of optional overrides applied to zero or more + levels from the abstract numbering definition inherited by this instance through the optional ``lvlOverride`` + child elements (§17.9.8). +``abstractNumId`` (§17.9.2) + This element specifies the abstract numbering definition information whose properties shall be inherited by the + parent numbering definition instance. +``lvlOverride`` (§17.9.8) + This element specifies an optional override which shall be applied in place of zero or more levels from the + abstract numbering definition for a given numbering definition instance. Each instance of this element is used to + override the appearance and behavior of a given numbering level definition within the given abstract numbering + definition. +**abstractNum** (§17.9.1) + This element specifies a set of properties which shall dictate the appearance and behavior of a set of numbered + paragraphs in a WordprocessingML document. These properties are collectively called an *abstract numbering + definition*, and are the basis for all numbering information in a WordprocessingML document. + Although an abstract numbering definition contains a complete set of numbering, it shall not be directly + referenced by content (hence the use of abstract). Instead, these properties shall be inherited by a numbering + definition instance using the ``num`` element (§17.9.15), which can then itself be referenced by content. +``nsid`` (§17.9.14) + This element associates a unique hexadecimal ID to the parent abstract numbering definition. This number shall + be identical for two abstract numbering definitions that are based from the same initial numbering definition --- if + a document is repurposed and the underlying numbering definition is changed, it shall maintain its original ``nsid``. + If this element is omitted, then the list shall have no nsid and one can be added by a producer arbitrarily. +``multiLevelType`` (§17.9.12) + This element specifies the type of numbering defined by a given abstract numbering type. This information shall + only be used by a consumer to determine user interface behaviors for this numbering definition, and shall not + be used to limit the behavior of the list (i.e. a list with multiple levels marked as ``singleLevel`` shall not be + prevented from using levels 2 through 9). + If this element is omitted, then the list shall be assumed to be of any numbering type desired by the consumer. +``tmpl`` (§17.9.29) + This element specifies a unique hexadecimal code which can be used to determine a location within application + user interface in which this abstract numbering definition shall be displayed. + If this element is omitted, then this abstract numbering definition can be displayed in any location chosen by the + consumer. +``name`` (§17.9.13) + This element specifies the name of a given abstract numbering definition. This name can be surfaced in order to + provide a user friendly alias for a given numbering definition, but shall not influence the behavior of the list - + two identical definitions with different name elements shall behave identically. + If this element is omitted, then this abstract numbering definition shall have no name. +``styleLink`` (§17.9.27) + This element specifies that the parent abstract numbering definition is the base numbering definition for the + specified numbering style referenced in its ``val`` attribute. + If this element is omitted, or it references a style which does not exist, then this numbering definition shall not + be the underlying properties for a numbering style. +``numStyleLink`` (§17.9.21) + This element specifies an abstract numbering that does not contain the actual numbering properties for its + numbering type, but rather serves as a reference to a numbering style stored in the document, which shall be + applied when this abstract numbering definition is referenced, and itself points at the actual underlying abstract + numbering definition to be used. + The numbering style that is to be applied when this abstract numbering definition is referenced is identified by + the string contained in ``numStyleLink``'s ``val`` attribute. +**lvl** (§17.9.6) + This element specifies the appearance and behavior of a numbering level within a given abstract numbering + definition. A numbering level contains a set of properties for the display of the numbering for a given numbering + level within an abstract numbering definition. + A numbering level definition is identical to a numbering level override definition, except for the fact that it is + defined as part of a numbering definition instance using the ``abstractNum`` element (§17.9.1) rather than as part + of an abstract numbering definition using the ``num`` element (§17.9.15). +``start`` (§17.9.25) + This element specifies the starting value for the numbering used by the parent numbering level within a given + numbering level definition. This value is used when this level initially starts in a document, as well as whenever it + is restarted via the properties set in the ``lvlRestart`` element (§17.9.10). + If this element is omitted, then the starting value shall be zero ( 0 ). +``numFmt`` (§17.9.17) + This element specifies the number format that shall be used to display all numbering at this level in the + numbering definition. This information is used to replace the level text string %x , where x is a particular one- + based level index, with the appropriate value unless the ``numFmt`` value is bullet , in which case the literal text + of the level text string is used. This value shall be calculated by counting the number of paragraphs at this level + since the last restart using the numbering system defined in the val attribute. + When a document has a custom number format specified by the format attribute, it shall use the referenced + number format. If the referenced number format cannot be resolved as a number format the consumer shall + use the number format specified by the value of the val attribute. If the corresponding value of the val attribute + is custom , the result is implementation-defined. + If this element is omitted, the level shall be assumed to be of level type ``decimal``. +``lvlRestart`` (§17.9.10) + This element specifies a one-based index which determines when a numbering level should restart to its ``start`` + value (§17.9.25). A numbering level restarts when an instance of the specified numbering level, which shall be + higher (earlier than this level) or any earlier level is used in the given document's contents. [Example: If this + value is 2, then both level two and level one reset this value. end example] + If this element is omitted, the numbering level shall restart each time the previous numbering level or any + earlier level is used. If the specified level is higher than the current level, then this element shall be ignored. As + well, a value of 0 shall specify that this level shall never restart. +``pStyle`` (§17.9.23) + This element specifies the name of a paragraph style which shall automatically apply to this numbering level when + applied to the contents of the document. When a paragraph style is defined to include a numbering definition, + any numbering level defined by the ``numPr`` element (§17.3.1.19) shall be ignored, and instead this element shall + specify the numbering level associated with that paragraph style. + If this element references a style which does not exist, or is not a paragraph style, then it can be ignored. +``isLgl`` (§17.9.4) + This element specifies whether or not all levels displayed for a given numbering level's text shall be displayed + using the decimal number format, regardless of the actual number format of that level in the list. [Note: This + numbering style is often referred to as the legal numbering style. end note] + If this element is present, then all numbering levels present in the ``lvlTxt`` element (§17.9.11) shall be converted + to their decimal equivalents when they are displayed in this level in the numbering format. If this element is + omitted, then each level is displayed using the ``numFmt`` (§17.9.17) of that level. +``suff`` (§17.9.28) + This element specifies the content which shall be added between a given numbering level's text and the text of + every numbered paragraph which references that numbering level. + If this element is omitted, then its value shall be assumed to be tab. +``lvlText`` (§17.9.11) + This element specifies the textual content which shall be displayed when displaying a paragraph with the given + numbering level. + All text in this element's val attribute shall be taken as literal text to be repeated in each instance of this + numbering level, except for any use of the percent symbol (%) followed by a number, which shall be used to + indicate the one-based index of the number to be used at this level. Any number of a level higher than this level + shall be ignored. + When the % syntax is used, the number shall be incremented for each subsequent paragraph of that level + (sequential or not), until the restart level is seen between two subsequent paragraphs of this level. +``lvlPicBulletId`` (§17.9.9) + This element specifies a picture which shall be used as a numbering symbol for a given numbering level by + referring to a picture numbering symbol definition's ``numPictBullet`` element (§17.9.20). This reference is made + through this element's ``val`` attribute. + The picture shall be added to the numbering level by replacing each character in the ``lvlText`` with one instance + of this image. +``legacy`` + not in current standard +``lvlJc`` (§17.9.7) + This element specifies the type of justification used on a numbering level's text within a given numbering level. + This justification is applied relative to the text margin of the parent numbered paragraph in the document. + If omitted, the paragraph shall have left justification relative to the text margin in left-to-right paragraphs, and + right justification relative to the text margin in right-to-left paragraphs. + A numbering level's text is the numeral, symbol, character, graphic, etc. used to create a numbered paragraph as + defined by the lvlText element (§17.9.11). +``pPr`` (§17.9.22) + This element specifies the paragraph properties which shall be applied as part of a given numbering level within + the parent numbering definition. These paragraph properties are applied to any numbered paragraph that + references the given numbering definition and numbering level. + Paragraph properties specified on the numbered paragraph itself override the paragraph properties specified by + ``pPr`` elements within a numbering ``lvl`` element (§17.9.5, §17.9.6). +``rPr`` (§17.9.24) + This element specifies the run properties which shall be applied to the numbering level's text specified in the + ``lvlText`` element (§17.9.11) when it is applied to paragraphs in this document. + These run properties are applied to all numbering level text used by a given abstract numbering definition and + numbering level. It should be noted that run properties specified on a numbered paragraph itself, or on text + runs within a numbered paragraph, are separate from the run properties specified by ``rPr`` elements within a + numbering level, as the latter affects only the numbering text itself, not the remainder of runs in the numbered + paragraph. + + +Applicable Schema Definitions +----------------------------- + +This section contains excerpts from the schema **wmd.xsd** +which will be necessary to develop basic support for +parsing **numbering.xml** files and enabling **xmlchemy** +functionality for numbering definitions. + +Once a type is appropriately defined in the source +and the parser is given instructions on which tags +to associate it with, then low-level **xmlchemy** +methods can be used to manipulate the XML directly +or write API functions. + +Schemata are given in the remainder of this +section for the +unimplemented (as of version 0.8.7) types which are necessary to +implement suport for numbering styles. + +**** ``CT_Numbering`` + +.. code-block:: xml - - - + + + - +**** ``CT_NumPicBullet`` + +.. code-block:: xml + + + + + + + + + +**** ``CT_AbstractNum`` + +.. code-block:: xml + + - - + + + + + + + - + - +``CT_LongHexNumber`` + +.. code-block:: xml + + + + + + + + + + + +**** ``CT_MultiLevelType`` + +.. code-block:: xml + + + + + + + + + + + + + +**** ``CT_Lvl`` + +.. code-block:: xml + + - - + + + + + + + + + + + + + + - - - - - - - +**** ``CT_NumFmt`` + +.. code-block:: xml + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +**** ``CT_LevelSuffix`` + +.. code-block:: xml + + + - - + + + + + + + +**** ``CT_LevelText`` + +.. code-block:: xml + + + + + + +**** ``CT_LvlLegacy`` + +.. code-block:: xml + + + + + + + + +**** ``CT_Num`` + +.. code-block:: xml + + + + + + + + + +.. [#first] ISO/IEC 29500-1:2012(E) at 684. From aaa944c905f10c1c7bee86bb6321bc97418f78cf Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Sun, 25 Nov 2018 22:28:36 -0600 Subject: [PATCH 03/17] Added four new simple type definitions in oxml.simpletypes submodule. --- docs/dev/analysis/features/.numbering.rst.swp | Bin 49152 -> 49152 bytes docs/dev/analysis/features/numbering.rst | 98 ++++++++++++++- docx/oxml/simpletypes.py | 119 ++++++++++++++++++ ref/.swp | Bin 0 -> 12288 bytes 4 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 ref/.swp diff --git a/docs/dev/analysis/features/.numbering.rst.swp b/docs/dev/analysis/features/.numbering.rst.swp index b516941028925d83b2cceded720b2dc55e896f17..d92606fd19f198e392c0072b9e634187c85e63f6 100644 GIT binary patch delta 5736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up>e)X!$~;C$#Ic~W)NU9bwO;UtOEKG+1yVIrI$ zfqD%dhV|;Fuq7}CKEwse4UbU3jOd={zEDw`y6EhZJ#&01w{Uvt^%+A-_cYA@A7WT( Ah5!Hn delta 3091 zcma*p2}~4M9LMot7uj9TuAqWNK~TYi%L5ggdK8LPD&P$y$|4k05J3uuZMnuCCcU>f@4jV8VgV5nDNk3p8R$?Xs(Ls66 zqZHW~4|m*gl!~OoM7J3!h=4!b;EMaib`Mu^1qZMIGcX;4p+XDwslg`XBLxPG$2bhZ zV5o4MC|6J|$hGQ5UaheH}kA8556CCjy6Xh|kqXl)Sz#ORYfF$?Agij%o zoo{b8|D}?f#toGx915}cL{4xjGNejU0)q)-@FMvTrD`uoyA8kM1S&BFq5|9T4noiy zUU*3A4{#05sKibz!btez0u}fMbtr-COzK5+M2Ti#0-jNh3K-B2KaqY3CLb`>#ziLn7DPdZdgikU(eOeeGkz`BD9?j6Xt~s^kqz}zC}Ji7`u-7zm|2%Jx=}5cJ{7E zFzW8MZS*RnFxrc2VaWMC)N^T_Rd>pu6p0PUI)2)$B5`GTsxV?1-5RYH&nz!P`5@g}4o2H`kE0Nb$|@rb~Af-oWzF9@OmG5C=n((o<@p_(8z zU-UJ|odL|%Jl68FVgXnZn(6cy*N~}gM!r%xU#2}rt7CZY98o4CB zzoj<)sb-;w)0-1)goxAjuX7V4FN8g|F>)X1ApR1JKu=UK@-V2ek?t=F@O!%lnW1(^}FXyY~@sUaTzDkfRFJ32BV$Rw&4;|Fb?Or qL=424cIvoHyVk{*pJ8#T@6rrIW~RJlS158U4P~V&OY4`t)PDnjl`~}k diff --git a/docs/dev/analysis/features/numbering.rst b/docs/dev/analysis/features/numbering.rst index d47f06fff..a773b907e 100644 --- a/docs/dev/analysis/features/numbering.rst +++ b/docs/dev/analysis/features/numbering.rst @@ -135,7 +135,75 @@ The maintainer has commented that: The issue is also discussed on StackOverflow at https://stackoverflow.com/questions/23446268 - +Currently, +looking to the hierarchy above, +access to most parts of the structure relating +to list styles and numbering definitions is only through +a deserialized XML ("Level 3") representation. +Full API support would imply access to a "Level 5" +representation. +Decisions about simplifying the implementation of +numbered lists w/r/t the ISO standard are most +likely to come up when developing "Level 5" +support. +However, it should be uncontroversial to adhere +to the ISO standard very closely when developing +"Level 4" support. This means that the level of +*support* for advanced list operations can +be increased through some straightforward +**xmlchemy**-based declarations, +and high-level design questions need not come +into play. + +This is done through two main programming tasks: + +1. Declare relevant XML types following the ``wml.xsd`` schema + (ISO-29500-1 Appendix A.1). +2. Instruct ``xmlchemy`` to recognize a relevant tag + as an instance of the appropriate type. + +If this is accomplished, various low-level methods will +be exposed which abstract the necessary XML manipulations, +allowing for improved access to desired functions for +a user familiar with the semantics of the ISO standard. + +Pull Request #XX is concerned with updating the module +to declare the following types and expose them to +``xmlchemy``-based methods: + ++-------------------+ +|XML Type | ++===================+ +|CT_Numbering | ++-------------------+ +|CT_NumPicBullet | ++-------------------+ +|CT_AbstractNum | ++-------------------+ +|CT_LongHexNumber | ++-------------------+ +|ST_LongHexNumber | ++-------------------+ +|CT_MultiLevelType | ++-------------------+ +|ST_MultiLevelType | ++-------------------+ +|CT_Lvl | ++-------------------+ +|CT_NumFmt | ++-------------------+ +|ST_NumberFormat | ++-------------------+ +|CT_LevelSuffix | ++-------------------+ +|ST_LevelSuffix | ++-------------------+ +|CT_LevelText | ++-------------------+ +|CT_LvlLegacy | ++-------------------+ +|CT_Num | ++-------------------+ Element Semantics ----------------- @@ -327,6 +395,7 @@ section for the unimplemented (as of version 0.8.7) types which are necessary to implement suport for numbering styles. + **** ``CT_Numbering`` .. code-block:: xml @@ -548,4 +617,31 @@ implement suport for numbering styles. +Implementation Notes +-------------------- + +The following simple types are defined in ``simpletypes.py``. + +ST_LongHexNumber + This is a string representation of a 4-byte hexadecimal + number. + It inherits from ``XsdUnsignedInt`` (4-byte unsigned integer), + and uses the ``validate`` method from that class. + The ``convert_to_xml`` and ``convert_from_xml`` + methods are straightforward. +ST_MultiLevelType + This is a string with one of three possible values: + ``"singleLevel"``, ``"multiLevel"``, or ``"hybridMultiLevel"``. + It is defined similary to other ``XsdStringEnumeration``-based + simple types. +ST_LevelSuffix + Similar to ``ST_MultiLevelType``. Possible values are + ``"tab"``, ``"space"``, or ``"nothing"``. +ST_NumberFormat + Similar to ``ST_MultiLevelType``. 63 possible values, + the most common in US settings are ``"decimal"``, + ``"upperRoman"``, ``"lowerRoman"``, ``"upperLetter"``, + ``"lowerLetter"``, ``"ordinal"``, ``"cardinalText"``, + and ``"ordinalText"``. + .. [#first] ISO/IEC 29500-1:2012(E) at 684. diff --git a/docx/oxml/simpletypes.py b/docx/oxml/simpletypes.py index 400a23700..2081f0c62 100644 --- a/docx/oxml/simpletypes.py +++ b/docx/oxml/simpletypes.py @@ -197,6 +197,20 @@ def validate(cls, value): ) +class ST_LongHexNumber(XsdUnsignedInt): + + @classmethod + def convert_from_xml(cls, str_value): + return int(str_value,16) + + @classmethod + def convert_to_xml(cls, value): + """ + Keep alpha hex numerals all uppercase just for consistency. + """ + # expecting eight hexadeximal digits + return '%08X' % value + class ST_BrType(XsdString): @classmethod @@ -298,6 +312,111 @@ class ST_Merge(XsdStringEnumeration): _members = (CONTINUE, RESTART) +class ST_MultiLevelType(XsdStringEnumeration): + """ + Valid values for attribute + """ + SINGLE = 'singleLevel' + MULTI = 'multiLevel' + HYBRID = 'hybridMultiLevel' + + _members = (SINGLE, MULTI, HYBRID) + +class ST_LevelSuffix(XsdStringEnumeration): + """ + Valid values for attribute + """ + TAB = 'tab' + SPACE = 'space' + NOTHING = 'nothing' + + _members = (TAB, SPACE, NOTHING) + +class ST_NumberFormat(XsdStringEnumeration): + """ + Valid values for attribute + """ + DECIMAL = 'decimal' + UPPERROMAN = 'upperRoman' + LOWERROMAN = 'lowerRoman' + UPPERLETTER = 'upperLetter' + LOWERLETTER = 'lowerLetter' + ORDINAL = 'ordinal' + CARDINALTEXT = 'cardinalText' + ORDINALTEXT = 'ordinalText' + HEX = 'hex' + CHICAGO = 'chicago' + IDEOGRAPHDIGITAL = 'ideographDigital' + JAPANESECOUNTING = 'japaneseCounting' + AIUEO = 'aiueo' + IROHA = 'iroha' + DECIMALFULLWIDTH = 'decimalFullWidth' + DECIMALHALFWIDTH = 'decimalHalfWidth' + JAPANESELEGAL = 'japaneseLegal' + JAPANESEDIGITALTENTHOUSAND = 'japaneseDigitalTenThousand' + DECIMALENCLOSEDCIRCLE = 'decimalEnclosedCircle' + DECIMALFULLWIDTH2 = 'decimalFullWidth2' + AIUEOFULLWIDTH = 'aiueoFullWidth' + IROHAFULLWIDTH = 'irohaFullWidth' + DECIMALZERO = 'decimalZero' + BULLET = 'bullet' + GANADA = 'ganada' + CHOSUNG = 'chosung' + DECIMALENCLOSEDFULLSTOP = 'decimalEnclosedFullstop' + DECIMALENCLOSEDPAREN = 'decimalEnclosedParen' + DECIMALENCLOSEDCIRCLECHINESE = 'decimalEnclosedCircleChinese' + IDEOGRAPHENCLOSEDCIRCLE = 'ideographEnclosedCircle' + IDEOGRAPHTRADITIONAL = 'ideographTraditional' + IDEOGRAPHZODIAC = 'ideographZodiac' + IDEOGRAPHZODIACTRADITIONAL = 'ideographZodiacTraditional' + TAIWANESECOUNTING = 'taiwaneseCounting' + IDEOGRAPHLEGALTRADITIONAL = 'ideographLegalTraditional' + TAIWANESECOUNTINGTHOUSAND = 'taiwaneseCountingThousand' + TAIWANESEDIGITAL = 'taiwaneseDigital' + CHINESECOUNTING = 'chineseCounting' + CHINESELEGALSIMPLIFIED = 'chineseLegalSimplified' + CHINESECOUNTINGTHOUSAND = 'chineseCountingThousand' + KOREANDIGITAL = 'koreanDigital' + KOREANCOUNTING = 'koreanCounting' + KOREANLEGAL = 'koreanLegal' + KOREANDIGITAL2 = 'koreanDigital2' + VIETNAMESECOUNTING = 'vietnameseCounting' + RUSSIANLOWER = 'russianLower' + RUSSIANUPPER = 'russianUpper' + NONE = 'none' + NUMBERINdASH = 'numberInDash' + HEBREW1 = 'hebrew1' + HEBREW2 = 'hebrew2' + ARABICALPHA = 'arabicAlpha' + ARABICABJAD = 'arabicAbjad' + HINDIVOWELS = 'hindiVowels' + HINDICONSONANTS = 'hindiConsonants' + HINDINUMBERS = 'hindiNumbers' + HINDICOUNTING = 'hindiCounting' + THAILETTERS = 'thaiLetters' + THAINUMBERS = 'thaiNumbers' + THAICOUNTING = 'thaiCounting' + BAHTTEXT = 'bahtText' + DOLLARTEXT = 'dollarText' + CUSTOM = 'custom' + + _members = (DECIMAL, UPPERROMAN, LOWERROMAN, UPPERLETTER, + LOWERLETTER, ORDINAL, CARDINALTEXT, ORDINALTEXT, + HEX, CHICAGO, IDEOGRAPHDIGITAL, JAPANESECOUNTING, + AIUEO, IROHA, DECIMALFULLWIDTH, DECIMALHALFWIDTH, + JAPANESELEGAL, JAPANESEDIGITALTENTHOUSAND, DECIMALENCLOSEDCIRCLE, DECIMALFULLWIDTH2, + AIUEOFULLWIDTH, IROHAFULLWIDTH, DECIMALZERO, BULLET, + GANADA, CHOSUNG, DECIMALENCLOSEDFULLSTOP, DECIMALENCLOSEDPAREN, + DECIMALENCLOSEDCIRCLECHINESE, IDEOGRAPHENCLOSEDCIRCLE, IDEOGRAPHTRADITIONAL, IDEOGRAPHZODIAC, + IDEOGRAPHZODIACTRADITIONAL, TAIWANESECOUNTING, IDEOGRAPHLEGALTRADITIONAL, TAIWANESECOUNTINGTHOUSAND, + TAIWANESEDIGITAL, CHINESECOUNTING, CHINESELEGALSIMPLIFIED, CHINESECOUNTINGTHOUSAND, + KOREANDIGITAL, KOREANCOUNTING, KOREANLEGAL, KOREANDIGITAL2, + VIETNAMESECOUNTING, RUSSIANLOWER, RUSSIANUPPER, NONE, + NUMBERINdASH, HEBREW1, HEBREW2, ARABICALPHA, + ARABICABJAD, HINDIVOWELS, HINDICONSONANTS, HINDINUMBERS, + HINDICOUNTING, THAILETTERS, THAINUMBERS, THAICOUNTING, + BAHTTEXT, DOLLARTEXT, CUSTOM) + class ST_OnOff(XsdBoolean): diff --git a/ref/.swp b/ref/.swp new file mode 100644 index 0000000000000000000000000000000000000000..c885905bd327eed8e8a0cf19616fe08767695391 GIT binary patch literal 12288 zcmeHL*=iI)6s`Cst|V^YR*C2+R6-Jkpd=49-IeKzJyk<5Nr+F`9)v8CMSSzYAMpFH)3d~YB#5`+OyB+9I#tCmvoXCan{;mK1%c!h>)H24W|x$ zL)>IDot%3)H#;;AoyY((aGnfY%%9KBOq&TFO^nmA(fmAz!QRLKGJp&q1IPd}fD9l5 z$N(~M#ta<28zCQ|=LOr>{RJ>$b@x8wv9KL7fD9l5$N(~c3?Ku@05X6KAOpw%GJp*H zMF!Tl2>Ee|kg3a16n^}>-~ZpQ5%L+Z2bc%^yh_MdzyaU};L8<4-T)o~enIXxz$ZWq zFtwflCIA#LZeis69r|OC4W0sw&)@;T#GCg`z%78u8MC-+^*iu3e)l$YOi!0<;%);* z0rxCw9kPixv8Jb!&AbNqAOpz2Kga-uXa2+C)~oHk4nkoHxQqqFCuymuyjk~(k0U(cbs6yb z5)TIA{D+f zP4YCAT*c5XVNT0iEu$%|1S79?A~>w7Au}E`TB_{=r5=k$+i7EG8OgX@;R+i1^Z*vr zHGnk~1yb2;#d1*!V4)J2MLJJm3`S%qbR*%dXibNb2U)^HnMt4rhV%W}^ZD?i!|>>K zlTZY*$z!2{Si|&zOoCY0kr?$gyZs%Gu0B4zoS2aYS3KlqjXKTEIjOW;%;Olovsyil z7Egp?gv(rL6SN}34E9|nI^rF=Ew?5T&1fCsM8?PxZxvf%x5}w@XELGu>Z{|FtM|kB zMzF!fBzAz_0B?zSyjadkBC%R*ZonHboTtVg5I2|KK~kK}@)j|wlTa309q>{r@1ivq Z3VCYR&uDRw6W!#B(V~o%3%e~zegigJeY^kw literal 0 HcmV?d00001 From 978df4ec1846a4fc62e159154fbebfdca8a1a9c4 Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Sun, 25 Nov 2018 22:57:02 -0600 Subject: [PATCH 04/17] Defined CT_LevelSuffix --- docx/oxml/numbering.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docx/oxml/numbering.py b/docx/oxml/numbering.py index aeedfa9a0..7337b6c86 100644 --- a/docx/oxml/numbering.py +++ b/docx/oxml/numbering.py @@ -11,6 +11,22 @@ BaseOxmlElement, OneAndOnlyOne, RequiredAttribute, ZeroOrMore, ZeroOrOne ) +class CT_LevelSuffix(BaseOxmlElement): + """ + ```` element, which specifies the form of the space + between a list number and the list paragraph + """ + val = RequiredAttribute('w:val', ST_LevelSuffix ) + + @classmethod + def new(cls, val): + """ + Return a new ```` element with ``val`` + attribute set to ``val`` + """ + suff = OxmlElement('w:suff') + suff.val = val + return suff class CT_Num(BaseOxmlElement): """ From 38eeed18a2b65de4cd08fbf61ee4cad306a3f2a4 Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Mon, 26 Nov 2018 20:53:51 -0600 Subject: [PATCH 05/17] Added CT_MultiLevelType and CT_NumFmt --- docs/dev/analysis/features/.numbering.rst.swp | Bin 49152 -> 45056 bytes docs/dev/analysis/features/numbering.rst | 19 ++++++++ docx/oxml/__init__.py | 6 ++- docx/oxml/numbering.py | 42 +++++++++++++++++- 4 files changed, 64 insertions(+), 3 deletions(-) diff --git a/docs/dev/analysis/features/.numbering.rst.swp b/docs/dev/analysis/features/.numbering.rst.swp index d92606fd19f198e392c0072b9e634187c85e63f6..916ac44b2827e560617934fee2ae85f697183d78 100644 GIT binary patch delta 920 zcmah|J7^R^7@o^T&BMeCrqC)sCqV+|y73iFqv14okQd~z3C5kfo6QaG?VP)_d0=tZ z+62Oijje@Nl3XWZZy_pLDTs}NppCVN-)!O~0l{Ive`ja@`5)gm+ia$rpF4(1_Km_c zjalayMuxGoPk${uPk&&}0An66ZEOy2UVU*S)g7lZ!>O)#Br}vc6c=C*#uD~Gd=IuW zegfMazl80Hzh#DwrA;^tN-Se{JGLkB#^%wMZNKW@qRvd;&mP9sd$EJW6c5ae&3x@+ z>e9#lWznr^37~HRr z^1U_UmPHFETp5JziM~mN`PtKjYk4|z>AY>98Xd=;IodEsCw!%=A|S3+O_r&wYIRSn zl3uF|i{*>Arj);QU98STwUP)JgD?5XT>48?=Yb~Wl3AUd%j3Izn=j#DNtAgM3bTQt z0zrXrMG%MzX+;O(*^Vz|ol)QX9`Q%C$Tf4osefQnULa~yDqq3T*H zpL?iT2eK4tkt4@(RZ!#Fajb10-{ia#Nt1J*-!k_cC$~eHNSupR84@0jwDsEG_Gv}x zD*38G<*M{5f$(#N5HK-W)5*F2awnFBHy^pKTuuB9sYp!Of03O{Ty~YD5IlJBZ|v=l5CS#0!i-4CxIl(rOp z&~z|>@nQ0lCr%XJY#_LnZ<7LxfYcU#28Js@400GuC5V5Sf3u?CeZGkYu20sn*4eaR z1tZT^p!^o7n#p_Yr8l2nXvim+n8LttotJ?@nGa$J&tyRZ^UcbFcX%gXSje(j!|p~R E0D?m{%K!iX diff --git a/docs/dev/analysis/features/numbering.rst b/docs/dev/analysis/features/numbering.rst index a773b907e..f50bd31f2 100644 --- a/docs/dev/analysis/features/numbering.rst +++ b/docs/dev/analysis/features/numbering.rst @@ -644,4 +644,23 @@ ST_NumberFormat ``"lowerLetter"``, ``"ordinal"``, ``"cardinalText"``, and ``"ordinalText"``. +The following complex types are defined in ``numbering.py``. + +CT_MultiLevelType + This is the simpletype of complex type: it has no children + and only a single attribute, ``val``. I'll call this + type an "atomic complex type." +CT_LevelSuffix + Another atomic complex type. +CT_NumFmt + This is a copmlex type with no children, + one required attribute, ``val``, and one + optional attribute, ``format``. + +The following complex types are defined in ``shared.py`` +because they are referred to by a type outside of +the numbering part of the OPC package. + +CT_LongHexNumber + Another atomic complex type. .. [#first] ISO/IEC 29500-1:2012(E) at 684. diff --git a/docx/oxml/__init__.py b/docx/oxml/__init__.py index 2731302e2..0064c7e4e 100644 --- a/docx/oxml/__init__.py +++ b/docx/oxml/__init__.py @@ -75,7 +75,8 @@ def OxmlElement(nsptag_str, attrs=None, nsdecls=None): register_element_cls('w:document', CT_Document) from .numbering import ( - CT_Num, CT_Numbering, CT_NumLvl, CT_NumPr + CT_Num, CT_Numbering, CT_NumLvl, CT_NumPr, + CT_LevelSuffix, CT_NumFmt, CT_MultiLevelType ) register_element_cls('w:abstractNumId', CT_DecimalNumber) register_element_cls('w:ilvl', CT_DecimalNumber) @@ -85,6 +86,9 @@ def OxmlElement(nsptag_str, attrs=None, nsdecls=None): register_element_cls('w:numPr', CT_NumPr) register_element_cls('w:numbering', CT_Numbering) register_element_cls('w:startOverride', CT_DecimalNumber) +register_element_cls('w:suff', CT_LevelSuffix) +register_element_cls('w:numFmt', CT_NumFmt) +register_element_cls('w:multiLevelType',CT_MultiLevelType) from .section import CT_PageMar, CT_PageSz, CT_SectPr, CT_SectType register_element_cls('w:pgMar', CT_PageMar) diff --git a/docx/oxml/numbering.py b/docx/oxml/numbering.py index 7337b6c86..0a329d7c7 100644 --- a/docx/oxml/numbering.py +++ b/docx/oxml/numbering.py @@ -6,9 +6,11 @@ from . import OxmlElement from .shared import CT_DecimalNumber -from .simpletypes import ST_DecimalNumber +from .simpletypes import ( + ST_DecimalNumber, ST_LevelSuffix, ST_NumberFormat, ST_String, ST_MultiLevelType +) from .xmlchemy import ( - BaseOxmlElement, OneAndOnlyOne, RequiredAttribute, ZeroOrMore, ZeroOrOne + BaseOxmlElement, OneAndOnlyOne, RequiredAttribute, ZeroOrMore, ZeroOrOne, OptionalAttribute ) class CT_LevelSuffix(BaseOxmlElement): @@ -28,6 +30,42 @@ def new(cls, val): suff.val = val return suff +class CT_NumFmt(BaseOxmlElement): + """ + ```` element, which specifies the formatting + of the numeral in a numbered list + """ + val = RequiredAttribute('w:val', ST_NumberFormat ) + fmt = OptionalAttribute('w:format', ST_String ) + + @classmethod + def new(cls, val): + """ + Return a new ```` element with ``val`` + attrribute set to ``val`` + """ + numFmt = OxmlElement('w:numFmt') + numFmt.val = val + return numFmt + +class CT_MultiLevelType(BaseOxmlElement): + """ + ```` element, which indicates + whether a numbering style is single-level, + multi-level, or hybrid. + """ + val = RequiredAttribute('w:val', ST_MultiLevelType ) + + @classmethod + def new(cls, val): + """ + Return a new ```` element with ``val`` + attribute set to ``val`` + """ + multiLevelType = OxmlElement('w:multiLevelType') + multiLevelType.val = val + return multiLevelType + class CT_Num(BaseOxmlElement): """ ```` element, which represents a concrete list definition From c096cf1e538a670501f47d6a1556e657b4a5d5fe Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Tue, 27 Nov 2018 22:18:36 -0600 Subject: [PATCH 06/17] Added CT_LongHexNumber, CT_LvlLegacy, CT_LevelText and CT_NumPicBullet --- docs/dev/analysis/features/.numbering.rst.swp | Bin 45056 -> 45056 bytes docs/dev/analysis/features/numbering.rst | 7 ++- docx/oxml/__init__.py | 8 ++- docx/oxml/numbering.py | 53 +++++++++++++++++- docx/oxml/shared.py | 10 +++- 5 files changed, 72 insertions(+), 6 deletions(-) diff --git a/docs/dev/analysis/features/.numbering.rst.swp b/docs/dev/analysis/features/.numbering.rst.swp index 916ac44b2827e560617934fee2ae85f697183d78..0912cfb04d96de5e21ca39766c4978d332a64001 100644 GIT binary patch delta 337 zcmX}mKTE?v6aetoDhO2}83q45gf1FN5y7Fwr6LsSqQ%9*yCm1(I+xP%x1BBdt zp4O*V3#(F}+4k4r?tTqmK~|mh!fp=F^bWu^vB>*2z?{603ArVw>z?{a!p**vZl zPODkWTdyOjkYgx@+{bcUw)TxPcVjD`Tw;ptx}hUvGu`zKo?A&2n;wSK`I2siIK75A#!6< c>1IY~2Ri-7-c#5sUoJ*%w;Cn0&-Q`-1?2{0EC2ui delta 154 zcmZp8z|`=7Nj}LS%+puFT+f672m}}yjMx8(-ot#0AwiIVAty0u;zretE@uQ76*dbB zewO3?#KpkS#|=@bFj>$bU9O&ofx!)kMS%D%Q05H~-v;7cK-|Z@nUQ50*W@!+2EvJX qDGK>{Ih6{DdU^`c%4wNJ#XxZxW*`qpf1BK56U$VPyZNz=Y%u^;lq+KZ diff --git a/docs/dev/analysis/features/numbering.rst b/docs/dev/analysis/features/numbering.rst index f50bd31f2..ae02a00e3 100644 --- a/docs/dev/analysis/features/numbering.rst +++ b/docs/dev/analysis/features/numbering.rst @@ -653,9 +653,14 @@ CT_MultiLevelType CT_LevelSuffix Another atomic complex type. CT_NumFmt - This is a copmlex type with no children, + This is a complex type with no children, one required attribute, ``val``, and one optional attribute, ``format``. +CT_LvlLegacy + This type has three optional attributes, + ``legacy``, ``legacySpace`` and ``legacyIndent``. + Clearly, its use is intended for parsing of documents + in a legacy format. The following complex types are defined in ``shared.py`` because they are referred to by a type outside of diff --git a/docx/oxml/__init__.py b/docx/oxml/__init__.py index 0064c7e4e..43ad5ec0f 100644 --- a/docx/oxml/__init__.py +++ b/docx/oxml/__init__.py @@ -64,7 +64,7 @@ def OxmlElement(nsptag_str, attrs=None, nsdecls=None): # custom element class mappings # =========================================================================== -from .shared import CT_DecimalNumber, CT_OnOff, CT_String +from .shared import CT_DecimalNumber, CT_OnOff, CT_String, CT_LongHexNumber from .coreprops import CT_CoreProperties @@ -76,7 +76,8 @@ def OxmlElement(nsptag_str, attrs=None, nsdecls=None): from .numbering import ( CT_Num, CT_Numbering, CT_NumLvl, CT_NumPr, - CT_LevelSuffix, CT_NumFmt, CT_MultiLevelType + CT_LevelSuffix, CT_NumFmt, CT_MultiLevelType, + CT_LvlLegacy, CT_LevelText, CT_NumPicBullet ) register_element_cls('w:abstractNumId', CT_DecimalNumber) register_element_cls('w:ilvl', CT_DecimalNumber) @@ -89,6 +90,9 @@ def OxmlElement(nsptag_str, attrs=None, nsdecls=None): register_element_cls('w:suff', CT_LevelSuffix) register_element_cls('w:numFmt', CT_NumFmt) register_element_cls('w:multiLevelType',CT_MultiLevelType) +register_element_cls('w:legacy', CT_LvlLegacy) +register_element_cls('w:lvlText', CT_LevelText) +register_element_cls('w:numPicBullet', CT_NumPicBullet) from .section import CT_PageMar, CT_PageSz, CT_SectPr, CT_SectType register_element_cls('w:pgMar', CT_PageMar) diff --git a/docx/oxml/numbering.py b/docx/oxml/numbering.py index 0a329d7c7..31444a4f1 100644 --- a/docx/oxml/numbering.py +++ b/docx/oxml/numbering.py @@ -7,12 +7,32 @@ from . import OxmlElement from .shared import CT_DecimalNumber from .simpletypes import ( - ST_DecimalNumber, ST_LevelSuffix, ST_NumberFormat, ST_String, ST_MultiLevelType + ST_DecimalNumber, ST_LevelSuffix, ST_NumberFormat, ST_String, ST_MultiLevelType, + ST_TwipsMeasure, ST_SignedTwipsMeasure, ST_OnOff ) from .xmlchemy import ( - BaseOxmlElement, OneAndOnlyOne, RequiredAttribute, ZeroOrMore, ZeroOrOne, OptionalAttribute + BaseOxmlElement, OneAndOnlyOne, RequiredAttribute, ZeroOrMore, ZeroOrOne, + OptionalAttribute, Choice ) +class CT_LevelText(BaseOxmlElement): + """```` element, which specifies + the formatting of the numeral in a numbered + list. + """ + val = OptionalAttribute('w:val', ST_String ) + null = OptionalAttribute('w:null', ST_OnOff ) + + @classmethod + def new(cls, val): + """ + Return a new ```` element with + ``val`` attribute set to ``val`` + """ + lvlText = OxmlElement('w:lvlText') + lvlText.val = val + return lvlText + class CT_LevelSuffix(BaseOxmlElement): """ ```` element, which specifies the form of the space @@ -48,6 +68,16 @@ def new(cls, val): numFmt.val = val return numFmt +class CT_LvlLegacy(BaseOxmlElement): + """ + ```` element. Implemented here in + case the module eventually supports parsing + of documents in the target legacy format. + """ + legacy = OptionalAttribute('w:legacy', ST_OnOff) + legacySpace = OptionalAttribute('w:legacySpace', ST_TwipsMeasure ) + legacyIndent = OptionalAttribute('w:legacyIndent', ST_SignedTwipsMeasure ) + class CT_MultiLevelType(BaseOxmlElement): """ ```` element, which indicates @@ -66,6 +96,25 @@ def new(cls, val): multiLevelType.val = val return multiLevelType +class CT_NumPicBullet(BaseOxmlElement): + """ + ````` for specifying + a picture or SVG drawing as the bullet + symbol in a bulleted list. + """ + pict = Choice('w:pict') + drawing = Choice('w:drawing') + numPicBulletId = RequiredAttribute('w:numPicBulletId', ST_DecimalNumber ) + @classmethod + def new(cls, Id): + """ + Return a new ```` element with ``numPicBulletId`` + attribute set to ``numPicBulletId`` + """ + numPicBullet = OxmlElement('w:numPicBullet') + numPicBullet.numPicBulletId = Id + return numPicBullet + class CT_Num(BaseOxmlElement): """ ```` element, which represents a concrete list definition diff --git a/docx/oxml/shared.py b/docx/oxml/shared.py index 1e21ba366..a9b1788ad 100644 --- a/docx/oxml/shared.py +++ b/docx/oxml/shared.py @@ -8,10 +8,18 @@ from . import OxmlElement from .ns import qn -from .simpletypes import ST_DecimalNumber, ST_OnOff, ST_String +from .simpletypes import ST_DecimalNumber, ST_OnOff, ST_String, ST_LongHexNumber from .xmlchemy import BaseOxmlElement, OptionalAttribute, RequiredAttribute +class CT_LongHexNumber(BaseOxmlElement): + """ + ```` element, which specifies the form of the space + between a list number and the list paragraph + """ + val = RequiredAttribute('w:val', ST_LongHexNumber ) + + class CT_DecimalNumber(BaseOxmlElement): """ Used for ````, ````, ```` and several From bc00f82ab7a3638f0d45495a63da1ea983e0b3c3 Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Sat, 1 Dec 2018 12:52:02 -0600 Subject: [PATCH 07/17] Defined the remaining types. --- docs/dev/analysis/features/.numbering.rst.swp | Bin 45056 -> 0 bytes docs/dev/analysis/features/numbering.rst | 63 +++------------- docx/oxml/__init__.py | 5 +- docx/oxml/numbering.py | 71 ++++++++++++++++-- 4 files changed, 78 insertions(+), 61 deletions(-) delete mode 100644 docs/dev/analysis/features/.numbering.rst.swp diff --git a/docs/dev/analysis/features/.numbering.rst.swp b/docs/dev/analysis/features/.numbering.rst.swp deleted file mode 100644 index 0912cfb04d96de5e21ca39766c4978d332a64001..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 45056 zcmeI5dypk}b>ACHLEu>CVUR>1sn!Ug*vo?wyZgF>*UfHv?Vfhp%#uA^zUTI%dwOfda<{X)*==0d!~gO< z&2(i?(n(rtd6w^4Op{{JPxC#UL3<(XXPu>5KQA_Ie&@>_3hYo|BMJ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q+xR-Z(AmULby?|<9!)yF0FJpO9l$zDh( zE>E{Er001&DCyX^{uYR5u9sbF3%L<<@uM8f`1z7#kR*?5f9ok8d!x?cteBP58LWRb z&w8yg)ZzFM@~q)%n26fO9owIk&(i3;&h?X~*2-^%QGT4R*YN}Oz5QahnI(;FbvJbH NHadHB-K -Implementation Notes --------------------- - -The following simple types are defined in ``simpletypes.py``. - -ST_LongHexNumber - This is a string representation of a 4-byte hexadecimal - number. - It inherits from ``XsdUnsignedInt`` (4-byte unsigned integer), - and uses the ``validate`` method from that class. - The ``convert_to_xml`` and ``convert_from_xml`` - methods are straightforward. -ST_MultiLevelType - This is a string with one of three possible values: - ``"singleLevel"``, ``"multiLevel"``, or ``"hybridMultiLevel"``. - It is defined similary to other ``XsdStringEnumeration``-based - simple types. -ST_LevelSuffix - Similar to ``ST_MultiLevelType``. Possible values are - ``"tab"``, ``"space"``, or ``"nothing"``. -ST_NumberFormat - Similar to ``ST_MultiLevelType``. 63 possible values, - the most common in US settings are ``"decimal"``, - ``"upperRoman"``, ``"lowerRoman"``, ``"upperLetter"``, - ``"lowerLetter"``, ``"ordinal"``, ``"cardinalText"``, - and ``"ordinalText"``. - -The following complex types are defined in ``numbering.py``. - -CT_MultiLevelType - This is the simpletype of complex type: it has no children - and only a single attribute, ``val``. I'll call this - type an "atomic complex type." -CT_LevelSuffix - Another atomic complex type. -CT_NumFmt - This is a complex type with no children, - one required attribute, ``val``, and one - optional attribute, ``format``. -CT_LvlLegacy - This type has three optional attributes, - ``legacy``, ``legacySpace`` and ``legacyIndent``. - Clearly, its use is intended for parsing of documents - in a legacy format. - -The following complex types are defined in ``shared.py`` -because they are referred to by a type outside of -the numbering part of the OPC package. - -CT_LongHexNumber - Another atomic complex type. + .. [#first] ISO/IEC 29500-1:2012(E) at 684. diff --git a/docx/oxml/__init__.py b/docx/oxml/__init__.py index 43ad5ec0f..e39bc3728 100644 --- a/docx/oxml/__init__.py +++ b/docx/oxml/__init__.py @@ -77,7 +77,8 @@ def OxmlElement(nsptag_str, attrs=None, nsdecls=None): from .numbering import ( CT_Num, CT_Numbering, CT_NumLvl, CT_NumPr, CT_LevelSuffix, CT_NumFmt, CT_MultiLevelType, - CT_LvlLegacy, CT_LevelText, CT_NumPicBullet + CT_LvlLegacy, CT_LevelText, CT_NumPicBullet, + CT_Lvl, CT_AbstractNum ) register_element_cls('w:abstractNumId', CT_DecimalNumber) register_element_cls('w:ilvl', CT_DecimalNumber) @@ -93,6 +94,8 @@ def OxmlElement(nsptag_str, attrs=None, nsdecls=None): register_element_cls('w:legacy', CT_LvlLegacy) register_element_cls('w:lvlText', CT_LevelText) register_element_cls('w:numPicBullet', CT_NumPicBullet) +register_element_cls('w:lvl', CT_Lvl) +register_element_cls('w:abstractNum', CT_AbstractNum) from .section import CT_PageMar, CT_PageSz, CT_SectPr, CT_SectType register_element_cls('w:pgMar', CT_PageMar) diff --git a/docx/oxml/numbering.py b/docx/oxml/numbering.py index 31444a4f1..0b6438c30 100644 --- a/docx/oxml/numbering.py +++ b/docx/oxml/numbering.py @@ -8,7 +8,7 @@ from .shared import CT_DecimalNumber from .simpletypes import ( ST_DecimalNumber, ST_LevelSuffix, ST_NumberFormat, ST_String, ST_MultiLevelType, - ST_TwipsMeasure, ST_SignedTwipsMeasure, ST_OnOff + ST_TwipsMeasure, ST_SignedTwipsMeasure, ST_OnOff, ST_LongHexNumber ) from .xmlchemy import ( BaseOxmlElement, OneAndOnlyOne, RequiredAttribute, ZeroOrMore, ZeroOrOne, @@ -27,7 +27,7 @@ class CT_LevelText(BaseOxmlElement): def new(cls, val): """ Return a new ```` element with - ``val`` attribute set to ``val`` + ``val`` attribute set to *val* """ lvlText = OxmlElement('w:lvlText') lvlText.val = val @@ -44,7 +44,7 @@ class CT_LevelSuffix(BaseOxmlElement): def new(cls, val): """ Return a new ```` element with ``val`` - attribute set to ``val`` + attribute set to *val* """ suff = OxmlElement('w:suff') suff.val = val @@ -62,7 +62,7 @@ class CT_NumFmt(BaseOxmlElement): def new(cls, val): """ Return a new ```` element with ``val`` - attrribute set to ``val`` + attrribute set to *val* """ numFmt = OxmlElement('w:numFmt') numFmt.val = val @@ -90,12 +90,69 @@ class CT_MultiLevelType(BaseOxmlElement): def new(cls, val): """ Return a new ```` element with ``val`` - attribute set to ``val`` + attribute set to *val* """ multiLevelType = OxmlElement('w:multiLevelType') multiLevelType.val = val return multiLevelType +class CT_AbstractNum(BaseOxmlElement): + """ + ```` element, which collects + all of the level-specific style information + for a particular style. + """ + nsid = ZeroOrMore('w:nsid') + multiLevelType = ZeroOrMore('w:multiLevelType') + tmpl = ZeroOrMore('w:tmpl') + name = ZeroOrMore('w:name') + styleLink = ZeroOrMore('w:styleLink') + numStyleLink = ZeroOrMore('w:numStyleLink') + lvl = ZeroOrMore('w:lvl') + abstractNumId = RequiredAttribute('w:abstractNumId', ST_DecimalNumber) + + @classmethod + def new(cls, abstractNumId): + """ + Return a new ```` element with ``abstractNumId`` + set to *abstractNumId*. + """ + abstractNum = OxmlElement('w:abstractNum') + abstractNum.abstractNumId = abstractNumId + return abstractNum + +class CT_Lvl(BaseOxmlElement): + """ + ```` element, which contains all of + the actual, level-specific formatting for + a list style. + """ + start = ZeroOrMore('w:start') + numFmt = ZeroOrMore('w:numFmt') + lvlRestart = ZeroOrMore('w:lvlRestart') + pStyle = ZeroOrMore('w:pStyle') + isLgl = ZeroOrMore('w:isLgl') + suff = ZeroOrMore('w:suff') + lvlText = ZeroOrMore('w:lvlText') + lvlPicBulletId = ZeroOrMore('w:lvlPicBulletId') + legacy = ZeroOrMore('w:legacy') + lvlJc = ZeroOrMore('w:lvlJc') + pPr = ZeroOrMore('w:pPr') + rPr = ZeroOrMore('w:rPr') + ilvl = RequiredAttribute('w:ilvl', ST_DecimalNumber) + tplc = OptionalAttribute('w:tplc', ST_LongHexNumber) + tentative = OptionalAttribute('w:tentative', ST_OnOff) + + @classmethod + def new(cls, ilvl): + """ + Return a new ```` element with ``ilvl`` + attribute set to *ilvl* + """ + lvl = OxmlElement('w:lvl') + lvl.ilvl = ilvl + return lvl + class CT_NumPicBullet(BaseOxmlElement): """ ````` for specifying @@ -105,11 +162,12 @@ class CT_NumPicBullet(BaseOxmlElement): pict = Choice('w:pict') drawing = Choice('w:drawing') numPicBulletId = RequiredAttribute('w:numPicBulletId', ST_DecimalNumber ) + @classmethod def new(cls, Id): """ Return a new ```` element with ``numPicBulletId`` - attribute set to ``numPicBulletId`` + attribute set to *numPicBulletId* """ numPicBullet = OxmlElement('w:numPicBullet') numPicBullet.numPicBulletId = Id @@ -198,6 +256,7 @@ class CT_Numbering(BaseOxmlElement): numbering.xml """ num = ZeroOrMore('w:num', successors=('w:numIdMacAtCleanup',)) + abstractNum = ZeroOrMore('w:abstractNum') def add_num(self, abstractNum_id): """ From f42f1538a4781e529bd63b2b3bb34e7ac724985f Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Sat, 1 Dec 2018 12:56:47 -0600 Subject: [PATCH 08/17] Added example to contributor section. --- docs/dev/analysis/features/numbering.rst | 78 ++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/docs/dev/analysis/features/numbering.rst b/docs/dev/analysis/features/numbering.rst index 8bf6c62a5..22f9be36d 100644 --- a/docs/dev/analysis/features/numbering.rst +++ b/docs/dev/analysis/features/numbering.rst @@ -210,6 +210,84 @@ in ``oxml.__init__``), it is possible to implement solutions to the documented issues noted above in a disciplined way. +Making use of low-level support +------------------------------- +Once the types listed above are defined and the **xmlchemy** +submodule methods can be used, it becomes a little less +painful to implement a solution to the StackOverflow +question referred to above. + + +.. code-block:: python + + + #!/usr/bin/python + + from docx import Document + from docx import oxml + + + d = Document() + + + """ + 1. Create an abstract numbering definition for a multi-level numbering style. + """ + numXML = d.part.numbering_part.numbering_definitions._numbering + nextAbstractId = max([ J.abstractNumId for J in numXML.abstractNum_lst ] ) + 1 + l = numXML.add_abstractNum() + l.abstractNumId = nextAbstractId + m = l.add_multiLevelType() + m.val = 'multiLevel' + + + """ + 2. Define numbering formats for each (zero-indexed) + level. N.B. The formatting text is one-indexed. + The user agent will accept up to nine levels. + """ + formats = {0: "decimal", 1: "upperLetter" } + textFmts = {0: '%1.', 1: '%2.' } + for i in range(2): + lvl = l.add_lvl() + lvl.ilvl = i + n = lvl.add_numFmt() + n.val = formats[i] + lt = lvl.add_lvlText() + lt.val = textFmts[i] + + """ + 3. Link the abstract numbering definition to a numbering definition. + """ + n = numXML.add_num(nextAbstractId) + + """ + 4. Define a function to set the (0-indexed) numbering level of a paragraph. + """ + def set_ilvl(p,ilvl): + pr = p._element._add_pPr() + np = pr.get_or_add_numPr() + il = np.get_or_add_ilvl() + il.val = ilvl + ni = np.get_or_add_numId() + ni.val = n.numId + return(p) + + """ + 5. Create some content + """ + for x in [1,2,3]: + p = d.add_paragraph() + set_ilvl(p,0) + p.add_run("Question %i" % x) + for y in [1,2,3,4]: + p2 = d.add_paragraph() + set_ilvl(p2,1) + p2.add_run("Choice %i" % y) + + + d.save('test.docx') + Element Semantics ----------------- From 160dddcf0cb4c6b459115fa91859de9d3c0506fe Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Tue, 31 Mar 2020 23:57:29 -0500 Subject: [PATCH 09/17] register nsid and tmpl elements --- docx/oxml/__init__.py | 2 ++ ref/.swp | Bin 12288 -> 0 bytes 2 files changed, 2 insertions(+) delete mode 100644 ref/.swp diff --git a/docx/oxml/__init__.py b/docx/oxml/__init__.py index 0f884d47c..474cdd469 100644 --- a/docx/oxml/__init__.py +++ b/docx/oxml/__init__.py @@ -97,6 +97,8 @@ def OxmlElement(nsptag_str, attrs=None, nsdecls=None): register_element_cls('w:numPicBullet', CT_NumPicBullet) register_element_cls('w:lvl', CT_Lvl) register_element_cls('w:abstractNum', CT_AbstractNum) +register_element_cls('w:nsid', CT_LongHexNumber) +register_element_cls('w:tmpl', CT_LongHexNumber) from .section import ( # noqa CT_HdrFtr, diff --git a/ref/.swp b/ref/.swp deleted file mode 100644 index c885905bd327eed8e8a0cf19616fe08767695391..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeHL*=iI)6s`Cst|V^YR*C2+R6-Jkpd=49-IeKzJyk<5Nr+F`9)v8CMSSzYAMpFH)3d~YB#5`+OyB+9I#tCmvoXCan{;mK1%c!h>)H24W|x$ zL)>IDot%3)H#;;AoyY((aGnfY%%9KBOq&TFO^nmA(fmAz!QRLKGJp&q1IPd}fD9l5 z$N(~M#ta<28zCQ|=LOr>{RJ>$b@x8wv9KL7fD9l5$N(~c3?Ku@05X6KAOpw%GJp*H zMF!Tl2>Ee|kg3a16n^}>-~ZpQ5%L+Z2bc%^yh_MdzyaU};L8<4-T)o~enIXxz$ZWq zFtwflCIA#LZeis69r|OC4W0sw&)@;T#GCg`z%78u8MC-+^*iu3e)l$YOi!0<;%);* z0rxCw9kPixv8Jb!&AbNqAOpz2Kga-uXa2+C)~oHk4nkoHxQqqFCuymuyjk~(k0U(cbs6yb z5)TIA{D+f zP4YCAT*c5XVNT0iEu$%|1S79?A~>w7Au}E`TB_{=r5=k$+i7EG8OgX@;R+i1^Z*vr zHGnk~1yb2;#d1*!V4)J2MLJJm3`S%qbR*%dXibNb2U)^HnMt4rhV%W}^ZD?i!|>>K zlTZY*$z!2{Si|&zOoCY0kr?$gyZs%Gu0B4zoS2aYS3KlqjXKTEIjOW;%;Olovsyil z7Egp?gv(rL6SN}34E9|nI^rF=Ew?5T&1fCsM8?PxZxvf%x5}w@XELGu>Z{|FtM|kB zMzF!fBzAz_0B?zSyjadkBC%R*ZonHboTtVg5I2|KK~kK}@)j|wlTa309q>{r@1ivq Z3VCYR&uDRw6W!#B(V~o%3%e~zegigJeY^kw From 2877120de536045aca9aa9bee32b70938c050e6f Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Wed, 1 Apr 2020 00:15:27 -0500 Subject: [PATCH 10/17] fix capitalization on multiLevelType type attribute (should read multilevel) --- docx/oxml/simpletypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docx/oxml/simpletypes.py b/docx/oxml/simpletypes.py index 2081f0c62..59e5087c4 100644 --- a/docx/oxml/simpletypes.py +++ b/docx/oxml/simpletypes.py @@ -317,7 +317,7 @@ class ST_MultiLevelType(XsdStringEnumeration): Valid values for attribute """ SINGLE = 'singleLevel' - MULTI = 'multiLevel' + MULTI = 'multilevel' HYBRID = 'hybridMultiLevel' _members = (SINGLE, MULTI, HYBRID) From 5bd5cf6a54a2a5585c05f79279da63ce78b8e828 Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Wed, 1 Apr 2020 00:45:54 -0500 Subject: [PATCH 11/17] register two additional elements --- docx/oxml/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docx/oxml/__init__.py b/docx/oxml/__init__.py index 474cdd469..841cb6d47 100644 --- a/docx/oxml/__init__.py +++ b/docx/oxml/__init__.py @@ -99,6 +99,9 @@ def OxmlElement(nsptag_str, attrs=None, nsdecls=None): register_element_cls('w:abstractNum', CT_AbstractNum) register_element_cls('w:nsid', CT_LongHexNumber) register_element_cls('w:tmpl', CT_LongHexNumber) +register_element_cls('w:start', CT_DecimalNumber) +register_element_cls('w:styleLink', CT_String) +register_element_cls('w:numStyleLink', CT_String) from .section import ( # noqa CT_HdrFtr, From 149324759520785de599b4cde80293f358464ec8 Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Thu, 2 Apr 2020 19:59:37 -0500 Subject: [PATCH 12/17] register isLgl, lvlRestart --- docx/oxml/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docx/oxml/__init__.py b/docx/oxml/__init__.py index 841cb6d47..ed87b30c3 100644 --- a/docx/oxml/__init__.py +++ b/docx/oxml/__init__.py @@ -102,6 +102,9 @@ def OxmlElement(nsptag_str, attrs=None, nsdecls=None): register_element_cls('w:start', CT_DecimalNumber) register_element_cls('w:styleLink', CT_String) register_element_cls('w:numStyleLink', CT_String) +register_element_cls('w:lvlRestart', CT_DecimalNumber) +register_element_cls('w:lvlPicBulletId',CT_DecimalNumber) +register_element_cls('w:isLgl', CT_OnOff) from .section import ( # noqa CT_HdrFtr, From b5ba8f2b477139dbe4268798446936917daa4e27 Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Fri, 3 Apr 2020 14:38:34 -0500 Subject: [PATCH 13/17] fix spelling hybridMultilevel --- docx/oxml/simpletypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docx/oxml/simpletypes.py b/docx/oxml/simpletypes.py index 59e5087c4..0e3434693 100644 --- a/docx/oxml/simpletypes.py +++ b/docx/oxml/simpletypes.py @@ -318,7 +318,7 @@ class ST_MultiLevelType(XsdStringEnumeration): """ SINGLE = 'singleLevel' MULTI = 'multilevel' - HYBRID = 'hybridMultiLevel' + HYBRID = 'hybridMultilevel' _members = (SINGLE, MULTI, HYBRID) From 72fa8ed91d17f4478a2b151b790a31bebee1425f Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Fri, 3 Apr 2020 21:55:18 -0500 Subject: [PATCH 14/17] correct error in ST_TwipsMeasure and ST_SignedTwipsMeasure --- docx/oxml/simpletypes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docx/oxml/simpletypes.py b/docx/oxml/simpletypes.py index 0e3434693..fee96beff 100644 --- a/docx/oxml/simpletypes.py +++ b/docx/oxml/simpletypes.py @@ -455,7 +455,7 @@ def convert_from_xml(cls, str_value): @classmethod def convert_to_xml(cls, value): - emu = Emu(value) + emu = Twips(value) twips = emu.twips return str(twips) @@ -498,7 +498,7 @@ def convert_from_xml(cls, str_value): @classmethod def convert_to_xml(cls, value): - emu = Emu(value) + emu = Twips(value) twips = emu.twips return str(twips) From 008593855865e5decd7aeaca8dfeefc9a1dc7ad4 Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Fri, 3 Apr 2020 23:23:53 -0500 Subject: [PATCH 15/17] Revert "correct error in ST_TwipsMeasure and ST_SignedTwipsMeasure" This reverts commit 72fa8ed91d17f4478a2b151b790a31bebee1425f. --- docx/oxml/simpletypes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docx/oxml/simpletypes.py b/docx/oxml/simpletypes.py index fee96beff..0e3434693 100644 --- a/docx/oxml/simpletypes.py +++ b/docx/oxml/simpletypes.py @@ -455,7 +455,7 @@ def convert_from_xml(cls, str_value): @classmethod def convert_to_xml(cls, value): - emu = Twips(value) + emu = Emu(value) twips = emu.twips return str(twips) @@ -498,7 +498,7 @@ def convert_from_xml(cls, str_value): @classmethod def convert_to_xml(cls, value): - emu = Twips(value) + emu = Emu(value) twips = emu.twips return str(twips) From 60e54d91ecc18ff92ccd2acbbb2ee489fc3548f7 Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Thu, 9 Apr 2020 01:43:08 -0500 Subject: [PATCH 16/17] add one method to CT_AbstractNum --- docx/oxml/numbering.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docx/oxml/numbering.py b/docx/oxml/numbering.py index 0b6438c30..baab31d75 100644 --- a/docx/oxml/numbering.py +++ b/docx/oxml/numbering.py @@ -278,6 +278,17 @@ def num_having_numId(self, numId): except IndexError: raise KeyError('no element with numId %d' % numId) + def abstractNum_having_abstractNumId(self, abstractNumId): + """ + Return the ```` child element having ``numId`` attribute + matching *numId*. + """ + xpath = './w:abstractNum[@w:AbstractNumId="%d"]' % abstractNumId + try: + return self.xpath(xpath)[0] + except IndexError: + raise KeyError('no element with numId %d' % abstractNumId) + @property def _next_numId(self): """ From 5a92d48114e80b4026409c2ae2b92b8774182604 Mon Sep 17 00:00:00 2001 From: Jesse Lovegren Date: Thu, 9 Apr 2020 01:50:03 -0500 Subject: [PATCH 17/17] correct typo in prior commit --- docx/oxml/numbering.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docx/oxml/numbering.py b/docx/oxml/numbering.py index baab31d75..ec146a43a 100644 --- a/docx/oxml/numbering.py +++ b/docx/oxml/numbering.py @@ -280,14 +280,14 @@ def num_having_numId(self, numId): def abstractNum_having_abstractNumId(self, abstractNumId): """ - Return the ```` child element having ``numId`` attribute + Return the ```` child element having ``abstractNumId`` attribute matching *numId*. """ - xpath = './w:abstractNum[@w:AbstractNumId="%d"]' % abstractNumId + xpath = './w:abstractNum[@w:abstractNumId="%d"]' % abstractNumId try: return self.xpath(xpath)[0] except IndexError: - raise KeyError('no element with numId %d' % abstractNumId) + raise KeyError('no element with abstractNumId %d' % abstractNumId) @property def _next_numId(self):