Unverified Commit f7a3f8ec authored by Riccardo Spagni's avatar Riccardo Spagni
Browse files

moneropedia auto-fill index, entry for mining

parent 3851424f
......@@ -31,6 +31,7 @@ module Jekyll
class Markdown < Converter
alias base_converter convert
@@moneropedia = Array.new
@@moneropedia_ordered = Hash.new
def convert(content)
# build up index of Moneropedia summaries
......@@ -47,10 +48,27 @@ module Jekyll
if !entry.empty?
@@moneropedia.push({ :terms => entry['terms'], :summary => entry['summary'], :file => File.basename(entry_file, ".*") })
@@moneropedia_ordered = @@moneropedia_ordered.merge({ entry['entry'] => File.basename(entry_file, ".*") })
end
end
end
# Jekyll.logger.warn YAML::dump(@@moneropedia_ordered)
if content.include? '@moneropedia'
# Moneropedia index, replace with a list of entries
cur_letter = 'A'
replace = "<div class='col-lg-4'>\n<h4 class='text-center'>A</h4>\n"
@@moneropedia_ordered.sort.map do |entry, link|
if cur_letter != entry[0]
replace += "</div>\n<div class='col-lg-4'>\n<h4 class='text-center'>" + entry[0] + "</h4>\n"
cur_letter = entry[0]
end
replace += "<a href='/knowledge-base/moneropedia/" + link + "'>" + entry + "</a><br>\n"
end
replace += "</div>"
content = content.gsub(/(\@moneropedia)/i, replace)
end
# replace instances of @term with tooltips of the summary
@@moneropedia.each do |entry|
entry[:terms].each do |term|
......
......@@ -9,5 +9,14 @@ icon: "icon_wiki"
attribution: "<!-- Icon is based on work by Freepik (http://www.freepik.com) and is licensed under Creative Commons BY 3.0 -->"
---
### Work in Progress
---
<div class="row">
@moneropedia
</div>
---
If there is an entry you'd like to modify or be added, please [open an issue on this website's Github repository](https://github.com/monero-project/monero-site/issues) or submit changes via pull request.
---
layout: moneropedia
entry: "Mining"
terms: ["mining", "miner", "miners"]
summary: "the process of cryptographically computing a mathematical proof for a block, containing a number of transactions, which is then added to the blockchain"
---
### The Basics
{{ page.summary | capitalize }}.
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment