Skip to content

Commit

Permalink
Merge pull request #627 from Murmele/RegexAppdataDate
Browse files Browse the repository at this point in the history
Regex appdata date
  • Loading branch information
Murmele authored Aug 29, 2023
2 parents 24f52d9 + 3e544af commit cc78ce2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmake/generate_appdata.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# For testing enable
#set(CMAKE_SOURCE_DIR <PATH TO SOURCE>)
#set(CMAKE_BINARY_DIR <PATH TO BINARY DIR>)
#set(DOC_SOURCE_DIR ${CMAKE_SOURCE_DIR}/docs)
#set(DOC_BINARY_DIR ${CMAKE_BINARY_DIR}/docs)
#set(CHANGELOG_HTML ${DOC_BINARY_DIR}/changelog.html)
#set(APPDATA_CONF ${CMAKE_SOURCE_DIR}/rsrc/linux/com.github.Murmele.Gittyup.appdata.xml.in)
#set(APPDATA ${CMAKE_BINARY_DIR}/rsrc/linux/com.github.Murmele.Gittyup.appdata.xml)

# add release notes to the appdata file
file(READ "${CHANGELOG_HTML}" HTML_CHANGELOGS)
# it is not allowed to have multiple texts without being in an environment
# So the description will be used for it
string(REGEX REPLACE "<p>([^<]*)<\\/p>" "\\1" RELEASES ${HTML_CHANGELOGS}) # remove paragraph environment
string(REGEX REPLACE "<h4>([A-Za-z0-9]*)<\\/h4>" "<p>\\1</p>" RELEASES ${RELEASES}) # h4 is unknow to appdata so change it to a paragraph environment
string(REPLACE "\n" "\n\t" RELEASES ${RELEASES}) # add tabulator
string(REGEX REPLACE "<h3>(v[1-9]\\.[0-9]\\.[0-9]) - ([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])<\\/h3>" "<release version='\\1' date='\\2'>\n\t<description>" RELEASES ${RELEASES})
# For Dev Version "vX.X.X - <current date> (DEV)" can be used to show in the changelog the current progress
string(REGEX REPLACE "<h3>(v[1-9]\\.[0-9]\\.[0-9]|vX\\.X\\.X) - ([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])( \\(DEV\\))?<\\/h3>" "<release version='\\1' date='\\2'>\n\t<description>" RELEASES ${RELEASES})
string(REGEX REPLACE "<hr \\/>" "</description>\n\t</release>" RELEASES ${RELEASES})
configure_file(${APPDATA_CONF} ${APPDATA})
10 changes: 10 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### vX.X.X - 2023-04-20 (DEV)

Description

#### Added

#### Changed

----

### v1.3.0 - 2023-04-20

Performance Improvement and feature release
Expand Down

0 comments on commit cc78ce2

Please sign in to comment.