Compare commits

...

8 Commits

Author SHA1 Message Date
Andrew Cassidy 7fd046bc3d Version 0.2.0
### Changed

- Generator now adds a comment to files stating they were automatically created by this tool.
- Tweaks and fixes to project metadata in setup.cfg.
- Marked version compatibility with yaclog.
3 years ago
Andrew Cassidy eeabf52b02 Fix python_requires tag 3 years ago
Andrew Cassidy 7468c3c46f cfgnode cleanup and update CHANGELOG.md 3 years ago
Andrew Cassidy 55352697dd add newline to end of comment 3 years ago
Andrew Cassidy bc0ddc1ff3 refactor imports 3 years ago
Andrew Cassidy 9c4eecb0a3 Add copyright notice 3 years ago
Andrew Cassidy 12bffc1093 Add more links 3 years ago
Andrew Cassidy fe6ca6559a Add comment in generated files saying it was autogenerated 3 years ago

@ -1,6 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file
All notable changes to this project will be documented in this file.
## 0.2.0 - 2021-05-06
### Changed
- Generator now adds a comment to files stating they were automatically created by this tool.
- Tweaks and fixes to project metadata in setup.cfg.
- Marked version compatibility with yaclog.
## 0.1.1 - 2021-04-16
@ -8,7 +16,7 @@ yaclog-ksp is [now available on PyPi!](https://pypi.org/project/yaclog-ksp/)
### Changed
- generator will now use change values instead of nodes when possible for more concise output files.
- Generator will now use change values instead of nodes when possible for more concise output files.
## 0.1.0 - 2021-04-16
@ -16,4 +24,4 @@ First release
### Added
- `yaclog-ksp` command line tool for converting markdown changelogs to KerbalChangelog configs
- `yaclog-ksp` command line tool for converting markdown changelogs to KerbalChangelog configs.

@ -1,6 +1,10 @@
# yaclog-ksp
A command line tool for converting markdown changelogs to [KerbalChangelog] config files.
A command line tool based on [yaclog] for converting markdown changelogs to [KerbalChangelog] config files.
![a yak who is a log](https://github.com/drewcassidy/yaclog/raw/main/logo.png)
*Logo by Erin Cassidy*
## Installation
@ -81,4 +85,5 @@ but this paragraph works pretty well to get the point across!
```
[yaclog]: https://github.com/drewcassidy/yaclog
[KerbalChangelog]: https://github.com/HebaruSan/KerbalChangelog

@ -7,11 +7,10 @@ license = AGPLv3
license_file = LICENSE.md
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/drewcassidy/yaclog-ksp
keywords = changelog, commandline, markdown, KSP
classifiers =
Development Status :: 3 - Alpha
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: GNU Affero General Public License v3
Operating System :: OS Independent
@ -23,9 +22,16 @@ classifiers =
Topic :: Text Processing :: Markup :: Markdown
Topic :: Utilities
project_urls =
Changelog = https://github.com/drewcassidy/yaclog-ksp/blob/main/CHANGELOG.md
Source = https://github.com/drewcassidy/yaclog-ksp
Forum Post = https://forum.kerbalspaceprogram.com/index.php?/topic/201784-*
[options]
install_requires = Click; GitPython; yaclog
python_requires >= 3.8
install_requires =
Click ~= 7.0
yaclog ~= 0.1
python_requires = >= 3.8
packages = find:
[options.entry_points]

@ -1,8 +1,24 @@
# yaclog-ksp: yet another changelog tool
# Copyright (c) 2021. Andrew Cassidy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import pathlib
import re
import click
import os.path
import yaclog
import re
import pathlib
from yaclog_ksp.cfgnode import ConfigNode
@ -92,6 +108,7 @@ def main(inpath, outpath, name):
v_node.add_value('change', change)
with open(outpath, 'w') as fp:
fp.write('// Changelog file generated by yaclog-ksp (https://github.com/drewcassidy/yaclog-ksp)\n')
fp.write('KERBALCHANGELOG\n')
fp.write(str(node))

@ -72,8 +72,8 @@ class ConfigNode:
cfg_error(script, "unexpected end of file")
@classmethod
def load(cls, textv):
script = Script("", textv, "{}=", False)
def load(cls, text):
script = Script("", text, "{}=", False)
script.error = cfg_error.__get__(script, Script)
nodes = []
while script.token_available(True):
@ -176,21 +176,10 @@ class ConfigNode:
segments[index] = "%s%s = %s\n" % (" " * (level + 1), val[0], val[1])
index += 1
for node in self.nodes:
ntext = node[1].__str__(level + 1)
segments[index] = "%s%s %s\n" % (" " * (level + 1), node[0], ntext)
text = node[1].__str__(level + 1)
segments[index] = "%s%s %s\n" % (" " * (level + 1), node[0], text)
index += 1
if level >= 0:
segments[index] = "%s}\n" % (" " * level)
index += 1
return "".join(segments)
if __name__ == "__main__":
import sys
for arg in sys.argv[1:]:
text = open(arg, "rt").read()
try:
node = ConfigNode.load(text)
except ConfigNodeError as e:
print(arg + e.message)

Loading…
Cancel
Save