From b18747f6587eae474694d7cbef4a25e09ea2d5cf Mon Sep 17 00:00:00 2001 From: mDuo13 Date: Tue, 26 Feb 2019 17:58:40 -0800 Subject: [PATCH] Updated use case template --- assets/css/devportal.css | 26 ++++++++++----- .../contribute-code-to-ripple-lib.md | 1 + .../use-cases/contribute-code-to-rippled.md | 2 +- .../use-cases/list-xrp-in-your-exchange.md | 1 + content/use-cases/run-a-rippled-validator.md | 3 +- dactyl-config.yml | 12 ++++++- tool/filter_use_case.py | 33 +++++++++++++++++++ 7 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 tool/filter_use_case.py diff --git a/assets/css/devportal.css b/assets/css/devportal.css index 99e2682076..b8d35a619a 100644 --- a/assets/css/devportal.css +++ b/assets/css/devportal.css @@ -778,12 +778,19 @@ a.current { } /* Use Cases ---------------------------------------------------------------- */ +.use-case-steps { + padding-left: 1.5rem; + margin-left: 1.5rem; + border-left: 1px dashed #3B4147; + position: relative; +} + .use-case-step-num { border: 1px solid #3B4147; border-radius: 50%; padding: 0.9rem; position: absolute; - left: 1.8rem; + left: -1.8rem; height: 3.5rem; width: 3.5rem; text-align: center; @@ -796,18 +803,19 @@ a.current { font-size: 16px; } -.use-case p:not(:first-of-type) { - margin-top: .8rem; - margin-bottom: -.6rem; - padding-left: 2.5rem; - margin-left: 2.5rem; - border-left: 1px dashed #3B4147; +.use-case-steps p { + margin-left: .8rem; } -.use-case h2 { - margin-left: 5rem; + +.use-case-steps h2 { + margin-left: .8rem; margin-top: 0; } +.use-case-steps h2:first-of-type:before { + display: none; +} + /* Landing Pages ------------------------------------------------------------ */ .landing p { diff --git a/content/use-cases/contribute-code-to-ripple-lib.md b/content/use-cases/contribute-code-to-ripple-lib.md index 99c4e8eb94..790d461758 100644 --- a/content/use-cases/contribute-code-to-ripple-lib.md +++ b/content/use-cases/contribute-code-to-ripple-lib.md @@ -3,6 +3,7 @@ Want to contribute code or a bug report to help improve `ripple-lib`, the official client library for [RippleAPI](rippleapi-reference.html)? RippleAPI is a JavaScript API for interacting with the XRP Ledger. Here’s a roadmap to the high-level tasks that’ll have you reviewing code and functionality in no time. + {% set n = cycler(* range(1,99)) %} {{n.next()}} diff --git a/content/use-cases/contribute-code-to-rippled.md b/content/use-cases/contribute-code-to-rippled.md index aa5544c43b..165114de8a 100644 --- a/content/use-cases/contribute-code-to-rippled.md +++ b/content/use-cases/contribute-code-to-rippled.md @@ -2,9 +2,9 @@ Want to contribute code or a bug report to help improve `rippled`, the core peer-to-peer server that manages the XRP Ledger? Here’s a roadmap to the high-level tasks that’ll have you reviewing code and functionality in no time. + {% set n = cycler(* range(1,99)) %} - {{n.next()}} ## [Access the `rippled` repo](https://github.com/ripple/rippled) diff --git a/content/use-cases/list-xrp-in-your-exchange.md b/content/use-cases/list-xrp-in-your-exchange.md index 4835c2b2a7..3c2da2f968 100644 --- a/content/use-cases/list-xrp-in-your-exchange.md +++ b/content/use-cases/list-xrp-in-your-exchange.md @@ -2,6 +2,7 @@ Does your exchange want to list XRP, enabling your users to deposit, trade, and withdraw XRP? Here's a roadmap to the high-level tasks you'll need to perform. + {% set n = cycler(* range(1,99)) %} {{n.next()}} diff --git a/content/use-cases/run-a-rippled-validator.md b/content/use-cases/run-a-rippled-validator.md index 5febdc359f..6e9f651cca 100644 --- a/content/use-cases/run-a-rippled-validator.md +++ b/content/use-cases/run-a-rippled-validator.md @@ -2,10 +2,9 @@ Each `rippled` server (not running in stand-alone mode) connects to a network of peers, relays cryptographically signed transactions, and maintains a local copy of the complete shared global ledger. A `rippled` server running in validator mode additionally participates in the consensus process and is a part of an interconnected web of validators who each trust a specific set of validators not to collude. Here’s a roadmap to the high-level tasks you’ll need to perform to run a `rippled` validator. - + {% set n = cycler(* range(1,99)) %} - {{n.next()}} ## [Understand what it means to run a validator](rippled-server-modes.html#reasons-to-run-a-validator) diff --git a/dactyl-config.yml b/dactyl-config.yml index 648ee56459..871513bee8 100644 --- a/dactyl-config.yml +++ b/dactyl-config.yml @@ -2755,7 +2755,11 @@ pages: template: template-use-case.html useful_background: - amendments.html - - the-rippled-server.html #TODO - add to useful_background when available: fee voting, consensus principles & rules + - the-rippled-server.html + - fee-voting.html + - consensus-principles-and-rules.html + filters: + - use_case targets: - local @@ -2767,6 +2771,8 @@ pages: - xrp-ledger-overview.html - reliable-transaction-submission.html - xrp.html + filters: + - use_case targets: - local @@ -2777,6 +2783,8 @@ pages: useful_background: - consensus.html - amendments.html #TODO add to useful_background: stand-alone mode, rippled.cfg reference (future feature) + filters: + - use_case targets: - local @@ -2787,6 +2795,8 @@ pages: useful_background: - rippleapi-reference.html - get-started-with-rippleapi-for-javascript.html + filters: + - use_case targets: - local diff --git a/tool/filter_use_case.py b/tool/filter_use_case.py new file mode 100644 index 0000000000..7e6fa3eaad --- /dev/null +++ b/tool/filter_use_case.py @@ -0,0 +1,33 @@ +################################################################################ +## Use Case Filter ## +## Author: Rome Reginelli ## +## Copyright: Ripple Labs, Inc. 2019 ## +## ## +## Nests a comment-delineated section into a use-case-steps div so it can be ## +## styled properly. ## +################################################################################ + +import re + +START_REGEX = re.compile(r"") +START_REPL = '
' +END_REGEX = re.compile(r"") +END_REPL = '
' + +def filter_html(html, mode="html", **kwargs): + """ + Turn multicode comments into a div (after markdown inside is parsed). You + can use this div for styling even in PDF format. Doesn't apply to Markdown + since most parsers won't parse markdown inside HTML blocks. + """ + + if mode == "md": + return html + + html = re.sub(START_REGEX, START_REPL, html, count=1) + if re.search(END_REGEX, html): + html = re.sub(END_REGEX, "", html) + else: + html = html+"\n"+END_REPL+"\n" + + return html