Commits

Martin von Löwis  committed 98528da

First cut of doc generator.

  • Participants
  • Parent commits f52f666

Comments (0)

Files changed (2)

File cldr/cldr.rst

-
 .. module:: cldr
    :synopsis: Unicode Common Locale Data Repository for Python
 .. moduleauthor:: Martin v. Löwis <martin@v.loewis.de>
 
 The :mod:`cldr` module exports the following LDML base classes:
 
-.. class:: languages
+
+.. class:: Alias
    :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
 
-   - Optional child of :class:`LocaleDisplayNames`
-   - LDMLBase class with the following child elements and attributes:
+     - :attr: draft
+     - :attr: source
+     - :attr: alt
+     - :attr: special
+     - :attr: path
 
-     - :attr:`language`
-     - :attr:`special`
-     - :attr:`draft`
+.. class:: Any
+   :noindex:
+   - XXX child of YYY element
 
-.. class:: territories
+.. class:: Cp
    :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
 
-   - Optional child of :class:`LocaleDisplayNames`
-   - LDMLBase class with the following child elements and attributes:
+     - :attr: hex
+     - :attr: special
 
-     - :attr:`territory`
-     - :attr:`special`
-     - :attr:`draft`
-     - :attr:`standard`
-     - :attr:`references`
-     - :attr:`validSublocales`
+.. class:: Default
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
 
-.. class:: language
+     - :attr: draft
+     - :attr: special
+     - :attr: references
+     - :attr: type
+     - :attr: alt
+     - :attr: choice
+
+.. class:: Empty
    :noindex:
+   - XXX child of YYY element
 
-   - MandatoryChild of the :class:`Identity`
-   - PCDATA class with the following attributes:
+.. class:: Fallback
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
 
-     - :attr:`type`
-     - :attr:`draft`
-     - :attr:`references`
-     - :attr:`alt`
+     - :attr: draft
+     - :attr: references
+     - :attr: alt
 
+.. class:: Generation
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: date
+
+.. class:: Identity
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: script
+     - :attr: version
+     - :attr: special
+     - :attr: language
+     - :attr: territory
+     - :attr: variant
+     - :attr: generation
+
+.. class:: LDMLBase
+   :noindex:
+   - XXX child of YYY element
+
+.. class:: Language
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: draft
+     - :attr: type
+     - :attr: references
+     - :attr: alt
+
+.. class:: Languages
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: draft
+     - :attr: special
+     - :attr: language
+     - :attr: standard
+     - :attr: references
+     - :attr: validSublocales
+
+.. class:: LocaleDisplayNames
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: localeDisplayPattern
+     - :attr: languages
+     - :attr: types
+     - :attr: special
+     - :attr: scripts
+     - :attr: measurementSystemNames
+     - :attr: territories
+     - :attr: codePatterns
+     - :attr: keys
+     - :attr: transformNames
+     - :attr: variants
+     - :attr: draft
+
+.. class:: LocaleDisplayPattern
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: draft
+     - :attr: reference
+     - :attr: special
+     - :attr: localeKeyTypePattern
+     - :attr: localeSeparator
+     - :attr: localePattern
+     - :attr: alt
+
+.. class:: Numbers
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: currencyFormats
+     - :attr: defaultNumberingSystem
+     - :attr: special
+     - :attr: decimalFormats
+     - :attr: scientificFormats
+     - :attr: currencies
+     - :attr: symbols
+     - :attr: percentFormats
+     - :attr: otherNumberingSystems
+
+.. class:: PCDATA
+   :noindex:
+   - XXX child of YYY element
+
+.. class:: PresumedEmpty
+   :noindex:
+   - XXX child of YYY element
+
+.. class:: Script
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: draft
+     - :attr: type
+     - :attr: references
+     - :attr: alt
+
+.. class:: Special
+   :noindex:
+   - XXX child of YYY element
+
+.. class:: Symbols
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: group
+     - :attr: nativeZeroDigit
+     - :attr: draft
+     - :attr: list
+     - :attr: standard
+     - :attr: currencyDecimal
+     - :attr: patternDigit
+     - :attr: decimal
+     - :attr: alt
+     - :attr: percentSign
+     - :attr: special
+     - :attr: infinity
+     - :attr: nan
+     - :attr: plusSign
+     - :attr: numberSystem
+     - :attr: minusSign
+     - :attr: perMille
+     - :attr: exponential
+     - :attr: validSubLocales
+     - :attr: references
+     - :attr: currencyGroup
+
+.. class:: Territories
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: draft
+     - :attr: special
+     - :attr: standard
+     - :attr: references
+     - :attr: territory
+     - :attr: validSublocales
+
+.. class:: Territory
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: draft
+     - :attr: type
+     - :attr: references
+     - :attr: alt
+
+.. class:: Variant
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: draft
+     - :attr: type
+     - :attr: references
+     - :attr: alt
+
+.. class:: Version
+   :noindex:
+   - XXX child of YYY element
+   - the class has the following attributes:
+
+     - :attr: cldrVersion
+     - :attr: number

File cldr/gendoc.py

+# Generate Sphinx documentation for LDML schema classes
+from . import ldml
+
+def genclass(klasse):
+    print()
+    print('.. class:: ' + klasse.__name__)
+    print('   :noindex:')
+    print('   - XXX child of YYY element')
+    if klasse._fields:
+        print('   - the class has the following attributes:\n')
+        for name, data in klasse._fields.items():
+            print('     - :attr: '+name)
+
+
+print(""".. module:: cldr
+   :synopsis: Unicode Common Locale Data Repository for Python
+.. moduleauthor:: Martin v. Löwis <martin@v.loewis.de>
+
+The :mod:`cldr` module supplies classes for localizing data. The focus of the
+implementation is on efficient extraction of the iCLDR XML file for output
+formatting and manipulation. For related functionality, see also the
+:mod:`datetime` module.
+
+The :mod:`cldr` module exports the following LDML base classes:
+""")
+
+for name in dir(ldml):
+    item = getattr(ldml, name)
+    if not isinstance(item, type):
+        continue
+    if not issubclass(item, ldml.LDMLBase):
+        continue
+    if issubclass(item, ldml.Incomplete):
+        continue
+    genclass(item)
+