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

Documentation created automatically #36

Merged

Conversation

abelsiqueira
Copy link
Member

This uses some pieces from the man page and the function arguments to create a simple documentation for the core interface.

@dpo
Copy link
Member

dpo commented Aug 5, 2015

If we're going to keep generating this documentation automatically, I'm wondering if we should store it in a separate file. I believe there's a way to attach a docstring to a function defined elsewhere.

I'm not insisting, but it looks like most of the file is taken up by the docstrings now, which makes it harder to navigate. What do you think?

@abelsiqueira
Copy link
Member Author

I tried to do that when using the man pages using something from the documentation but it didn't work. I will have time tomorrow and will test it again.

@abelsiqueira
Copy link
Member Author

I could only use Docile's external file when also using Lexicon, and I could only make it work on 0.4.
The documentation isn't clear enough on this point, maybe because of the migration of @doc to 0.4.

@dpo
Copy link
Member

dpo commented Aug 6, 2015

What I had in mind is something like this (from the link you gave):

"""
Method ``f(::Any)``.
"""
f(x) = x

"""
Function ``f`` after definition.
"""
f

The definition of f could appear in one file, and its documentation in another, that is included.

@abelsiqueira
Copy link
Member Author

That worked, but 0.3 has the limitation of not showing in the REPL. Should I add a conditional import Lexicon as mentioned here or wait for 0.4?

@dpo
Copy link
Member

dpo commented Aug 6, 2015

Is there a way to require it only for 0.3?

@abelsiqueira
Copy link
Member Author

From what I (didn't) found, it looks like there isn't. Someone asked a similar question on julia-users and the sole answer was negative. I also looked at other packages using Docile and no one did it.

@dpo
Copy link
Member

dpo commented Aug 6, 2015

I propose that we not require Docile. We don't need Docile because we're using plain docstrings. Users need Lexicon if they want enhanced documentation. I've started removing Docile from several other of my packages too. What do you think?

@abelsiqueira
Copy link
Member Author

Agreed

@abelsiqueira
Copy link
Member Author

I will destroy some commits in this

@abelsiqueira abelsiqueira force-pushed the feat/core-documentation branch from 0366db5 to df6f73e Compare August 6, 2015 20:05
@abelsiqueira
Copy link
Member Author

Commits squashed.

@dpo
Copy link
Member

dpo commented Aug 6, 2015

Thanks! Will it also be possible to document the specialized interface? If the documentation is stored in a different file, I'm not sure how that works?!

@abelsiqueira
Copy link
Member Author

I believe it's possible too, I'll just create another file with the documentation for the specialized, but it may take a little more time because of all the variations in the interface.
I will make a different PR for that.

@abelsiqueira abelsiqueira force-pushed the feat/core-documentation branch from d79b922 to bed166a Compare August 7, 2015 18:43
@abelsiqueira
Copy link
Member Author

I noticed, running the script again in other computer, that the terminal size was interfering with the manual pages size, regardless of being called inside the script. So I fixed by setting the man width size to a large value. This also removes hyphenation and justification.

@abelsiqueira abelsiqueira changed the title Core documentation created automatically Documentation created automatically Aug 9, 2015
@abelsiqueira
Copy link
Member Author

With the last commit, both documentations are created.
I'd rather rebase this after the fix #41, and squash the commits, if you think the output is good enough.

@abelsiqueira abelsiqueira force-pushed the feat/core-documentation branch from 060a356 to db4e635 Compare August 10, 2015 00:18
@abelsiqueira
Copy link
Member Author

I was gonna use @doc (@doc foo) foo!, but that doesn't work on 0.3

@dpo
Copy link
Member

dpo commented Aug 10, 2015

Let's use plain docstrings everywhere. They work on 0.3 with Docile, and natively on 0.4.

@abelsiqueira
Copy link
Member Author

That's what I did. It's on file src/documentation.jl.

@dpo
Copy link
Member

dpo commented Aug 31, 2015

Well actually, maybe I'm wrong about that. I can't get any documentation to show in 0.3. Can you?

@dpo
Copy link
Member

dpo commented Aug 31, 2015

Sorry that's not true. I get the docstrings from the Julia interface, but that's all. So defining the docstring elsewhere doesn't work in 0.3 at all, is that right?

@abelsiqueira
Copy link
Member Author

You're right, the documentation is not working with 0.3. In fact I needed Docile and Lexicon and to use @doc """ ... """ ->.
This also works with 0.4 without Docile and Lexicon.

To fix we need to return to if VERSION < ... and add Docile to REQUIRE.
Should we do it, or wait until 0.4 is stable?

@dpo
Copy link
Member

dpo commented Sep 1, 2015

Let's wait until 0.4 I think. I like the way you've set things up.

@dpo
Copy link
Member

dpo commented Sep 1, 2015

Any chance that you could rebase?

The documentation is in a separated file called `core_documentation.jl`.
This documentation was generated automatically, so it is limited.
It shows the function call, an excerpt of the man page (the
DESCRIPTION), and the type of each variable. Then, it refers the user
to the man page.
Inside the script, generating the interface, we need to set MANWIDTH so that
different terminals create the same documentation.
We set the MANWIDTH to a very large value so that hyphenation and justification
between words are also removed because they made the documentation look bad.

Note: We tried using `--nh` and `--nj` but the "less than" symbols were being
not being processed, so this was the workaround.
Change the document name and put all documentation
in a single docstring.
@abelsiqueira abelsiqueira force-pushed the feat/core-documentation branch from db4e635 to 4adc930 Compare September 1, 2015 01:58
@abelsiqueira
Copy link
Member Author

No problem. Rebased

dpo added a commit that referenced this pull request Sep 1, 2015
@dpo dpo merged commit 965963c into JuliaSmoothOptimizers:develop Sep 1, 2015
@dpo
Copy link
Member

dpo commented Sep 1, 2015

Thanks! Sorry I was away for a while.

@abelsiqueira abelsiqueira deleted the feat/core-documentation branch September 1, 2015 02:11
@abelsiqueira abelsiqueira mentioned this pull request Sep 1, 2015
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.

2 participants