Debian Codegraph @

README

raw
1 changelog-chug is a parser for project Change Log documents.
2
3 changelog-chug
4 ##############
5
6 Example
7 =======
8
9 Given a reStructuredText document ChangeLog::
10
11 Change Log
12 ##########
13
14 Version 1.0.1
15 =============
16
17 :Released: 2020-01-10
18 :Maintainer: Cathy Morris <[email protected]>
19
20 …
21
22 Version 1.0
23 ===========
24
25 :Released: 2020-01-10
26 :Maintainer: Luis Flores <[email protected]>
27
28 …
29
30 Version 0.2
31 ===========
32
33 :Released: 2019-07-04
34 :Maintainer: Cathy Morris <[email protected]>
35
36 …
37
38 Version 0.2-alpha1
39 ==================
40
41 :Released: 2019-07-04
42 :Maintainer: Cathy Morris <[email protected]>
43
44 …
45
46 Version 0.1
47 ===========
48
49 :Released: 2019-05-16
50 :Maintainer: Cathy Morris <[email protected]>
51
52 …
53
54 Generate Change Log entry data for all versions from the reStructuredText
55 formatted ChangeLog::
56
57 >>> import pathlib
58 >>> import pprint
59 >>> import chug.parsers.rest
60 >>> import chug.writers
61 >>> infile_path = pathlib.Path(".", "ChangeLog")
62 >>> document_text = chug.parsers.get_changelog_document_text(infile_path)
63 >>> document = chug.parsers.rest.parse_rest_document_from_text(
64 ... document_text)
65 >>> entries = chug.parsers.rest.make_change_log_entries_from_document(
66 ... document)
67 >>> pprint.pprint([entry.as_version_info_entry() for entry in entries])
68 [OrderedDict([('release_date', '2020-01-10'),
69 ('version', '1.0.1'),
70 ('maintainer', 'Cathy Morris <[email protected]>'),
71 ('body', '…')]),
72 OrderedDict([('release_date', '2020-01-10'),
73 ('version', '1.0'),
74 ('maintainer', 'Luis Flores <[email protected]>'),
75 ('body', '…')]),
76 OrderedDict([('release_date', '2019-07-04'),
77 ('version', '0.2'),
78 ('maintainer', 'Cathy Morris <[email protected]>'),
79 ('body', '…')]),
80 OrderedDict([('release_date', '2019-07-04'),
81 ('version', '0.2-alpha1'),
82 ('maintainer', 'Cathy Morris <[email protected]>'),
83 ('body', '…')]),
84 OrderedDict([('release_date', '2019-05-16'),
85 ('version', '0.1'),
86 ('maintainer', 'Cathy Morris <[email protected]>'),
87 ('body', '…')])]
88
89 Generate a JSON document describing the latest version::
90
91 >>> import json
92 >>> latest_entry = entries[0]
93 >>> latest_entry_json = json.dumps(
94 ... latest_entry.as_version_info_entry(), indent=4)
95 >>> print(latest_entry_json)
96 {
97 "release_date": "2020-01-10",
98 "version": "1.0.1",
99 "maintainer": "Cathy Morris <[email protected]>",
100 "body": "\u2026"
101 }
102
103
104 Copying
105 =======
106
107 changelog-chug is free software. See the file `COPYING`_ for details.
108
109 .. _COPYING: COPYING
110
111
112 ..
113 This document is written using `reStructuredText`_ markup, and can
114 be rendered with `Docutils`_ to other formats.
115
116 .. _Docutils: http://docutils.sourceforge.net/
117 .. _reStructuredText: http://docutils.sourceforge.net/rst.html
118
119 ..
120 Local variables:
121 coding: utf-8
122 mode: rst
123 End:
124 vim: fileencoding=utf-8 filetype=rst :