mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
Code samples: sort intro things first
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Require Destination Tags
|
||||
|
||||
Require incoming payments to your account to specify a [Destination Tag](https://xrpl.org/source-and-destination-tags.html) so you know whom to credit.
|
||||
Require incoming payments to specify a [Destination Tag](https://xrpl.org/source-and-destination-tags.html) so you know whom to credit.
|
||||
|
||||
Examples from the [Require Destination Tags tutorial](https://xrpl.org/require-destination-tags.html).
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
<section class="container-new py-26">
|
||||
<div class="d-flex flex-column col-sm-8 p-0">
|
||||
<h6 class="eyebrow mb-3">{% trans %}Explore Code Samples{% endtrans %}</h6>
|
||||
<h3 class="h4 h2-sm">{% trans %}Browse sample code for building common use cases on the XRP Ledger{% endtrans %}</h3>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -36,6 +36,14 @@ def to_title_case(s):
|
||||
# def all_langs():
|
||||
langs = []
|
||||
|
||||
def sortfunc(cs):
|
||||
"""
|
||||
Sort code samples alphabetically by title except with "Intro" fields first
|
||||
"""
|
||||
if "Intro" in cs["title"] or "Quickstart" in cs["title"]:
|
||||
return " "+cs["title"]
|
||||
else:
|
||||
return cs["title"]
|
||||
|
||||
def all_code_samples():
|
||||
cses = []
|
||||
@@ -84,8 +92,7 @@ def all_code_samples():
|
||||
cs["href"] = dirpath
|
||||
cses.append(cs)
|
||||
|
||||
# Current sort value: alphabetical by title.
|
||||
return sorted(cses, key=lambda x: x["title"])
|
||||
return sorted(cses, key=sortfunc)
|
||||
|
||||
export = {
|
||||
"all_code_samples": all_code_samples,
|
||||
|
||||
Reference in New Issue
Block a user