Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.

Extract edition from a command instead of docinfo #17

Closed
edusantana opened this issue Apr 18, 2014 · 5 comments
Closed

Extract edition from a command instead of docinfo #17

edusantana opened this issue Apr 18, 2014 · 5 comments

Comments

@edusantana
Copy link
Contributor

As you can see at Generating-a-Build-Number it is possible to generate a build number runnuning git describe HEAD on a git project.

I would like to be able to use the output from git describe HEAD as the edition param insteading of updating manualy the editon on the docinfo.xml file.

The solution It would be something like:

a2x -a docinfo1 --edition=`git describe HEAD` ...
or
a2x -a docinfo1 -a edition=`git describe HEAD` ...

The problem

When building the pdf with -a docinfo it will read the file docinfo.xml where I try to keep the edition updated:

  <edition>v0.5.0</edition>
  <revhistory>

    <revision>
      <revnumber>v0.5.0</revnumber>
      <date>17/Março/2014</date>
      <authorinitials>Eduardo</authorinitials>
      <revremark>
- Documentação de funções no apêndice #23
- Revisão do capítulo de memória dinâmica #21
- Inclusão de experimento mkfifo no apêndice #22
- Inclusão do Capítulo de Arquivos #22
      </revremark>
    </revision>

    <revision>
      <revnumber>v0.4.0</revnumber>
...
</revhistory>

But after I do a small change in the project, it still builds with <edition>v0.5.0</edition> since a I don't have changed it.

@elextr
Copy link
Contributor

elextr commented Apr 18, 2014

On 18 April 2014 23:15, Eduardo de Santana Medeiros Alexandre <
[email protected]> wrote:

As you can see at Generating-a-Build-Numberhttp://git-scm.com/book/en/Distributed-Git-Maintaining-a-Project#Generating-a-Build-Numberit is possible to generate a build number runnuning git
describe HEAD on a git project.

I would like to be able to use the output from git describe HEAD as the
edition param insteading of updating manualy the editon on the docinfo.xmlfile.

The solution It would be something like:

a2x -a docinfo1 --edition=git describe HEAD ...

Well, there is git, hg, svn, fossil, darcs, and even still cvs. I can't
see that being supported, but ...

You could use a2x -a docinfo1 -a edition git describe HEAD ... to allow
you to set an attribute that you can manipulate and clean up before
plugging it in wherever you need it, or ...

you could write a macro that runs git describe and replaces itself with the
appropriate info.

Cheers
Lex

The problem

When building the pdf with -a docinfo it will read the file docinfo.xmlwhere I try to keep the
edition updated:

v0.5.0

<revision>
  <revnumber>v0.5.0</revnumber>
  <date>17/Março/2014</date>
  <authorinitials>Eduardo</authorinitials>
  <revremark>

But after I do a small change in the project, it still builds with
v0.5.0 since a I don't have changed it.


Reply to this email directly or view it on GitHubhttps://github.com/asciidoc-py/asciidoc-py/issues/17
.

@edusantana
Copy link
Contributor Author

Sorry, I have made a pull request before, but I don't know how to make two pull requests with differents commits.

You can see the solution of this issue here: edusantana@60e4fc3

This commit was mixed with de previous pull request: asciidoc-py/asciidoc-py#15

@elextr
Copy link
Contributor

elextr commented Apr 18, 2014

Oh dear, thats messed up #15. The thing you have done wrong is to not create a new git branch for each separate pull request. This also makes it easy to test your changes without mixing them with anything else the tester has changed.

Whilst you might be able to clean it all up within git and recover the pull requests, I'd just make a new clone and create new pull requests, this time in branches :)

As for this actual proposal, the docinfo file is included using include, not include1, so you should be able to use the edition attribute in the docinfo file and have it substituted there. No change to asciidoc needed.

@edusantana
Copy link
Contributor Author

Ok, new branch. I will do it.

But about the include, I don't know how I could do this without change asciidoc.

For example, with this change I was able to:

    ./a2x.py -f pdf -a edition="2" doc/book.txt

How to do it without change asciidoc?

@edusantana
Copy link
Contributor Author

I have made the pull request: #19

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

No branches or pull requests

2 participants