Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored code for use as a library. #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

frobnitzem
Copy link

The main files were moved into the src directory, and Typeset was removed
in favor of the classes "LineBreak," "LinkedList," and the function "BreakLines."
It seems that LinkedList could be written to use arrays...

Top-level wrapper functions from browser-assist were moved into
src/typeset.js which is now called like:

ret = typeset(text, measure_a_line, 'justify', [350], 3);
spans = gen_html(ret)
$('#browser-assist').append(spans[0]);
$('#browser-assist + ul').append(spans[1].map(function(w) {
    return "<li>"+w.toFixed(3)+"</li>";
}).join(""));

ideally, the more advanced ones used in flatland will follow later.

@PhilterPaper
Copy link

Do your changes have any effects on reported bugs?

  1. poor line-breaking in flatland demo
  2. line-length setting doesn't seem to work
  3. demerits value 100 or 3000?

@alerque
Copy link

alerque commented Mar 25, 2021

I haven't reviewed these in detail @PhilterPaper, but the typical definition of "refactoring" code in programmer jargon would mean that no, this has no affect on reported bugs. When you refactor code you basically shuffle things around to different places or making various structural changes to the code, but the expected input and output is the same.

Of course refactoring can fix bugs (or introduce new ones), but the goal of a refactor is to not change the function while improving the code health.

@frobnitzem
Copy link
Author

These are maintainability improvements, so that changes to the codebase can be more isolated and require less working memory for library developers and users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants