
Hi Duncan, Attached is the package logo patch I was working on. * Show optional package logo on package page If a package has a logo.svg or logo.png file (all lower-case) in their package root then that logo is shown on the package page. SVG takes preference over PNG. Currently logos are served using the existing PackageContents feature. We could use a dedicated resource like "package/:package/logo" but this works fine for now. Regards, Bas

Hi Bas,
On 22 October 2011 21:15, Bas van Dijk
Attached is the package logo patch I was working on.
I wonder if perhaps you should implement this more like how Duncan implemented change logs. i.e.: 1. Add a rendLogo field to PackageRender 2. Have doPackageRender fill rendLogo out by doing an IO-monad query similar to getLogoHtml but which is of type e.g. IO (Maybe String), where the String will be the URI of the logo 3. Change packagePage to build HTML (i.e. img or object tag) from this URI based on the extension I think the advantage of this approach is that: a) You won't have to add the logo-finding code to both the package page and the candidate-package page, since PackageRender is shared code between them b) The rendLogo field of PackageRender could sensibly be consumed by other users -- e.g. a feature producing JSON representing a package c) It is more uniform with how stuff like this is currently implemented (I'm mainly thinking of changelogs here) Thoughts? Max

On 23 October 2011 00:58, Max Bolingbroke
Hi Bas,
On 22 October 2011 21:15, Bas van Dijk
wrote: Attached is the package logo patch I was working on.
I wonder if perhaps you should implement this more like how Duncan implemented change logs. i.e.:
1. Add a rendLogo field to PackageRender 2. Have doPackageRender fill rendLogo out by doing an IO-monad query similar to getLogoHtml but which is of type e.g. IO (Maybe String), where the String will be the URI of the logo 3. Change packagePage to build HTML (i.e. img or object tag) from this URI based on the extension
I think the advantage of this approach is that: a) You won't have to add the logo-finding code to both the package page and the candidate-package page, since PackageRender is shared code between them b) The rendLogo field of PackageRender could sensibly be consumed by other users -- e.g. a feature producing JSON representing a package c) It is more uniform with how stuff like this is currently implemented (I'm mainly thinking of changelogs here)
Thoughts?
Max
I like the idea Max. Attached is the patch which implements it. There's only one issue: In doPackageRender I can't make the distinction between normal and candidate packages so I can't serve the correct logo url. So currently candidate logo's are broken. Do you have an idea to make them work again? Regards, Bas

On 24 October 2011 07:27, Bas van Dijk
I like the idea Max. Attached is the patch which implements it. There's only one issue: In doPackageRender I can't make the distinction between normal and candidate packages so I can't serve the correct logo url. So currently candidate logo's are broken. Do you have an idea to make them work again?
I see. It looks like doCandidateRender fixes up the result of doPackageRender by modifying the rendPkgUri. What this suggests to me is that we don't want to store the full logo URI but instead define a rendLogoUri :: PackageRender -> Maybe String which constructs the URL using the rendPkgUri. I've modified your patch accordingly (attached) but haven't tested it. Max

On 24 October 2011 09:53, Max Bolingbroke
On 24 October 2011 07:27, Bas van Dijk
wrote: I like the idea Max. Attached is the patch which implements it. There's only one issue: In doPackageRender I can't make the distinction between normal and candidate packages so I can't serve the correct logo url. So currently candidate logo's are broken. Do you have an idea to make them work again?
I see. It looks like doCandidateRender fixes up the result of doPackageRender by modifying the rendPkgUri. What this suggests to me is that we don't want to store the full logo URI but instead define a rendLogoUri :: PackageRender -> Maybe String which constructs the URL using the rendPkgUri.
I've modified your patch accordingly (attached) but haven't tested it.
Max
Thanks Max, it works on my site. Bas

Hi, Bas van Dijk wrote:
If a package has a logo.svg or logo.png file (all lower-case) in their package root then that logo is shown on the package page. SVG takes preference over PNG.
Wouldn't it be more in line with the rest of the cabal infrastructure to specify the logo file in the cabal file, similar to, e.g., the license file? Tillmann

On 24 October 2011 17:38, Tillmann Rendel
Wouldn't it be more in line with the rest of the cabal infrastructure to specify the logo file in the cabal file, similar to, e.g., the license file?
Yes it would be more in line. But apart from that, what advantage would it have? Bas

Hi, Bas van Dijk wrote:
Tillmann Rendel wrote:
Wouldn't it be more in line with the rest of the cabal infrastructure to specify the logo file in the cabal file, similar to, e.g., the license file?
Yes it would be more in line. But apart from that, what advantage would it have?
I see this generally about explicit configuration vs. naming conventions. Naming conventions are seemingly more modular: Old versions or unrelated components of the Cabal infrastructure and even third-party tools will automatically ignore the logo file. However, this modularity comes at a price: Different components or tools might disagree on the meaning of a naming convention. For different versions or components of the Cabal infrastructure, this can be avoided with some global namespace management for the naming convention. It can not be avoided, however, when third-party tools are involved. I think a Cabal package should be able to co-exist with another build or package system in the same directory. But if Cabal treats logo.png specially, and the other system treats logo.png specially in some other way, Cabal and the other system can no longer coexist. Downwards-compatibility is an instance of this effect. Naming conventions are both more downwards compatible (because old versions just ignore the logo file) and less downwards compatible (because new versions possible break old packages where logo.png is not meant to be a logo). Naming conventions can be more user-friendly, because the obvious thing just works, and no changes to the cabal file are necessary. However, explicit configuration can make it easier to discover features. For example, cabal-init could create "-- Logo-file: ..." in the cabal file, but it probably should not create a default logo file in the file system. (Or should it?). Naming conventions can be more or less efficient to implement. Consider the question: "Which packages have logo files?". With a naming convention, this question can be answered for a single package by checking the file system, without reading and parsing any files. But with explicit configuration, this can be answered for all of hackage by just looking at the index, without unpacking any package tarballs. I see many good reasons for both naming conventions and explicit configuration. I just wonder whether it is a good idea to switch from one to the other in the middle of Cabal's success story. Tillmann

On 25 October 2011 10:48, Tillmann Rendel
I see many good reasons for both naming conventions and explicit configuration. I just wonder whether it is a good idea to switch from one to the other in the middle of Cabal's success story.
I see your point. I just remembered I proposed this myself in the ticket about this: http://hackage.haskell.org/trac/hackage/ticket/619 So I'm fine with adding it to the cabal file. I may even do this myself but I'm a bit swamped at the moment. Any ideas about my second point in the ticket: "Should there be a restriction on the logo width and height? Maybe we need support for multiple sized logo's: a big one to put on the hackage page and a small one to display in package lists. (Maybe we even need support for favicons)" Currently the only restriction on the logo is that it should be either a .svg or .png (or both but svg is preferred). There aren't any restrictions on dimensions. However the logo is shown with a height of 200px. Bas
participants (3)
-
Bas van Dijk
-
Max Bolingbroke
-
Tillmann Rendel