Skip to content

Commit

Permalink
Readme generation: header and footer images added
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Jun 13, 2021
1 parent 8a5705d commit 137e07d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion icm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# -- Author Jesús Arroyo
# -- Licence GPLv2

VERSION = (0, 4, 7)
VERSION = (0, 4, 8)
__version__ = ".".join([str(s) for s in VERSION])

__title__ = "icm"
Expand Down
32 changes: 31 additions & 1 deletion icm/commands/cmd_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def _generate_readme_string():
version=package["version"].replace("-", "--"),
description=package["description"],
license=package.get("license"),
# -- Add the header image
header=_create_header(package),
# -- Add the logo image
logo=_create_logo(package),
# -- Add the wiki section
Expand All @@ -169,6 +171,8 @@ def _generate_readme_string():
languages=_create_languages_section(),
authors=_create_authors_section(package),
contributors=_create_contributor_section(package),
# -- Add the footer image
footer=_create_footer(package),
)

return data
Expand All @@ -183,12 +187,38 @@ def _create_wiki(package):
if package.get("wiki"):
url = package["wiki"]
data += "## Documentation\n"
data += "Find more information in the "
data += "Find all the information on the "
data += f"[WIKI page]({url}) \n"

return data


def _create_header(package):
"""README: create the markdown string with the header image"""

data = ""

# -- Get the header image
if package.get("header"):
file = package["header"]
data += f"![]({file})\n"

return data


def _create_footer(package):
"""README: create the markdown string with the footer image"""

data = ""

# -- Get the header image
if package.get("footer"):
file = package["footer"]
data += f"![]({file})\n"

return data


def _create_logo(package):
"""README: create the markdown string with the logo"""

Expand Down
5 changes: 5 additions & 0 deletions icm/resources/README.tpl.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$header

# $name Collection

[![Icestudio][icestudio-image]][icestudio-url]
Expand Down Expand Up @@ -25,6 +27,9 @@ $examples
$authors
$contributors

-------
$footer

<!-- Badges -->
[icestudio-image]: https://img.shields.io/badge/collection-icestudio-blue.svg
[icestudio-url]: https://github.com/FPGAwars/icestudio
Expand Down

0 comments on commit 137e07d

Please sign in to comment.