Skip to content

Latest commit

 

History

History
180 lines (179 loc) · 7.4 KB

index.md

File metadata and controls

180 lines (179 loc) · 7.4 KB
title feature_text feature_image excerpt
## CDCS Training Material "Collaboration and community are at the heart of what we do"
This page is set up to facilitate the use of the CDCS repositories.
<title>Repository Search</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/lunr.js/2.3.8/lunr.min.js"></script>

Our GitHub Repositories

All the material that we have prepared for our Training Porgramme is hosted in our GitHub Repository. There are currently almost 80 repositories developped in the last 4 years. Each repository will contain a readme.md with instructions on their content and how to use them. You can search directly among the repositories using the Search tools at the bottom of this page. To facilitate self-learning we have also created a series of more self-contained tutorials that you can find below divided by topics.

Tutorials

Good Practices of Digital Research

Image 1

Intro to Programming

Image 2
  • More to Come Soon

Digitised Document & Text Analysis

Image 3
  • More to Come Soon

Data Wrangling & Data Visualisation

Image 4
  • More to Come Soon

Geographical Data & Digital Drawing

Image 5
  • More to Come Soon

Structured Data Analysis

Image 6
  • More to Come Soon

Search GitHub Repositories

You can search the repositories either by topic or by title.

Search by Topic

You can use the search functions below to filter the repositories based on the topics they cover. You can either type a topic or select one from the drop-down menu.

-- Select a Topic --

Search by Name

Use the search function below to filter based on the repository name.

    Contacts

    {% include button.html text="Email Us" link="mailto:CDCS@ed.ac.uk" color="#f68140" %} {% include button.html text="On Twitter" link="https://twitter.com/EdCDCS" color="#0d94e7" %}

    <script> const repos = {{ site.data.repos | jsonify }}; console.log('Fetched repositories:', repos); function createIndex(repos, field) { return lunr(function () { this.ref('name'); this.field('name'); this.field(field); repos.forEach(repo => { const data = { 'name': repo.name, 'id': repo.name }; data[field] = repo[field].join ? repo[field].join(' ') : repo[field]; this.add(data); }); }); } function populateTopicSelect(repos) { const topicSelect = document.getElementById('topic-select'); const uniqueTopics = new Set(); // Collect unique topics repos.forEach(repo => { repo.topics.forEach(topic => uniqueTopics.add(topic)); }); // Convert Set to array and sort alphabetically const sortedTopics = Array.from(uniqueTopics).sort(); console.log('Sorted topics:', sortedTopics); // Clear previous options topicSelect.innerHTML = '-- Select a Topic --'; // Add sorted topics to the dropdown sortedTopics.forEach(topic => { const option = document.createElement('option'); option.value = topic; option.textContent = topic; topicSelect.appendChild(option); }); } function searchRepos(query, index, repos, field, exactMatch = false) { const results = index.search(query); const repoList = document.getElementById('repo-list'); repoList.innerHTML = ''; results.forEach(result => { const repo = repos.find(r => r.name === result.ref); if (repo) { const fieldValue = repo[field]; const matchesExact = exactMatch ? fieldValue.includes(query) : true; if (!field || matchesExact) { const li = document.createElement('li'); li.innerHTML = `${repo.name}`; repoList.appendChild(li); } } }); if (results.length === 0 || repoList.innerHTML === '') { repoList.innerHTML = '
  • No results found
  • '; } } function initialize() { if (repos) { const topicIndex = createIndex(repos, 'topics'); const nameIndex = createIndex(repos, 'name'); populateTopicSelect(repos); // Flexible search for topics when typing document.getElementById('search-topic-input').addEventListener('input', function () { const query = this.value.trim(); searchRepos(query, topicIndex, repos, 'topics'); // flexible matching }); // Exact search for topics when selecting from the dropdown document.getElementById('topic-select').addEventListener('change', function () { const query = this.value.trim(); searchRepos(query, topicIndex, repos, 'topics', true); // exact matching }); // Flexible search for repository names document.getElementById('search-name-input').addEventListener('input', function () { const query = this.value.trim(); searchRepos(query, nameIndex, repos, 'name'); // flexible matching }); } } initialize(); </script>