Skip to content

Commit

Permalink
Enable js docs, disable failing c docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Jul 1, 2024
1 parent 86422c9 commit f30c888
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 52 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ jobs:
with:
submodules: true

- run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang
- name: Use Node.js 22
uses: actions/setup-node@v3
with:
node-version: 22
cache: 'npm'
cache-dependency-path: 'javascript/package-lock.json'

# - run: sudo apt-get install -y python3-clang python3-pip libclang-dev clang

- name: Install JavaScript dependencies
run: make jsdependencies && npm install -g jsdoc

- uses: ammaraskar/sphinx-action@master
with:
Expand Down
10 changes: 3 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
'sphinx.ext.inheritance_diagram',
'sphinx.ext.mathjax',
'sphinx.ext.todo',
'hawkmoth',
# 'hawkmoth',
# 'breathe',
# 'javasphinx',
# 'sphinx_autodoc_typehints',
# 'sphinx_pyreverse',
# 'sphinx_js',
'sphinx_pyreverse',
'sphinx_js',
# 'sphinx_csharp',
]

Expand All @@ -55,7 +55,3 @@
# https://www.sphinx-doc.org/en/master/usage/extensions/todo.html#configuration

todo_include_todos = True

if 'GITHUB_WORKSPACE' in os.environ:
from clang import cindex
cindex.Config.set_library_file('/usr/lib/llvm-14/lib/libclang.so.1')
3 changes: 2 additions & 1 deletion docs/javascript.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ Problems Solved
.. toctree::
:maxdepth: 1

.. javascript/p0001.rst
javascript/p0001.rst
javascript/p0002.rst
2 changes: 1 addition & 1 deletion docs/javascript/p0001.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ JavaScript Implementation of Problem 1

View source code `here on GitHub! <https://github.com/LivInTheLookingGlass/Euler/blob/master/javascript/p0001.js>`_

.. autojs:: ../javascript/p0001.js
.. js:autofunction:: p0001
6 changes: 6 additions & 0 deletions docs/javascript/p0002.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
JavaScript Implementation of Problem 2
======================================

View source code `here on GitHub! <https://github.com/LivInTheLookingGlass/Euler/blob/master/javascript/p0002.js>`_

.. js:autofunction:: p0002
22 changes: 11 additions & 11 deletions javascript/p0000_template.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
Project Euler Template
This template is used to format Project Euler solution scripts. This paragraph
should be replaced by a description of how I approached the problem, as well as
critque.
This paragraph should be replaced by the problem description, excluding images.
*/

exports.main = function() {
/**
* Project Euler Template
*

Check failure on line 3 in javascript/p0000_template.js

View workflow job for this annotation

GitHub Actions / javascript-lint

Trailing spaces not allowed
* This template is used to format Project Euler solution scripts. This paragraph
* should be replaced by a description of how I approached the problem, as well as
* critque.
*

Check failure on line 7 in javascript/p0000_template.js

View workflow job for this annotation

GitHub Actions / javascript-lint

Trailing spaces not allowed
* This paragraph should be replaced by the problem description, excluding images.
**/

exports.p0000 = function() {

};
25 changes: 12 additions & 13 deletions javascript/p0001.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/*
Project Euler Problem 1
Did this the old fashioned way, because this was before I figured out the closed form solution
Problem:
If we list all the natural numbers below 10 that are multiples of 3 or 5, we
get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
/**

Check failure on line 1 in javascript/p0001.js

View workflow job for this annotation

GitHub Actions / javascript-lint

Missing JSDoc @return for function
* Project Euler Problem 1
*

Check failure on line 3 in javascript/p0001.js

View workflow job for this annotation

GitHub Actions / javascript-lint

Trailing spaces not allowed
* Did this the old fashioned way, because this was before I figured out the closed form solution
*

Check failure on line 5 in javascript/p0001.js

View workflow job for this annotation

GitHub Actions / javascript-lint

Trailing spaces not allowed
* Problem:
*

Check failure on line 7 in javascript/p0001.js

View workflow job for this annotation

GitHub Actions / javascript-lint

Trailing spaces not allowed
* If we list all the natural numbers below 10 that are multiples of 3 or 5, we
* get 3, 5, 6 and 9. The sum of these multiples is 23.
*

Check failure on line 10 in javascript/p0001.js

View workflow job for this annotation

GitHub Actions / javascript-lint

Trailing spaces not allowed
* Find the sum of all the multiples of 3 or 5 below 1000.
*/

exports.main = function() {
exports.p0001 = function() {
let answer = 0;
for (let i = 3; i < 1000; i += 3) {
answer += i;
Expand Down
33 changes: 16 additions & 17 deletions javascript/p0002.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
/*
Project Euler Problem 2
Moved the fibonacci optimization to javascript
Problem:
Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed
four million, find the sum of the even-valued terms.
*/

exports.main = function() {
/**

Check failure on line 1 in javascript/p0002.js

View workflow job for this annotation

GitHub Actions / javascript-lint

Missing JSDoc @return for function
* Project Euler Problem 2
*

Check failure on line 3 in javascript/p0002.js

View workflow job for this annotation

GitHub Actions / javascript-lint

Trailing spaces not allowed
* Moved the fibonacci optimization to javascript
*

Check failure on line 5 in javascript/p0002.js

View workflow job for this annotation

GitHub Actions / javascript-lint

Trailing spaces not allowed
* Problem:
*
* Each new term in the Fibonacci sequence is generated by adding the previous two
* terms. By starting with 1 and 2, the first 10 terms will be:
*
* 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
*
* By considering the terms in the Fibonacci sequence whose values do not exceed
* four million, find the sum of the even-valued terms.
**/
exports.p0002 = function() {
// for a proof on why this formulation works, see python/p0002.py
let answer = 0;
let i = 2;
Expand Down
2 changes: 1 addition & 1 deletion javascript/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ for (question in answers) {
if (knownSlow.includes(question)) {
this.timeout(-1);
}
assert.equal(answer, module.main());
assert.equal(answer, module[`p${formattedQuestion}`]());
});
it('should return take less than 1 minute', function(done) {
this.timeout(-1);
Expand Down

0 comments on commit f30c888

Please sign in to comment.