@@ -58,6 +58,15 @@ PostgreSQL Extensions (%d ext in %d pkg) categorized into %d categories.
5858` , len (g .Cache .Extensions ), pkgCount , len (g .Cache .Categories )))
5959 }
6060
61+ b .WriteString (`
62+
63+ | {{< category "time" >}} | {{< category "gis" >}} | {{< category "rag" >}} | {{< category "fts" >}} | {{< category "olap" >}} | {{< category "feat" >}} | {{< category "lang" >}} | {{< category "type" >}} |
64+ |------------------------|-------------------------|--------------------------|-------------------------|-------------------------|-------------------------|-------------------------|-------------------------|
65+ | {{< category "util" >}} | {{< category "func" >}} | {{< category "admin" >}} | {{< category "stat" >}} | {{< category "sec" >}} | {{< category "fdw" >}} | {{< category "sim" >}} | {{< category "etl" >}} |
66+
67+
68+ ` )
69+
6170 // Generate sections for each category
6271 for _ , cat := range g .Cache .Categories {
6372 catKey := strings .ToUpper (cat .Name )
@@ -191,13 +200,12 @@ weight: 200
191200` )
192201 }
193202
194- // Navigation
195- var navItems []string
196- for _ , lc := range langs {
197- navItems = append (navItems , LanguageShortcode (lc .lang ))
198- }
199- b .WriteString (strings .Join (navItems , " " ))
200- b .WriteString ("\n \n " )
203+ b .WriteString (`
204+
205+ | {{< language "c" >}} | {{< language "c++" >}} | {{< language "rust" >}} | {{< language "java" >}} | {{< language "python" >}} | {{< language "sql" >}} | {{< language "data" >}} |
206+ |----------------------------|------------------------------|------------------------------|--------------------------------|--------------------------------|--------------------------------|-------------------------|
207+
208+ ` )
201209
202210 // Summary section
203211 if isZh {
@@ -338,6 +346,8 @@ description: "按开源许可证组织的 PostgreSQL 扩展"
338346weight: 300
339347---
340348
349+ 按照所使用开源许可证,对 PostgreSQL 扩展进行分类。
350+
341351` )
342352 } else {
343353 b .WriteString (`---
@@ -346,29 +356,19 @@ description: "PostgreSQL extensions organized by open source license"
346356weight: 300
347357---
348358
359+ PostgreSQL extension categorized by license.
360+
349361` )
350362 }
351363
352- // License badges
353- permissive , copyleft := g .categorizeLicenses (licenses )
364+ b .WriteString (`
354365
355- if len (permissive ) > 0 {
356- var badges []string
357- for _ , lic := range permissive {
358- badges = append (badges , LicenseShortcode (lic ))
359- }
360- b .WriteString (strings .Join (badges , " " ))
361- b .WriteString ("\n \n " )
362- }
366+ | {{< license "MIT" >}} | {{< license "ISC" >}} | {{< license "PostgreSQL" >}} | {{< license "BSD 0-Clause" >}} | {{< license "BSD 2-Clause" >}} | {{< license "BSD 3-Clause" >}} |
367+ |:---------------------------|:-----------------------------|:-----------------------------|:-------------------------------|:-------------------------------|:-------------------------------|
368+ | {{< license "Artistic" >}} | {{< license "Apache-2.0" >}} | {{< license "MPL-2.0" >}} | | | |
369+ | {{< license "GPL-2.0" >}} | {{< license "GPL-3.0" >}} | {{< license "LGPL-2.1" >}} | {{< license "LGPL-3.0" >}} | {{< license "AGPL-3.0" >}} | {{< license "Timescale" >}} |
363370
364- if len (copyleft ) > 0 {
365- var badges []string
366- for _ , lic := range copyleft {
367- badges = append (badges , LicenseShortcode (lic ))
368- }
369- b .WriteString (strings .Join (badges , " " ))
370- b .WriteString ("\n \n " )
371- }
371+ ` )
372372
373373 // Summary section
374374 if isZh {
@@ -411,15 +411,18 @@ func (g *ListGenerator) generateLicenseSection(license string, extensions []*Ext
411411 if isZh {
412412 countText = fmt .Sprintf ("%d 个扩展" , len (extensions ))
413413 }
414- b .WriteString (fmt .Sprintf ("%s %s\n \n " , LicenseShortcode (license ), Badge (countText , "gray" , "" , "" , "cube" )))
415-
416- // License info
417414 info := getLicenseInfo (license )
418415 refText := "License Text"
419416 if isZh {
420417 refText = "许可证文本"
421418 }
422- b .WriteString (fmt .Sprintf ("[%s %s](%s) : %s\n \n " , license , refText , info .URL , info .Description ))
419+ b .WriteString (fmt .Sprintf (`
420+
421+ | %s | %s |
422+ |:----|:---|
423+ | %s | %s |
424+
425+ ` , LicenseShortcode (license ), Badge (countText , "gray" , "" , "" , "cube" ), Badge (refText , "gray" , "" , info .URL , "scale" ), info .Description ))
423426
424427 // Table
425428 if isZh {
@@ -466,31 +469,6 @@ type licenseItem struct {
466469 order int
467470}
468471
469- func (g * ListGenerator ) categorizeLicenses (licenses []licenseItem ) ([]string , []string ) {
470- permissiveLicenses := []string {"MIT" , "ISC" , "PostgreSQL" , "BSD 0-Clause" , "BSD 2-Clause" ,
471- "BSD 3-Clause" , "Artistic" , "Apache-2.0" , "MPL-2.0" }
472- copyleftLicenses := []string {"GPL-2.0" , "GPL-3.0" , "LGPL-2.1" , "LGPL-3.0" , "AGPL-3.0" , "Timescale" }
473-
474- var permissive , copyleft []string
475-
476- for _ , lic := range licenses {
477- for _ , p := range permissiveLicenses {
478- if lic .name == p {
479- permissive = append (permissive , p )
480- break
481- }
482- }
483- for _ , c := range copyleftLicenses {
484- if lic .name == c {
485- copyleft = append (copyleft , c )
486- break
487- }
488- }
489- }
490-
491- return permissive , copyleft
492- }
493-
494472// Helper functions
495473func getLanguageDescriptions (isZh bool ) map [string ]string {
496474 if isZh {
@@ -523,21 +501,21 @@ type LicenseInfo struct {
523501
524502func getLicenseInfo (license string ) LicenseInfo {
525503 licenses := map [string ]LicenseInfo {
526- "PostgreSQL" : {"https://opensource.org/licenses/postgresql" , "Very liberal license based on the BSD license, allowing almost unlimited freedom." , 1 },
527- "Apache-2.0" : {"https://opensource.org/licenses/Apache-2.0" , "Permissive license with patent protection and attribution requirements." , 2 },
528- "MIT" : {"https://opensource.org/licenses/MIT" , "A permissive license that allows commercial use, modification, and private use." , 3 },
529- "BSD 3-Clause" : {"https://opensource.org/license/bsd-3-clause" , "Permissive license with attribution and endorsement restriction clauses." , 4 },
530- "BSD 2-Clause" : {"https://opensource.org/license/bsd-2-clause" , "Permissive license requiring attribution but allowing commercial use." , 5 },
531- "GPL-2.0" : {"https://opensource.org/licenses/GPL-2.0" , "Strong copyleft license requiring derivative works to be open source." , 6 },
532- "GPL-3.0" : {"https://opensource.org/licenses/GPL-3.0" , "Strong copyleft license with additional patent and hardware restrictions." , 7 },
533- "AGPL-3.0" : {"https://opensource.org/licenses/AGPL-3.0" , "Network copyleft license extending GPL to cover network-distributed software." , 8 },
534- "ISC" : {"https://opensource.org/licenses/ISC" , "A permissive license similar to MIT, allowing commercial use and modification." , 9 },
535- "Artistic" : {"https://opensource.org/license/artistic-2-0" , "Copyleft license allowing modification with certain distribution requirements." , 10 },
536- "Timescale" : {"https://www.timescale.com/legal/licenses" , "Proprietary license with restrictions on commercial use and distribution." , 11 },
537- "BSD 0-Clause" : {"https://opensource.org/license/0bsd" , "Public domain equivalent license with no restrictions on use." , 12 },
538- "LGPL-3.0" : {"https://opensource.org/licenses/LGPL-3.0" , "Weak copyleft license with additional patent and hardware provisions." , 13 },
539- "MPL-2.0" : {"https://opensource.org/licenses/MPL-2.0" , "Weak copyleft license allowing proprietary combinations with file-level copyleft." , 14 },
540- "LGPL-2.1" : {"https://opensource.org/licenses/LGPL-2.1" , "Weak copyleft license allowing proprietary applications to link dynamically." , 15 },
504+ "PostgreSQL" : {"https://opensource.org/licenses/postgresql" , "Very liberal license based on the BSD license, allowing almost unlimited freedom." , 1 },
505+ "Apache-2.0" : {"https://opensource.org/licenses/Apache-2.0" , "Permissive license with patent protection and attribution requirements." , 2 },
506+ "MIT" : {"https://opensource.org/licenses/MIT" , "A permissive license that allows commercial use, modification, and private use." , 3 },
507+ "BSD 3-Clause" : {"https://opensource.org/license/bsd-3-clause" , "Permissive license with attribution and endorsement restriction clauses." , 4 },
508+ "BSD 2-Clause" : {"https://opensource.org/license/bsd-2-clause" , "Permissive license requiring attribution but allowing commercial use." , 5 },
509+ "GPL-2.0" : {"https://opensource.org/licenses/GPL-2.0" , "Strong copyleft license requiring derivative works to be open source." , 6 },
510+ "GPL-3.0" : {"https://opensource.org/licenses/GPL-3.0" , "Strong copyleft license with additional patent and hardware restrictions." , 7 },
511+ "AGPL-3.0" : {"https://opensource.org/licenses/AGPL-3.0" , "Network copyleft license extending GPL to cover network-distributed software." , 8 },
512+ "ISC" : {"https://opensource.org/licenses/ISC" , "A permissive license similar to MIT, allowing commercial use and modification." , 9 },
513+ "Artistic" : {"https://opensource.org/license/artistic-2-0" , "Copyleft license allowing modification with certain distribution requirements." , 10 },
514+ "Timescale" : {"https://www.timescale.com/legal/licenses" , "Proprietary license with restrictions on commercial use and distribution." , 11 },
515+ "BSD 0-Clause" : {"https://opensource.org/license/0bsd" , "Public domain equivalent license with no restrictions on use." , 12 },
516+ "LGPL-3.0" : {"https://opensource.org/licenses/LGPL-3.0" , "Weak copyleft license with additional patent and hardware provisions." , 13 },
517+ "MPL-2.0" : {"https://opensource.org/licenses/MPL-2.0" , "Weak copyleft license allowing proprietary combinations with file-level copyleft." , 14 },
518+ "LGPL-2.1" : {"https://opensource.org/licenses/LGPL-2.1" , "Weak copyleft license allowing proprietary applications to link dynamically." , 15 },
541519 }
542520
543521 if info , ok := licenses [license ]; ok {
@@ -549,4 +527,4 @@ func getLicenseInfo(license string) LicenseInfo {
549527func getLicenseOrder (license string ) int {
550528 info := getLicenseInfo (license )
551529 return info .Order
552- }
530+ }
0 commit comments