Skip to content

Commit

Permalink
market-data, brokers yml
Browse files Browse the repository at this point in the history
  • Loading branch information
junsan1 committed Jul 7, 2024
1 parent 5d851bd commit a880980
Show file tree
Hide file tree
Showing 8 changed files with 552 additions and 40 deletions.
12 changes: 6 additions & 6 deletions _layouts/software_index.html → _layouts/catalog_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h1>{{ page.title }}</h1>

<div id="filters">
{% assign all_filters = '' | split: '' %}
{% for item in page.software %}
{% for item in page.catalog %}
{% for filter in item.filters %}
{% unless all_filters contains filter %}
{% assign all_filters = all_filters | push: filter %}
Expand All @@ -18,9 +18,9 @@ <h1>{{ page.title }}</h1>
{% endfor %}
</div>

<div id="software-list">
{% for item in page.software %}
<div class="software-item" data-filters="{{ item.filters | join: ' ' }}">
<div id="catalog-list">
{% for item in page.catalog %}
<div class="catalog-item" data-filters="{{ item.filters | join: ' ' }}">
<img src="{{ item.logo | relative_url }}" alt="{{ item.name }} logo">
<h2>{{ item.name }}</h2>
<p>{{ item.description }}</p>
Expand All @@ -41,7 +41,7 @@ <h2>{{ item.name }}</h2>
<script>
document.addEventListener('DOMContentLoaded', function() {
const filterButtons = document.querySelectorAll('.filter-btn');
const softwareItems = document.querySelectorAll('.software-item');
const catalogItems = document.querySelectorAll('.catalog-item');

let activeFilters = new Set();

Expand All @@ -62,7 +62,7 @@ <h2>{{ item.name }}</h2>
this.style.animation = null;
}

softwareItems.forEach(item => {
catalogItems.forEach(item => {
const itemFilters = item.dataset.filters.split(' ');
if (activeFilters.size === 0 || Array.from(activeFilters).every(filter => itemFilters.includes(filter))) {
item.style.display = 'block';
Expand Down
30 changes: 15 additions & 15 deletions _plugins/letter_page_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Jekyll
class LetterPageGenerator < Generator
safe true

SECTIONS = ['pedia', 'soft', 'brokers']
SECTIONS = ['pedia', 'soft', 'brokers', 'market-data', 'community']

def generate(site)
Jekyll.logger.info "LetterPageGenerator:", "Total pages: #{site.pages.size}"
Expand All @@ -27,24 +27,24 @@ def generate(site)
end

def process_section(site, lang, section, section_path)
if section == 'soft'
process_software_section(site, lang, section, section_path)
if ['soft', 'market-data', 'brokers', 'community'].include?(section)
process_catalog_section(site, lang, section, section_path)
else
process_regular_section(site, lang, section, section_path)
end
end

def process_software_section(site, lang, section, section_path)
software_data = load_software_data(site, section_path)
site.pages << SoftwareIndexPage.new(site, site.source, lang, section, software_data)
def process_catalog_section(site, lang, section, section_path)
catalog_data = load_catalog_data(site, section_path)
site.pages << CatalogIndexPage.new(site, site.source, lang, section, catalog_data)
end

def load_software_data(site, section_path)
yaml_file = File.join(section_path, 'software.yml')
def load_catalog_data(site, section_path)
yaml_file = File.join(section_path, 'list.yml')
if File.exist?(yaml_file)
YAML.load_file(yaml_file)
else
Jekyll.logger.warn "LetterPageGenerator:", "Software YAML file not found: #{yaml_file}"
Jekyll.logger.warn "LetterPageGenerator:", "Catalog YAML file not found: #{yaml_file}"
[]
end
end
Expand Down Expand Up @@ -193,28 +193,28 @@ def section_name_zh(section)
end
end

class SoftwareIndexPage < Page
def initialize(site, base, lang, section, software_data)
class CatalogIndexPage < Page
def initialize(site, base, lang, section, catalog_data)
@site = site
@base = base
@dir = File.join(lang, section)
@name = "index.md"

self.process(@name)
layout_file = File.join(base, '_layouts', 'software_index.html')
layout_file = File.join(base, '_layouts', 'catalog_index.html')
if File.exist?(layout_file)
self.read_yaml(File.dirname(layout_file), File.basename(layout_file))
else
Jekyll.logger.warn "LetterPageGenerator:", "Layout file 'software_index.html' not found"
Jekyll.logger.warn "LetterPageGenerator:", "Layout file 'catalog_index.html' not found"
self.data = {}
end
self.data['layout'] = 'software_index'
self.data['layout'] = 'catalog_index'
self.data['title'] = case lang
when 'en' then "Software Index"
when 'ru' then "Индекс программного обеспечения"
when 'zh' then "软件索引"
end
self.data['software'] = software_data
self.data['catalog'] = catalog_data
self.data['lang'] = lang
self.data['section'] = section
self.data['permalink'] = "/#{lang}/#{section}/index.html"
Expand Down
20 changes: 10 additions & 10 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ footer a:hover .github-icon {

.section-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
padding: 20px;
}
Expand Down Expand Up @@ -212,52 +212,52 @@ footer a:hover .github-icon {
background-color: #0056b3;
}

#software-list {
#catalog-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
}

.software-item {
.catalog-item {
background-color: #f8f8f8;
border-radius: 10px;
padding: 20px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
transition: box-shadow 0.3s, transform 0.3s;
}

.software-item:hover {
.catalog-item:hover {
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
transform: translateY(-5px);
}

.software-item img {
.catalog-item img {
max-width: 100px;
height: auto;
display: block;
margin: 0 auto 15px;
}

.software-item h2 {
.catalog-item h2 {
font-size: 1.2em;
color: #333;
margin-bottom: 10px;
text-align: center;
}

.software-item p {
.catalog-item p {
font-size: 0.9em;
margin-bottom: 15px;
}

.software-item a {
.catalog-item a {
display: inline-block;
margin-right: 10px;
color: #007bff;
text-decoration: none;
}

.software-item a:hover {
.catalog-item a:hover {
text-decoration: underline;
}

Expand Down Expand Up @@ -410,7 +410,7 @@ footer a:hover .github-icon {
font-size: 0.7em;
}

#software-list {
#catalog-list {
grid-template-columns: 1fr;
}

Expand Down
9 changes: 0 additions & 9 deletions en/brokers/i/interactive_brokers.md

This file was deleted.

Loading

0 comments on commit a880980

Please sign in to comment.