Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f6757ef
Add bibtex apa json generator
kaysiz Jan 25, 2026
df39d64
Initial apa look up file
kaysiz Jan 25, 2026
f3eb0a5
refactor translation markdown generation code
kaysiz Jan 25, 2026
6f711b3
update workflow to add new flow to generate glossary
kaysiz Jan 26, 2026
266adb2
Merge branch 'master' into ks-refactor-glossary-generator
kaysiz Jan 27, 2026
5c291b3
Address review comments
kaysiz Jan 29, 2026
dc80c3c
Update gitignore
kaysiz Jan 29, 2026
43aef0c
Merge branch 'ks-refactor-glossary-generator' of github.com:forrtproj…
kaysiz Jan 29, 2026
90edaf1
Merge branch 'master' into ks-refactor-glossary-generator
kaysiz Jan 29, 2026
fded9da
Implement missing reference tracking
kaysiz Feb 5, 2026
a5a4029
Merge branch 'master' into ks-refactor-glossary-generator
kaysiz Feb 5, 2026
53bade3
Update .github/workflows/data-processing.yml
kaysiz Feb 10, 2026
a1c329c
Merge branch 'master' into ks-refactor-glossary-generator
kaysiz Feb 10, 2026
48953e8
Remove duplicate cache-dependency-path entry
kaysiz Feb 10, 2026
4c691a4
Merge branch 'master' into ks-refactor-glossary-generator
LukasWallrich Feb 11, 2026
ca7349a
fix references and associated languages
kaysiz Feb 16, 2026
4e0fe79
Merge branch 'master' into ks-refactor-glossary-generator
kaysiz Feb 16, 2026
90cb63c
Update bibtex_to_apa/package.json
kaysiz Feb 16, 2026
a0f1e5b
display references as list
kaysiz Feb 16, 2026
1e81d6f
fix merge error with workflow
kaysiz Feb 16, 2026
299d50f
Update content/glossary/_create_glossaries.py
kaysiz Feb 16, 2026
6345e14
Update bibtex_to_apa/bibtex_to_apa.js
kaysiz Feb 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 44 additions & 3 deletions .github/workflows/data-processing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,31 @@ jobs:
echo "📁 Moving network graph to static/partials..."
mv content/contributor-analysis/network-graph.html static/partials/

# Clean up HTML artifacts from index.md if any
sed -i.bak -e '/^```{=html}$/d' -e '/^```$/d' content/contributor-analysis/index.md && rm content/contributor-analysis/index.md.bak
#========================================
# Setup Node.js for bibliography processing
#========================================
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: bibtex_to_apa/package-lock.json
#========================================
# Install Node.js dependencies for bibliography processing
#========================================
- name: Install Node.js dependencies
run: |
cd bibtex_to_apa
npm install

echo "✅ Contributor analysis complete"
#========================================
# Process contributor data using Tenzing script
#========================================
- name: Run Tenzing script
continue-on-error: true # Continue even if this step fails
run: python3 scripts/forrt_contribs/tenzing.py
env:
GSHEET_CREDENTIALS: ${{ secrets.GSHEET_CREDENTIALS }}

#========================================
# Process and organize curated resources data
Expand Down Expand Up @@ -215,6 +236,15 @@ jobs:
fi
done

#========================================
# Generate APA lookup from bibliography
#========================================
- name: Generate APA lookup
continue-on-error: true # Continue even if this step fails
run: |
cd bibtex_to_apa
node bibtex_to_apa.js -o '../content/glossary/apa_lookup.json'

#========================================
# Process and generate glossary files
#========================================
Expand All @@ -225,6 +255,17 @@ jobs:
run: python3 content/glossary/_create_glossaries.py
# Execute the glossary script that generates glossary markdown files

- name: Check for missing references
if: always()
run: |
if [ -f "content/glossary/missing_references.txt" ]; then
echo "Missing references found:"
cat content/glossary/missing_references.txt
# Optionally fail the workflow or create an issue
else
echo "All references resolved successfully"
fi

#========================================
# Download Google Analytics data and validate
#========================================
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,6 @@ gha-creds-*.json

# Tenzing failure reports (temporary files for CI)
scripts/forrt_contribs/tenzing_failures.json

# Bibtex to APA converter output
bibtex_to_apa/node_modules/
93 changes: 93 additions & 0 deletions bibtex_to_apa/bibtex_to_apa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
const { Cite } = require('@citation-js/core');
require('@citation-js/plugin-bibtex');
require('@citation-js/plugin-csl');
const fs = require('fs');

const DEFAULT_INPUT = 'https://docs.google.com/document/d/1-KKsOYZWJ3LdgdO2b2uJsOG2AmUDaQBNqWVVTY2W4W8/edit?tab=t.0';
const DEFAULT_OUTPUT = 'apa_lookup.json';

async function fetchBibtex(input) {
if (!input.startsWith('http')) {
return fs.readFileSync(input, 'utf-8');
}

if (input.includes('docs.google.com')) {
const match = input.match(/\/d\/([a-zA-Z0-9_-]+)/);
if (!match) throw new Error('Invalid Google Doc URL');
const exportUrl = `https://docs.google.com/document/d/${match[1]}/export?format=txt`;
const response = await fetch(exportUrl);
if (!response.ok) throw new Error(`Failed to fetch: ${response.status}`);
let text = await response.text();
return text.replace(/\[[a-z]+\]/gi, ''); // Remove Google Docs comment markers
}

const response = await fetch(input);
if (!response.ok) throw new Error(`Failed to fetch: ${response.status}`);
return response.text();
}

function extractUrl(entry) {
if (entry.URL) return entry.URL;
if (entry.note) {
const match = entry.note.match(/https?:\/\/[^\s]+/);
if (match) return match[0];
}
return null;
}

function bibtexToApaJson(bibtexContent, includeUrl = true) {
const cite = new Cite(bibtexContent);
const result = {};

for (const entry of cite.data) {
const key = entry.id || entry['citation-key'];
let ref = new Cite(entry).format('bibliography', {
format: 'text',
template: 'apa',
lang: 'en-US'
}).trim();

if (includeUrl) {
const url = extractUrl(entry);
if (url && !url.includes('doi.org') && !ref.includes(url)) {
ref = ref.match(/https?:\/\/[^\s]+$/)
? `${ref} Retrieved from ${url}`
: ref.replace(/\.?$/, `. Retrieved from ${url}`);
}
}

result[key] = ref;
}

return result;
}

async function main() {
const args = process.argv.slice(2);
let input = DEFAULT_INPUT;
let output = DEFAULT_OUTPUT;
let includeUrl = true;

for (let i = 0; i < args.length; i++) {
if (args[i] === '-i' || args[i] === '--input') input = args[++i];
else if (args[i] === '-o' || args[i] === '--output') output = args[++i];
else if (args[i] === '--no-url') includeUrl = false;
else if (args[i] === '-h' || args[i] === '--help') {
console.log(
`Usage: node bibtex_to_apa.js [-i INPUT] [-o OUTPUT] [--no-url]
Options:
-i, --input Input BibTeX (URL or file). Default: Google Doc
-o, --output Output JSON file. Default: apa_lookup.json
--no-url Don't append URLs to references`
);
process.exit(0);
}
}

const bibtex = await fetchBibtex(input);
const apaJson = bibtexToApaJson(bibtex, includeUrl);
fs.writeFileSync(output, JSON.stringify(apaJson, null, 2));
console.log(`Wrote ${Object.keys(apaJson).length} references to ${output}`);
}

main().catch(console.error);
224 changes: 224 additions & 0 deletions bibtex_to_apa/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading