# HG changeset patch # User Chris Eldredge # Date 1344551832 14400 # Node ID a1ca051886bde31c35fa5b484185d8f9d8708321 # Parent 299ff954bfa862c4d9c5516cc0451ff8dc2230f2 Move info to ReadMe.markdown. Tweak theme. diff -r 299ff954bfa8 -r a1ca051886bd ReadMe.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ReadMe.markdown Thu Aug 09 18:37:12 2012 -0400 @@ -0,0 +1,38 @@ +Markdown Extension for hgweb +============================ + +Similar to GitHub, this module looks for a file named ReadMe.md or +ReadMe.markdown (case insensitive) in the "default" revision. + +A custom theme is provided that displays the formatted contents on the summary (index) view. + +In addition to showing formatted information on the summary view, this module enables any +other markdown content to be rendered using the url pattern `/repo/markdown/changeid/WikiPage.md`. + +##Install## + +1. Install Python-Markdown (http://packages.python.org/Markdown/install.html) +1. Clone this repository to /example/hgext.markdown +1. Add the following to your hgweb config + +config: + + [web] + templates = /example/hgext.markdown + style = markdown + + [extensions] + hgext.markdown=/example/hgext.markdown + + +##Usage with TortoiseHg## + +If you want to use this extension with TortoiseHg, you will need to +obtain the python markdown package (http://packages.python.org/Markdown/) +and uncomment the section in [\_\_init\_\_.py](\_\_init\_\_.py) that adjusts the python module path. + +##Preview## + +You can preview changes before committing them by browsing to `/repo/markdown/_preview/ReadMe.markdown`. +The `_preview` keyword makes this extension look for content in the working copy. + diff -r 299ff954bfa8 -r a1ca051886bd __init__.py --- a/__init__.py Thu Aug 09 18:05:09 2012 -0400 +++ b/__init__.py Thu Aug 09 18:37:12 2012 -0400 @@ -1,30 +1,3 @@ -''' -Markdown Extension for hgweb -============================ - -Similar to GitHub, this module looks for a file named ReadMe.md or -ReadMe.markdown (case insensitive) in the "default" revision. - -A custom theme is provided that displays the formatted contents on the summary (index) view. - -Configuration: - - * Clone this repository to /example/hgext.markdown - * Add the following to your hgweb config: - [web] - templates = /example/hgext.markdown - style = markdown - - [extensions] - hgext.markdown=/example/hgext.markdown - -Usage with TortoiseHg - - If you want to use this extension with TortoiseHg, you will need to - obtain the python markdown package (http://packages.python.org/Markdown/) - and uncomment the section below that adjusts the python module path. -''' - import os import sys import markdown @@ -75,9 +48,9 @@ return tmpl("markdown", **args) def summary_markdown(orig, web, req, tmpl): - readmefile = find_working_copy_readme(web.repo) changeid = 'default' # todo: add hgrc config setting previewMode = False + text = None cctx = web.repo[changeid] changeid = cctx.hex()[0:12] @@ -88,9 +61,8 @@ readmefile = filename break - ext = os.path.splitext(readmefile)[1] - if text: + ext = os.path.splitext(readmefile)[1] base_url = tmpl.defaults['url'] + 'markdown/' + changeid + "/" md = markdown.Markdown( extensions=['urlrebase', 'wikilinks'], @@ -98,8 +70,12 @@ 'urlrebase' : [('base_url', base_url)], 'wikilinks' : [('base_url', base_url), ('end_url', ext)]}) readme = md.convert(text) - tmpl.defaults['readmefilename'] = readmefile - tmpl.defaults['readme'] = readme + else: + readmefile = "ReadMe" + readme = "Add ReadMe.md or ReadMe.markdown to this repository to display it here." + + tmpl.defaults['readmefilename'] = readmefile + tmpl.defaults['readme'] = readme return orig(web, req, tmpl) diff -r 299ff954bfa8 -r a1ca051886bd templates/markdown/footer.tmpl --- a/templates/markdown/footer.tmpl Thu Aug 09 18:05:09 2012 -0400 +++ b/templates/markdown/footer.tmpl Thu Aug 09 18:37:12 2012 -0400 @@ -1,10 +1,5 @@ - - -

Changes

- -{shortlog} - - - -
...
- -

Tags

- -{tags} - - - -
...
- -

Bookmarks

- - {bookmarks%bookmarkentry} - - - -
...
- - - - {branches%branchentry} - - - -
...
{footer} diff -r 299ff954bfa8 -r a1ca051886bd templates/static/markdown.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/static/markdown.css Thu Aug 09 18:37:12 2012 -0400 @@ -0,0 +1,506 @@ +/*** Initial Settings ***/ +* { + margin: 0; + padding: 0; + font-weight: normal; + font-style: normal; +} + +html { + font-size: 100%; + font-family: sans-serif; +} + +body { + margin: 15px 50px; + background: #4B4B4C; +} + +a { + color:#0000cc; + text-decoration: none; +} +/*** end of Initial Settings ***/ + + +/** common settings **/ +div#container { + background: #FFFFFF; + position: relative; + color: #666; + padding-bottom: 25px; +} + +div.page-header { + padding: 50px 20px 0; + background: #006699 top left repeat-x; + position: relative; +} + div.page-header h1, div.page-header h2 { + margin: 10px 0 30px; + color: #DDD; + background-color: inherit; + border: 0; + } + div.page-header h1 a { + color: #FFF; + } + div.page-header a { + text-decoration: none; + } + + div.page-header form { + position: absolute; + margin-bottom: 2px; + bottom: 0; + right: 20px; + } + div.page-header form label { + color: #DDD; + } + div.page-header form input { + padding: 2px; + border: solid 1px #DDD; + } + div.page-header form dl { + overflow: hidden; + } + div.page-header form dl dt { + font-size: 1.2em; + } + div.page-header form dl dt, + div.page-header form dl dd { + margin: 0 0 0 5px; + float: left; + height: 24px; + line-height: 20px; + } + + ul.page-nav { + margin: 10px 0 0 0; + list-style-type: none; + overflow: hidden; + width: 900px; + } + ul.page-nav li { + margin: 0 2px 0 0; + float: left; + width: 80px; + height: 24px; + font-size: 1.1em; + line-height: 24px; + text-align: center; + } + ul.page-nav li.current { + background: #FFF; + } + ul.page-nav li a { + height: 24px; + color: #666; + background: #DDD; + display: block; + text-decoration: none; + } + ul.page-nav li a:hover { + color:#333; + background: #FFF; + } + +ul.submenu { + margin: 10px 0 -10px 20px; + list-style-type: none; +} +ul.submenu li { + margin: 0 10px 0 0; + font-size: 1.2em; + display: inline; +} + +h2 { + margin: 20px 0 10px; + height: 30px; + line-height: 30px; + text-indent: 20px; + background: #FFF; + font-size: 1.2em; + border-top: dotted 1px #D5E1E6; + font-weight: bold; +} +h2.no-link { + color:#006699; +} +h2.no-border { + color: #FFF; + background: #006699; + border: 0; +} +h2 a { + font-weight:bold; + color:#006699; +} + +div.page-path { + text-align: right; + padding: 20px 30px 10px 0; + border:solid #d9d8d1; + border-width:0px 0px 1px; + font-size: 1.2em; +} + +div.page-footer { + margin: 50px 0 0; + position: relative; +} + div.page-footer p { + position: relative; + left: 20px; + bottom: 5px; + font-size: 1.2em; + } + + ul.rss-logo { + position: absolute; + top: -10px; + right: 20px; + height: 20px; + list-style-type: none; + } + ul.rss-logo li { + display: inline; + } + ul.rss-logo li a { + padding: 3px 6px; + line-height: 10px; + border:1px solid; + border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; + color:#ffffff; + background-color:#ff6600; + font-weight:bold; + font-family:sans-serif; + font-size:10px; + text-align:center; + text-decoration:none; + } + div.rss-logo li a:hover { + background-color:#ee5500; + } + +p.normal { + margin: 20px 0 20px 30px; + font-size: 1.2em; +} + +table { + margin: 10px 0 0 20px; + width: 95%; + border-collapse: collapse; +} +table tr td { + font-size: 1.1em; +} +table tr td.nowrap { + white-space: nowrap; +} +table tr td.closed { + background-color: #99f; +} +/* +table tr.parity0:hover, +table tr.parity1:hover { + background: #D5E1E6; +} +*/ +table tr.parity0 { + background: #F1F6F7; +} +table tr.parity1 { + background: #FFFFFF; +} +table tr td { + padding: 5px 5px; +} +table.annotated tr td { + padding: 0px 5px; +} + +span.logtags span { + padding: 2px 6px; + font-weight: normal; + font-size: 11px; + border: 1px solid; + background-color: #ffaaff; + border-color: #ffccff #ff00ee #ff00ee #ffccff; +} +span.logtags span.tagtag { + background-color: #ffffaa; + border-color: #ffffcc #ffee00 #ffee00 #ffffcc; +} +span.logtags span.branchtag { + background-color: #aaffaa; + border-color: #ccffcc #00cc33 #00cc33 #ccffcc; +} +span.logtags span.inbranchtag { + background-color: #d5dde6; + border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4; +} +span.logtags span.bookmarktag { + background-color: #afdffa; + border-color: #ccecff #46ace6 #46ace6 #ccecff; +} + +div.diff pre { + margin: 10px 0 0 0; +} +div.diff pre span { + font-family: monospace; + white-space: pre; + font-size: 1.2em; + padding: 3px 0; +} +td.source { + white-space: pre; + font-family: monospace; + margin: 10px 30px 0; + font-size: 1.2em; + font-family: monospace; +} + div.source div.parity0, + div.source div.parity1 { + padding: 1px; + font-size: 1.2em; + } + div.source div.parity0 { + background: #F1F6F7; + } + div.source div.parity1 { + background: #FFFFFF; + } +div.parity0:hover, +div.parity1:hover { + background: #D5E1E6; +} +.linenr { + color: #999; + text-align: right; +} +.lineno { + text-align: right; +} +.lineno a { + color: #999; +} +td.linenr { + width: 60px; +} + +div#powered-by { + position: absolute; + width: 75px; + top: 15px; + right: 20px; + font-size: 1.2em; +} +div#powered-by a { + color: #EEE; + text-decoration: none; +} +div#powered-by a:hover { + text-decoration: underline; +} +/* +div#monoblue-corner-top-left { + position: absolute; + top: 0; + left: 0; + width: 10px; + height: 10px; + background: url(./monoblue-corner.png) top left no-repeat !important; + background: none; +} +div#monoblue-corner-top-right { + position: absolute; + top: 0; + right: 0; + width: 10px; + height: 10px; + background: url(./monoblue-corner.png) top right no-repeat !important; + background: none; +} +div#monoblue-corner-bottom-left { + position: absolute; + bottom: 0; + left: 0; + width: 10px; + height: 10px; + background: url(./monoblue-corner.png) bottom left no-repeat !important; + background: none; +} +div#monoblue-corner-bottom-right { + position: absolute; + bottom: 0; + right: 0; + width: 10px; + height: 10px; + background: url(./monoblue-corner.png) bottom right no-repeat !important; + background: none; +} +*/ +/** end of common settings **/ + +/** summary **/ +dl.overview { + margin: 0 0 0 30px; + font-size: 1.1em; + overflow: hidden; +} + dl.overview dt, + dl.overview dd { + margin: 5px 0; + float: left; + } + dl.overview dt { + clear: left; + font-weight: bold; + width: 150px; + } +/** end of summary **/ + +/** chagelog **/ +h3.changelog { + margin: 20px 0 5px 30px; + padding: 0 0 2px; + font-size: 1.4em; + border-bottom: dotted 1px #D5E1E6; +} +ul.changelog-entry { + margin: 0 0 10px 30px; + list-style-type: none; + position: relative; +} +ul.changelog-entry li span.revdate { + font-size: 1.1em; +} +ul.changelog-entry li.age { + position: absolute; + top: -25px; + right: 10px; + font-size: 1.4em; + color: #CCC; + font-weight: bold; + font-style: italic; +} +ul.changelog-entry li span.name { + font-size: 1.2em; + font-weight: bold; +} +ul.changelog-entry li.description { + margin: 10px 0 0; + font-size: 1.1em; +} +/** end of changelog **/ + +/** file **/ +p.files { + margin: 0 0 0 20px; + font-size: 2.0em; + font-weight: bold; +} +/** end of file **/ + +/** changeset **/ +h3.changeset { + margin: 20px 0 5px 20px; + padding: 0 0 2px; + font-size: 1.6em; + border-bottom: dotted 1px #D5E1E6; +} +p.changeset-age { + position: relative; +} +p.changeset-age span { + position: absolute; + top: -25px; + right: 10px; + font-size: 1.4em; + color: #CCC; + font-weight: bold; + font-style: italic; +} +p.description { + margin: 10px 30px 0 30px; + padding: 10px; + border: solid 1px #CCC; + font-size: 1.2em; +} +/** end of changeset **/ + +/** canvas **/ +div#wrapper { + position: relative; + font-size: 1.2em; +} + +canvas { + position: absolute; + z-index: 5; + top: -0.7em; +} + +ul#nodebgs li.parity0 { + background: #F1F6F7; +} + +ul#nodebgs li.parity1 { + background: #FFFFFF; +} + +ul#graphnodes { + position: absolute; + z-index: 10; + top: 7px; + list-style: none inside none; +} + +ul#nodebgs { + list-style: none inside none; +} + +ul#graphnodes li, ul#nodebgs li { + height: 39px; +} + +ul#graphnodes li .info { + display: block; + position: relative; +} +/** end of canvas **/ + +div#readme { + max-width: 920px; + border: 3px solid #ccc; + border-radius: 3px; + margin: 25px; +} + +div#readme article { + padding: 25px; +} + +#readme h1, #readme h2 { + border: 0; + margin: 0; + padding: 0; + text-indent: 0; + line-height: 1; +} + +h2#readmefilename { + background-color: #ccc; + padding: 10px; +} + +#readmefooter { + margin-top: 25px; + margin-left: 25px; + color: #aaa; +} \ No newline at end of file diff -r 299ff954bfa8 -r a1ca051886bd templates/static/style-monoblue.css --- a/templates/static/style-monoblue.css Thu Aug 09 18:05:09 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,506 +0,0 @@ -/*** Initial Settings ***/ -* { - margin: 0; - padding: 0; - font-weight: normal; - font-style: normal; -} - -html { - font-size: 100%; - font-family: sans-serif; -} - -body { - margin: 15px 50px; - background: #4B4B4C; -} - -a { - color:#0000cc; - text-decoration: none; -} -/*** end of Initial Settings ***/ - - -/** common settings **/ -div#container { - background: #FFFFFF; - position: relative; - color: #666; -} - -div.page-header { - padding: 50px 20px 0; - background: #006699 top left repeat-x; - position: relative; -} - div.page-header h1, div.page-header h2 { - margin: 10px 0 30px; - color: #DDD; - background-color: inherit; - border: 0; - } - div.page-header h1 a { - color: #FFF; - } - div.page-header a { - text-decoration: none; - } - - div.page-header form { - position: absolute; - margin-bottom: 2px; - bottom: 0; - right: 20px; - } - div.page-header form label { - color: #DDD; - } - div.page-header form input { - padding: 2px; - border: solid 1px #DDD; - } - div.page-header form dl { - overflow: hidden; - } - div.page-header form dl dt { - font-size: 1.2em; - } - div.page-header form dl dt, - div.page-header form dl dd { - margin: 0 0 0 5px; - float: left; - height: 24px; - line-height: 20px; - } - - ul.page-nav { - margin: 10px 0 0 0; - list-style-type: none; - overflow: hidden; - width: 900px; - } - ul.page-nav li { - margin: 0 2px 0 0; - float: left; - width: 80px; - height: 24px; - font-size: 1.1em; - line-height: 24px; - text-align: center; - } - ul.page-nav li.current { - background: #FFF; - } - ul.page-nav li a { - height: 24px; - color: #666; - background: #DDD; - display: block; - text-decoration: none; - } - ul.page-nav li a:hover { - color:#333; - background: #FFF; - } - -ul.submenu { - margin: 10px 0 -10px 20px; - list-style-type: none; -} -ul.submenu li { - margin: 0 10px 0 0; - font-size: 1.2em; - display: inline; -} - -h2 { - margin: 20px 0 10px; - height: 30px; - line-height: 30px; - text-indent: 20px; - background: #FFF; - font-size: 1.2em; - border-top: dotted 1px #D5E1E6; - font-weight: bold; -} -h2.no-link { - color:#006699; -} -h2.no-border { - color: #FFF; - background: #006699; - border: 0; -} -h2 a { - font-weight:bold; - color:#006699; -} - -div.page-path { - text-align: right; - padding: 20px 30px 10px 0; - border:solid #d9d8d1; - border-width:0px 0px 1px; - font-size: 1.2em; -} - -div.page-footer { - margin: 50px 0 0; - position: relative; -} - div.page-footer p { - position: relative; - left: 20px; - bottom: 5px; - font-size: 1.2em; - } - - ul.rss-logo { - position: absolute; - top: -10px; - right: 20px; - height: 20px; - list-style-type: none; - } - ul.rss-logo li { - display: inline; - } - ul.rss-logo li a { - padding: 3px 6px; - line-height: 10px; - border:1px solid; - border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; - color:#ffffff; - background-color:#ff6600; - font-weight:bold; - font-family:sans-serif; - font-size:10px; - text-align:center; - text-decoration:none; - } - div.rss-logo li a:hover { - background-color:#ee5500; - } - -p.normal { - margin: 20px 0 20px 30px; - font-size: 1.2em; -} - -table { - margin: 10px 0 0 20px; - width: 95%; - border-collapse: collapse; -} -table tr td { - font-size: 1.1em; -} -table tr td.nowrap { - white-space: nowrap; -} -table tr td.closed { - background-color: #99f; -} -/* -table tr.parity0:hover, -table tr.parity1:hover { - background: #D5E1E6; -} -*/ -table tr.parity0 { - background: #F1F6F7; -} -table tr.parity1 { - background: #FFFFFF; -} -table tr td { - padding: 5px 5px; -} -table.annotated tr td { - padding: 0px 5px; -} - -span.logtags span { - padding: 2px 6px; - font-weight: normal; - font-size: 11px; - border: 1px solid; - background-color: #ffaaff; - border-color: #ffccff #ff00ee #ff00ee #ffccff; -} -span.logtags span.tagtag { - background-color: #ffffaa; - border-color: #ffffcc #ffee00 #ffee00 #ffffcc; -} -span.logtags span.branchtag { - background-color: #aaffaa; - border-color: #ccffcc #00cc33 #00cc33 #ccffcc; -} -span.logtags span.inbranchtag { - background-color: #d5dde6; - border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4; -} -span.logtags span.bookmarktag { - background-color: #afdffa; - border-color: #ccecff #46ace6 #46ace6 #ccecff; -} - -div.diff pre { - margin: 10px 0 0 0; -} -div.diff pre span { - font-family: monospace; - white-space: pre; - font-size: 1.2em; - padding: 3px 0; -} -td.source { - white-space: pre; - font-family: monospace; - margin: 10px 30px 0; - font-size: 1.2em; - font-family: monospace; -} - div.source div.parity0, - div.source div.parity1 { - padding: 1px; - font-size: 1.2em; - } - div.source div.parity0 { - background: #F1F6F7; - } - div.source div.parity1 { - background: #FFFFFF; - } -div.parity0:hover, -div.parity1:hover { - background: #D5E1E6; -} -.linenr { - color: #999; - text-align: right; -} -.lineno { - text-align: right; -} -.lineno a { - color: #999; -} -td.linenr { - width: 60px; -} - -div#powered-by { - position: absolute; - width: 75px; - top: 15px; - right: 20px; - font-size: 1.2em; -} -div#powered-by a { - color: #EEE; - text-decoration: none; -} -div#powered-by a:hover { - text-decoration: underline; -} -/* -div#monoblue-corner-top-left { - position: absolute; - top: 0; - left: 0; - width: 10px; - height: 10px; - background: url(./monoblue-corner.png) top left no-repeat !important; - background: none; -} -div#monoblue-corner-top-right { - position: absolute; - top: 0; - right: 0; - width: 10px; - height: 10px; - background: url(./monoblue-corner.png) top right no-repeat !important; - background: none; -} -div#monoblue-corner-bottom-left { - position: absolute; - bottom: 0; - left: 0; - width: 10px; - height: 10px; - background: url(./monoblue-corner.png) bottom left no-repeat !important; - background: none; -} -div#monoblue-corner-bottom-right { - position: absolute; - bottom: 0; - right: 0; - width: 10px; - height: 10px; - background: url(./monoblue-corner.png) bottom right no-repeat !important; - background: none; -} -*/ -/** end of common settings **/ - -/** summary **/ -dl.overview { - margin: 0 0 0 30px; - font-size: 1.1em; - overflow: hidden; -} - dl.overview dt, - dl.overview dd { - margin: 5px 0; - float: left; - } - dl.overview dt { - clear: left; - font-weight: bold; - width: 150px; - } -/** end of summary **/ - -/** chagelog **/ -h3.changelog { - margin: 20px 0 5px 30px; - padding: 0 0 2px; - font-size: 1.4em; - border-bottom: dotted 1px #D5E1E6; -} -ul.changelog-entry { - margin: 0 0 10px 30px; - list-style-type: none; - position: relative; -} -ul.changelog-entry li span.revdate { - font-size: 1.1em; -} -ul.changelog-entry li.age { - position: absolute; - top: -25px; - right: 10px; - font-size: 1.4em; - color: #CCC; - font-weight: bold; - font-style: italic; -} -ul.changelog-entry li span.name { - font-size: 1.2em; - font-weight: bold; -} -ul.changelog-entry li.description { - margin: 10px 0 0; - font-size: 1.1em; -} -/** end of changelog **/ - -/** file **/ -p.files { - margin: 0 0 0 20px; - font-size: 2.0em; - font-weight: bold; -} -/** end of file **/ - -/** changeset **/ -h3.changeset { - margin: 20px 0 5px 20px; - padding: 0 0 2px; - font-size: 1.6em; - border-bottom: dotted 1px #D5E1E6; -} -p.changeset-age { - position: relative; -} -p.changeset-age span { - position: absolute; - top: -25px; - right: 10px; - font-size: 1.4em; - color: #CCC; - font-weight: bold; - font-style: italic; -} -p.description { - margin: 10px 30px 0 30px; - padding: 10px; - border: solid 1px #CCC; - font-size: 1.2em; -} -/** end of changeset **/ - -/** canvas **/ -div#wrapper { - position: relative; - font-size: 1.2em; -} - -canvas { - position: absolute; - z-index: 5; - top: -0.7em; -} - -ul#nodebgs li.parity0 { - background: #F1F6F7; -} - -ul#nodebgs li.parity1 { - background: #FFFFFF; -} - -ul#graphnodes { - position: absolute; - z-index: 10; - top: 7px; - list-style: none inside none; -} - -ul#nodebgs { - list-style: none inside none; -} - -ul#graphnodes li, ul#nodebgs li { - height: 39px; -} - -ul#graphnodes li .info { - display: block; - position: relative; -} -/** end of canvas **/ - -div#readme { - max-width: 920px; - border: 3px solid #ccc; - border-radius: 3px; - margin-left: 25px; - margin-top: 25px; -} - -div#readme article { - padding: 25px; -} - -#readme h1, #readme h2 { - border: 0; - margin: 0; - padding: 0; - text-indent: 0; - line-height: 1; -} - -h2#readmefilename { - background-color: #ccc; - padding: 10px; -} - -#readmefooter { - margin-top: 25px; - margin-left: 25px; - color: #aaa; -} \ No newline at end of file