Check-in [b52e581a05]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added html_escape (despite the name actually just escapes XML) to AppData template. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b52e581a052ba8cb652148d3b356c35a |
User & Date: | mario 2014-12-15 19:55:00 |
Context
2014-12-16
| ||
15:00 | Prefix update hook plugins with `filter_` in package/ dir. check-in: 65236fbdf3 user: mario tags: trunk | |
2014-12-15
| ||
19:55 | Added html_escape (despite the name actually just escapes XML) to AppData template. check-in: b52e581a05 user: mario tags: trunk | |
19:26 | AppData filter (`-u appdata`) which creates a basic PKG.appdata.xml for distro application centers. check-in: 7827ad9b42 user: mario tags: trunk | |
Changes
Changes to lib/fpm/package/appdata.rb.
1 2 3 4 5 6 7 8 | # # api: fpm # title: AppData/AppStream # description: Generates a pkg.appdata.xml for distribution package managers # type: template # depends: erb # category: meta # doc: http://en.wikipedia.org/wiki/AppStream, http://people.freedesktop.org/~hughsient/appdata/ | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # # api: fpm # title: AppData/AppStream # description: Generates a pkg.appdata.xml for distribution package managers # type: template # depends: erb # category: meta # doc: http://en.wikipedia.org/wiki/AppStream, http://people.freedesktop.org/~hughsient/appdata/ # version: 0.2 # # Creates a /usr/share/appdata/PKGNAME.appdata.xml file for consumption by # distribution package managers. # # → The point of which is to embed a shared screenshot and lookup user # reviews/ratings. (At least should benefit appcenter listings.) # → Only use this filter (-u appdata) if you're not already including a |
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 | # - Doesn't split up description into <p> and <ul> sections (or store lang=). # - Stub screenshot used, we might need a new --screenshot flag. # require "fpm/package" require "fpm/util" require "fileutils" # create appdata.xml file class FPM::Package::Appdata < FPM::Package def update dest = "#{staging_path}/usr/share/appdata/#{name}.appdata.xml" | > > > > < < > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # - Doesn't split up description into <p> and <ul> sections (or store lang=). # - Stub screenshot used, we might need a new --screenshot flag. # require "fpm/package" require "fpm/util" require "fileutils" require "erb" # create appdata.xml file class FPM::Package::Appdata < FPM::Package include ERB::Util def update dest = "#{staging_path}/usr/share/appdata/#{name}.appdata.xml" FileUtils.mkdir_p(File.dirname(dest)) File.open(dest, "w") do |xml| xml.write template("appstream.erb").result(binding) end end end |
Changes to templates/appstream.erb.
1 | <?xml version="1.0" encoding="UTF-8"?> | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?xml version="1.0" encoding="UTF-8"?> <!-- Maintainer: <%=h maintainer %>, autogenerated by `fpm -u appdata` --> <component type="desktop"> <id><%=h name %>.desktop</id> <metadata_license>CC0-1.0</metadata_license> <project_license><%=h license %></project_license> <name><%=h name %></name> <% summary, *description = ((description) or "no description given").split("\n") -%> <summary><%=h summary %></summary> <description> <p><%= h description[0,25].join("\n") # should actually generate mini-html with <p> and <ul>+<li> %></p> </description> <screenshots> <screenshot type="default"> <image>http://freshcode.club/img/nopreview.png</image> <caption>Main window..</caption> </screenshot> </screenshots> <url type="homepage"><%=h (url or "data:,") %></url> <updatecontact><%=h maintainer %></updatecontact> <!--project_group><%=h category %></project_group--> </component> |