Compare commits

..

No commits in common. '7fd046bc3d18c5d6640705188fa78165a15586b5' and '8d8455898cec73b414b4ba3b9aae5e8ae2a52d6f' have entirely different histories.

@ -1,14 +1,6 @@
# Changelog
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.
All notable changes to this project will be documented in this file
## 0.1.1 - 2021-04-16
@ -16,7 +8,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
@ -24,4 +16,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,10 +1,6 @@
# yaclog-ksp
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*
A command line tool for converting markdown changelogs to [KerbalChangelog] config files.
## Installation
@ -85,5 +81,4 @@ but this paragraph works pretty well to get the point across!
```
[yaclog]: https://github.com/drewcassidy/yaclog
[KerbalChangelog]: https://github.com/HebaruSan/KerbalChangelog

@ -7,10 +7,11 @@ 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 :: 4 - Beta
Development Status :: 3 - Alpha
Intended Audience :: Developers
License :: OSI Approved :: GNU Affero General Public License v3
Operating System :: OS Independent
@ -22,16 +23,9 @@ 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 ~= 7.0
yaclog ~= 0.1
python_requires = >= 3.8
install_requires = Click; GitPython; yaclog
python_requires >= 3.8
packages = find:
[options.entry_points]

@ -1,24 +1,8 @@
# 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
@ -108,7 +92,6 @@ 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, text):
script = Script("", text, "{}=", False)
def load(cls, textv):
script = Script("", textv, "{}=", False)
script.error = cfg_error.__get__(script, Script)
nodes = []
while script.token_available(True):
@ -176,10 +176,21 @@ class ConfigNode:
segments[index] = "%s%s = %s\n" % (" " * (level + 1), val[0], val[1])
index += 1
for node in self.nodes:
text = node[1].__str__(level + 1)
segments[index] = "%s%s %s\n" % (" " * (level + 1), node[0], text)
ntext = node[1].__str__(level + 1)
segments[index] = "%s%s %s\n" % (" " * (level + 1), node[0], ntext)
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