From 49f0c7900a27196ba2d259d590739597049aad83 Mon Sep 17 00:00:00 2001 From: Matt Lee Date: Thu, 28 Aug 2014 15:46:29 -0700 Subject: [PATCH] Feature-flagged new markdown styles. --- r2/Makefile | 2 +- r2/r2/public/static/css/old-markdown.less | 103 ++++++++++++++++++++++ r2/r2/templates/innertoolbarframe.html | 7 +- r2/r2/templates/reddit.html | 7 +- r2/r2/templates/wikibasepage.html | 10 ++- 5 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 r2/r2/public/static/css/old-markdown.less diff --git a/r2/Makefile b/r2/Makefile index 339d86bae..e5688fe83 100644 --- a/r2/Makefile +++ b/r2/Makefile @@ -86,7 +86,7 @@ clean_ini: #################### CSS file lists SPRITED_STYLESHEETS += reddit.less compact.css -LESS_STYLESHEETS := wiki.less adminbar.less policies.less markdown.less +LESS_STYLESHEETS := wiki.less adminbar.less policies.less markdown.less old-markdown.less OTHER_STYLESHEETS := mobile.css highlight.css #################### Static Files diff --git a/r2/r2/public/static/css/old-markdown.less b/r2/r2/public/static/css/old-markdown.less new file mode 100644 index 000000000..5fc853a28 --- /dev/null +++ b/r2/r2/public/static/css/old-markdown.less @@ -0,0 +1,103 @@ +/* markdown */ +.md { max-width: 60em; overflow: auto; font-size: small; } +.md p, .md h1 { margin: 5px 0} +.md h1 { font-weight: normal; font-size: 100%; } +.md > * { margin-bottom: 0px } +.md strong { font-weight: bold; } +.md em { font-style: italic; } +.md strong em { font-style: italic; font-weight: bold } +.md img { display: none } +.md ol, .md ul { margin: 10px 2em; } +.md ul { list-style: disc outside } +.md ol { + list-style: decimal outside; + margin-left: 3em; +} +.md pre { margin: 10px; } +.md blockquote, .help blockquote { + border-left: 2px solid #369; + padding-left: 4px; + margin: 5px; + margin-right: 15px; +} +.md td, .md th { border: 1px solid #EEE; padding: 1px 3px; } +.md th { font-weight: bold; } +.md table { margin: 5px 10px; } +.md center { text-align: left; } + +.wiki-page { + .wiki-page-content { + .md { + word-wrap: break-word; + max-width: none; + } + + .md.wiki { + h1, + h2, + h3, + h4, + h5, + h6 { + font-weight: bold; + color: black; + margin-bottom: .25em; + margin-top: .5em; + } + + h1 { + margin-top: .75em; + font-size: 2.4em; + } + + ul:first-child + h1 { + margin-top: 0; + } + + h2 { + margin-top: .75em; + font-size: 1.8em; + } + + h3 { + font-size: 1.6em; + } + + h4 { + font-size: 1.4em; + color: #333; + } + + h5 { + font-size: 1.2em; + color: #444; + } + + h6 { + font-size: 1.05em; + color: #666; + } + + img { + display: block; + } + + blockquote { + padding-left: 1em; + } + + p, .md.wiki blockquote { + margin: .75em 0; + } + + > .toc > ul { + padding: 10px 25px; + margin-right: 0; + + ul { + padding-left: 25px; + } + } + } + } +} diff --git a/r2/r2/templates/innertoolbarframe.html b/r2/r2/templates/innertoolbarframe.html index 246a6e6ab..505a5dc65 100644 --- a/r2/r2/templates/innertoolbarframe.html +++ b/r2/r2/templates/innertoolbarframe.html @@ -23,6 +23,7 @@ <%namespace file="less.html" import="less_js, less_stylesheet"/> <%! + from r2.config import feature from r2.lib.template_helpers import add_sr %> @@ -33,7 +34,11 @@ } ${less_stylesheet("reddit.less")} - ${less_stylesheet("markdown.less")} + %if feature.is_enabled('new_markdown_style'): + ${less_stylesheet("markdown.less")} + %else: + ${less_stylesheet("old-markdown.less")} + %endif ${less_js()} diff --git a/r2/r2/templates/reddit.html b/r2/r2/templates/reddit.html index e7c70fde4..bfdb9d8fa 100644 --- a/r2/r2/templates/reddit.html +++ b/r2/r2/templates/reddit.html @@ -21,6 +21,7 @@ ############################################################################### <%! + from r2.config import feature from r2.lib.template_helpers import add_sr, static, join_urls, class_dict, get_domain from r2.lib.filters import unsafe from r2.lib.pages import SearchForm, ClickGadget, SideContentBox, Login, ListingChooser @@ -45,7 +46,11 @@ <%def name="global_stylesheets()"> ${less_stylesheet("reddit.less")} - ${less_stylesheet("markdown.less")} + %if feature.is_enabled('new_markdown_style'): + ${less_stylesheet("markdown.less")} + %else: + ${less_stylesheet("old-markdown.less")} + %endif %if c.site.stylesheet: %endif diff --git a/r2/r2/templates/wikibasepage.html b/r2/r2/templates/wikibasepage.html index 4a9f4fed0..dfe01c8a9 100644 --- a/r2/r2/templates/wikibasepage.html +++ b/r2/r2/templates/wikibasepage.html @@ -19,13 +19,21 @@ ## All portions of the code written by reddit are Copyright (c) 2006-2014 ## reddit Inc. All Rights Reserved. ############################################################################### +<%! + from r2.config import feature +%> + <%namespace file="less.html" import="less_stylesheet"/> <%inherit file="reddit.html"/> <%def name="global_stylesheets()"> ${parent.global_stylesheets()} ${less_stylesheet('wiki.less')} - ${less_stylesheet('markdown.less')} + %if feature.is_enabled('new_markdown_style'): + ${less_stylesheet("markdown.less")} + %else: + ${less_stylesheet("old-markdown.less")} + %endif <%def name="actionsbar(actions)">