From d5fdfbf7a9d2de99b49130b26ef5c859d794984a Mon Sep 17 00:00:00 2001 From: Leorize Date: Mon, 24 Jan 2022 16:18:52 -0600 Subject: [PATCH] remove website generation code The pieces being removed are: - `koch`'s "web" doc generation, which has the following differences to "regular" docs: - Docs meant for publishing have Google Analytics (GA) enabled. - `nimblepkglist` was bundled to enable the display of the nimble catalogue in "Standard library" page. This feature is no longer used, even on Nim's published docs, since it is fairly slow and was not updated for the new docs layout. Alternative providers like https://nimble.directory have completely superseded it. - Google Analytics script injection in docgen: The script is injected whenever `--doc.googleAnalytics:` is passed to `nim doc`. - `nimweb`: A tool that appears to be used to generate the first generation of the Nim's website. Needless to say, it's pretty abandoned given the Jekyll-based version: https://github.com/nim-lang/website. We have no use for any of these, so shake them off to reduce code size. An added benefit is that koch docs is slightly faster as we are no longer generating the same documentation twice. --- compiler/tools/docgen.nim | 22 +- config/nimdoc.cfg | 2 - doc/docgen.rst | 7 - doc/koch.rst | 15 - nimdoc/rst2html/expected/rst_examples.html | 1 - .../expected/index.html | 1 - .../expected/theindex.html | 1 - .../expected/subdir/subdir_b/utils.html | 1 - nimdoc/testproject/expected/testproject.html | 1 - nimdoc/testproject/expected/theindex.html | 1 - tools/koch/koch.nim | 27 +- tools/koch/kochdocs.nim | 22 +- tools/nimblepkglist.nim | 80 --- tools/nimweb.nim | 556 ------------------ tools/website.nimf | 266 --------- 15 files changed, 5 insertions(+), 998 deletions(-) delete mode 100644 tools/nimblepkglist.nim delete mode 100644 tools/nimweb.nim delete mode 100644 tools/website.nimf diff --git a/compiler/tools/docgen.nim b/compiler/tools/docgen.nim index e6e4679402f..c50c03bd3ed 100644 --- a/compiler/tools/docgen.nim +++ b/compiler/tools/docgen.nim @@ -113,7 +113,6 @@ type # in `doc.section.toc2` toc: TocSectionsFinal # final TOC (wrapped in `doc.section.toc`) indexValFilename: string - analytics: string # Google Analytics javascript, "" if doesn't exist seenSymbols: StringTableRef # avoids duplicate symbol generation for HTML. jEntriesPre: seq[JsonItem] # pre-processed RST + JSON content jEntriesFinal: JsonNode # final JSON after RST pass 2 and rendering @@ -315,22 +314,6 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef, conf.configVars, filename.string, docgenFindFile, compilerMsgHandler) - if conf.configVars.hasKey("doc.googleAnalytics"): - result.analytics = """ - - """ % [conf.configVars.getOrDefault"doc.googleAnalytics"] - else: - result.analytics = "" - result.seenSymbols = newStringTable(modeCaseInsensitive) result.id = 100 result.jEntriesFinal = newJArray() @@ -1458,7 +1441,7 @@ proc genOutFile(d: PDoc, groupedToc = false): string = "title", title, "subtitle", subtitle, "tableofcontents", toc, "moduledesc", d.modDescFinal, "date", getDateStr(), "time", getClockStr(), "content", content, "author", d.meta[metaAuthor], - "version", esc(d.target, d.meta[metaVersion]), "analytics", d.analytics, + "version", esc(d.target, d.meta[metaVersion]), "deprecationMsg", d.modDeprecationMsg] else: code = content @@ -1627,8 +1610,7 @@ proc commandBuildIndex*(conf: ConfigRef, dir: string, outFile = RelativeFile"") "title", "Index", "subtitle", "", "tableofcontents", "", "moduledesc", "", "date", getDateStr(), "time", getClockStr(), - "content", content, "author", "", "version", "", "analytics", ""] - # no analytics because context is not available + "content", content, "author", "", "version", ""] try: writeFile(filename, code) diff --git a/config/nimdoc.cfg b/config/nimdoc.cfg index 58f11d911ac..8232dd2fd25 100644 --- a/config/nimdoc.cfg +++ b/config/nimdoc.cfg @@ -207,7 +207,6 @@ $content doc.listing_start = "" doc.listing_end = "" -# * $analytics: Google analytics location, includes -# end if -# if c.gaId.len != 0: - -# end if - - -#end proc -# -# -#proc generateSponsors(sponsors: seq[Sponsor]): string = -#result = "" -#for sponsor in sponsors: -
- #if sponsor.url.len > 0: - ${sponsor.name} - #else: - ${sponsor.name} - #end if -
- -
- Donated $$${sponsor.thisMonth} this month -
-
- Donated $$${sponsor.allTime} in total since ${sponsor.since} -
-#end for -#end proc -#proc generateSponsorsPage(activeSponsors, inactiveSponsors: seq[Sponsor]): string = -#result = "" -

Our Current Sponsors

-

This section lists the companies and individuals that are, very kindly, contributing a -monthly amount to help sustain Nim's development. For more details take a -look at the Bountysource campaign.

-

Last updated: ${getTime().utc().format("dd/MM/yyyy")}

-
-${generateSponsors(activeSponsors)} -
-# -

Our Past Sponsors

-

This section lists the companies and individuals that have contributed -money in the past to help sustain Nim's development. For more details take a -look at the Bountysource campaign.

-
-${generateSponsors(inactiveSponsors)} -
-# -#end proc