HiveMinds / Code-LatexReportTemplate

Syncs your matlab or python code and pictures directly into your latex report (pdf).
GNU Affero General Public License v3.0
1 stars 2 forks source link

Make python code that adds itself to the report. #3

Closed a-t-0 closed 3 years ago

a-t-0 commented 3 years ago

Write a code that scans all the code files and adds them all automatically as separate appendices to the code.

Make it opinionated by first looking for __main__.py and putting that in the first (new) appendix, and then searching for main.py and putting that 2nd.

Add the remainder on alphabetic order.

Add tests after the main code.

create-issue-branch[bot] commented 3 years ago

Branch issue-3-Make_python_code_that_adds_itself_to_the_report created!

a-t-0 commented 3 years ago
a-t-0 commented 3 years ago

First find the amount of appendices that do not include code and only add appendices after that position. The order for python files should be:

__main__.py
main.py
<alphabetic order>

If some files are already included: They either follow the order or not. a. If yes: a.1 They either have other appendices in between or not. ____a.1.a If yes: find the last code appendix that is already included and add the remaining code appendices in the specified (alphabetic) order ____a.1.b If no: Integrate the remaining appendices in between there in the specified (alphabetic) order

b. If no: b.1 They either have other appendices in between or not. ____b.1.a.1 If yes: find the last code appendix that is already included and add the remaining code appendices in the specified (alphabetic) order. ____b.1.b.1 If no: find the last code appendix that is already included and add the remaining code appendices in the specified (alphabetic) order.

a-t-0 commented 3 years ago
a-t-0 commented 3 years ago

Change of order specification: write a separate method that classifies and restructures the appendices.

Then always restructure according to the following order:

  1. First include the appendices without code in the order they were included.
  2. Include code in order: __main__.py,main.py,a-z
  3. Include notebooks in order: __main__.py,main.py,a-z
a-t-0 commented 3 years ago
a-t-0 commented 3 years ago

Completed in pull request #4 .