{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1745906890,
"reponame":"cgit",
"desc":"CGI gitweb",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/cgit",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"706f21131be39b0c025f50813a0d541f",
"commit": {"type":"commit",
"time": 1530592110,
"time_ofs": 480,
"oid_tree": { "oid": "9bcebb07bd872f344c84750c8fab182fdb2e1ad6", "alias": []},
"oid":{ "oid": "ca52cfba4e491375f3615aa620add98f4156ae3e", "alias": [ "refs/heads/clientside"]},
"msg": "client-side: add JS to handle client side rendering",
"sig_commit": { "git_time": { "time": 1530592110, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },
"sig_author": { "git_time": { "time": 1530499757, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }},
"body": "client-side: add JS to handle client side rendering\n\nThis adds support for highlight.js\n\nhttps://highlightjs.org/\n\nand showdown\n\nhttps://github.com/showdownjs/showdown\n\nintegration on the client side, along with line-number\nlink generation on the client side, so the server doesn't\nhave to create and send the elaborated links (sometimes\nthousands of them) itself for /tree/ view.\n\nSigned-off-by: Andy Green \u003candy@warmcat.com\u003e"
,
"diff": "diff --git a/cgit.js b/cgit.js\nindex d89fdf7..5436dd8 100644\n--- a/cgit.js\n+++ b/cgit.js\n@@ -401,19 +401,109 @@ function aging()\n \twindow.setTimeout(aging, next * 1000);\n }\n \n+var plain_pre, plain_post;\n+\n+var sd_ext_plain \u003d function () {\n+ var myext1 \u003d {\n+ type: 'output',\n+ regex: '\u003cimg\u005c src\u003d\u005c\u0022\u005c./([^\u005c\u0022]*)',\n+ replace: '\u003cimg\u005c src\u003d\u005c\u0022' + plain_pre + '$1' + plain_post\n+ };\n+ var myext2 \u003d {\n+ type: 'output',\n+ regex: '\u003cimg\u005c src\u003d\u005c\u0022(?!http:\u005c/\u005c/|https:\u005c/\u005c/|\u005c/)([^\u005c\u0022]*)',\n+ replace: '\u003cimg\u005c src\u003d\u005c\u0022' + plain_pre + '$1' + plain_post\n+ };\n+ return [myext1, myext2];\n+}\n \n /* we have to use load, because header images can push the layout vertically */\n window.addEventListener(\u0022load\u0022, function() {\n+\tvar rs \u003d document.getElementById(\u0022render-source\u0022), md \u003d 0;\n+\n+\tif (rs) {\n+\t\tvar name \u003d rs.getAttribute(\u0022render-filename\u0022);\n+\n+\t\tif (name.substring(name.length - 3) \u003d\u003d \u0022.md\u0022)\n+\t\t\tmd \u003d 1;\n+\t}\n+\n+\tif (md) {\n+\t\tplain_pre \u003d rs.getAttribute(\u0022plain-pre\u0022);\n+\t\tplain_post \u003d rs.getAttribute(\u0022plain-post\u0022);\n+\n+\t\tshowdown.extension('sd_ext_plain', sd_ext_plain);\n+\n+\t\tvar conv \u003d new showdown.Converter({extensions: ['sd_ext_plain']});\n+\n+\t\tconv.setOption('tables', '1');\n+\t\tconv.setFlavor('github');\n+\n+\t\trs.innerHTML \u003d conv.makeHtml(rs.textContent);\n+\n+\t} else\n+\n+\t\t/* client side highlight processing */\n+\n+\t\tif (typeof hljs !\u003d\u003d \u0022undefined\u0022) {\n+\t\t\thljs.initHighlighting();\n+\n+\t\t\tvar e \u003d document.getElementById(\u0022linenumbers\u0022),\n+\t\t\th \u003d document.getElementsByClassName(\u0022hashes\u0022),\n+\t\t\tl \u003d document.getElementsByClassName(\u0022lines\u0022),\n+\t\t\tls \u003d document.getElementsByClassName(\u0022hljs\u0022);\n+\n+\t\t\t/*\n+\t\t\t* we need to apply any vertical offset from there\n+\t\t\t* highlight css on the \u0022lines\u0022 td content also to the\n+\t\t\t* \u0022hashes\u0022 and \u0022linenumbers\u0022 tds.\n+\t\t\t*/\n+\n+\t\t\tif (ls[0] \u0026\u0026 l[0] \u0026\u0026 e) {\n+\t\t\t\tvar top \u003d window.getComputedStyle(ls[0], null).\n+\t\t\t\t\t\tgetPropertyValue(\u0022padding-top\u0022);\n+\n+\t\t\t\te.style.paddingTop \u003d top;\n+\n+\t\t\t\tif (h[0]) {\n+\t\t\t\t\th[0].style.paddingTop \u003d top;\n+\n+\t\t\t\t\tvar d \u003d l[0].firstChild.firstChild;\n+\n+\t\t\t\t\tif (d) {\n+\t\t\t\t\t\td.style.paddingTop \u003d top;\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\n \tline_range_highlight(1);\n }, false);\n \n document.addEventListener(\u0022DOMContentLoaded\u0022, function() {\n-\t/* event listener cannot override default #URL browser processing,\n-\t * requires onclick */\n-\tvar e \u003d document.getElementById(\u0022linenumbers\u0022);\n-\tif (e)\n+\t/*\n+\t * event listener cannot override default #URL browser processing,\n+\t * requires onclick\n+\t */\n+\tvar e \u003d document.getElementById(\u0022linenumbers\u0022), count, n \u003d 1;\n+\tif (e) {\n \t\te.onclick \u003d line_range_click;\n \n+\t\tcount \u003d parseInt(e.getAttribute(\u0022count\u0022));\n+\n+\t\tif (count) { /* it's zero if the linenumbers done on server */\n+\t\t\tvar pre \u003d e.firstChild;\n+\n+\t\t\twhile (n \u003c\u003d count) {\n+\t\t\t\tvar lin \u003d document.createElement(\u0022a\u0022);\n+\t\t\t\tlin.id \u003d \u0022n\u0022 + n;\n+\t\t\t\tlin.href \u003d \u0022#n\u0022 + n;\n+\t\t\t\tlin.textContent \u003d (n++) + \u0022\u005cn\u0022;\n+\t\t\t\tpre.appendChild(lin);\n+\t\t\t}\n+\t\t}\n+\t}\n+\n \t/* we can do the aging on DOM content load since no layout dependency */\n \taging();\n }, false);\ndiff --git a/cgitrc.5.txt b/cgitrc.5.txt\nindex 5b1140b..e1a85d7 100644\n--- a/cgitrc.5.txt\n+++ b/cgitrc.5.txt\n@@ -810,8 +810,10 @@ Conversely, when a ttl value is zero, the cache is disabled for that\n particular page type, and the page type is never cached.\n \n \n-EXAMPLE CGITRC FILE\n--------------------\n+EXAMPLE CGITRC FILE (Server render)\n+-----------------------------------\n+\n+See after for example using client render\n \n ....\n # Enable caching of up to 1000 output entries\n@@ -999,6 +1001,47 @@ repo.enable-log-linecount\u003d0\n repo.max-stats\u003dmonth\n ....\n \n+EXAMPLE CGITRC FILE (Client render)\n+-----------------------------------\n+\n+For client render, you must serve some extra JS and\n+CSS from other projects, eg\n+\n+https://highlightjs.org/\n+https://github.com/showdownjs/showdown\n+\n+The example shows the files served from virtual URL\n+/git/cgit-data/\n+\n+....\n+virtual-root\u003d/git/\n+\n+# enable clientside rendering\n+clientside\u003d1\n+css\u003d/git/cgit-data/cgit.css\n+css\u003d/git/cgit-data/styles/github.css\n+js\u003d/git/cgit-data/cgit.js\n+js\u003d/git/cgit-data/highlight.pack.js\n+js\u003d/git/cgit-data/showdown.min.js\n+\n+# if *.md exists in the tree view, show it inline\n+inline-readme\u003d*.md\n+\n+mimetype.git\u003dimage/git\n+mimetype.html\u003dtext/html\n+mimetype.jpg\u003dimage/jpeg\n+mimetype.jpeg\u003dimage/jpeg\n+mimetype.pdf\u003dapplication/pdf\n+mimetype.png\u003dimage/png\n+mimetype.svg\u003dimage/svg+xml\n+\n+# then the repos as usual\n+\n+repo.url\u003dgit\n+repo.path\u003d/pub/git/git.git\n+repo.desc\u003dthe dscm\n+....\n+\n \n BUGS\n ----\n","s":{"c":1745623564,"u": 2216}}
],"g": 1154,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "7d0a"}