-
Notifications
You must be signed in to change notification settings - Fork 66
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
nitx: use doc commands #2591
nitx: use doc commands #2591
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is so great!
src/doc/templates/templates_term.nit
Outdated
|
||
redef class MEntity | ||
|
||
# ASCII icon to be displayed in front of the entity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no unicode 😞 ?
src/doc/templates/templates_term.nit
Outdated
i += 1 | ||
var line = fr.read_line | ||
if i < location.line_start or i > location.line_end then continue | ||
# FIXME add nitlight for console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console nitlight might be a good idea.
src/doc/templates/templates_term.nit
Outdated
fun cs_source_code: String do | ||
var file = location.file | ||
if file == null then return "" | ||
var fr = new FileReader.open(file.filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the source in in the location. why not ask for it? Location::text
|
||
redef class MDoc | ||
# Returns the full comment formatted for the console | ||
fun cs_comment(no_color: nullable Bool, indent: nullable Int): String do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a lot of your function have a no_color
parameter. I'm worrying that someday you may want to add more options/flag.
What about having a single config parameter where you can add more flags/option, and even delegate some services?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's refactor it when needed.
for line in content do | ||
res.append "{" " * indent}{line}\n" | ||
end | ||
if no_color == null or not no_color then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternative nullable bool
patterns are:
if no_color == true then
but is weird because the nullness is not explicit and that makes the test looks like a truismif no_color or else true then
is nice because we do not repeat theno_color
and the behavior of the null case is explicit, but aor else
in aif
might be confusing to some
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used all three alternatives in different projects. I still not sure of my favorite.
So I left it as it is.
src/doc/templates/templates_term.nit
Outdated
if not mparameters.is_empty then | ||
tpl.append "(" | ||
for i in [0..mparameters.length[ do | ||
tpl.append mparameters[i].cs_signature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a (no_color)
seems missing
c45768c
to
3b78e42
Compare
3b78e42
to
be1696d
Compare
reroll:
|
|
be1696d
to
2d9d791
Compare
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
2d9d791
to
bad441d
Compare
Reroll:
|
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
bad441d
to
85de593
Compare
Three things in this PR: * `nitx` now uses doc-commands (and related cleaning), bye bye the heavy `DocModel` with pre built `DocPages` * More tests for `nitx` * Move `nitx` to the `doc` tools suite, the group is now known as `doc::term` Pull-Request: #2591 Reviewed-by: Jean Privat <jean@pryen.org>
Three things in this PR:
nitx
now uses doc-commands (and related cleaning), bye bye the heavyDocModel
with pre builtDocPages
nitx
nitx
to thedoc
tools suite, the group is now known asdoc::term