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

Don't overwrite entries in references map #1256

Closed
mojavelinux opened this issue Jan 7, 2015 · 0 comments
Closed

Don't overwrite entries in references map #1256

mojavelinux opened this issue Jan 7, 2015 · 0 comments
Assignees
Milestone

Comments

@mojavelinux
Copy link
Member

Don't overwrite existing entries in the references map. This will allow extensions to add entries to the references map that aren't clobbered by the default registration.

if ::Array === value
  @references[:ids][value[0]] ||= (value[1] || '[' + value[0] + ']')
else
  @references[:ids][value] ||= '[' + value + ']'
end

For maximum control, it might be best to add an additional parameter to the register method to force an overwrite. The default value of this parameter should be false.

@mojavelinux mojavelinux self-assigned this Jan 7, 2015
@mojavelinux mojavelinux added this to the v1.5.3 milestone Jan 7, 2015
mojavelinux referenced this issue in jxxcarlson/asciidoctor-latex Jan 7, 2015
automatic numbering of theorems, equations, etc. per
the suggestion of @mojavelinux.  (Works like a charm, 25+
lines of bad code eliminated).

HOWEVEr, I am stuck on lines 121-125 of converter.rb.  In line 123 I edit
the document.references map.  The changes made are confirmed
in the logging statement of line 124.  However, when the next
equation, theorem, etc is encountered, the new information
added is overwritten with default information.  I must be
executing the code of line #123 at the wrong moment.  However,
I don't see where else I can excecute #123.

Run

  $ asciidoctor -r asciidoctor-latex -a stem=latexmath -b html try-out/eqno-latex.adoc

in the root of this repo to see the problem.
mojavelinux added a commit to mojavelinux/asciidoctor that referenced this issue Oct 6, 2015
mojavelinux added a commit to mojavelinux/asciidoctor that referenced this issue Oct 6, 2015
@mojavelinux mojavelinux added the wip label Oct 6, 2015
mojavelinux added a commit that referenced this issue Oct 7, 2015
resolves #1256 don't overwrite existing id entry in references table
@mojavelinux mojavelinux removed the wip label Oct 7, 2015
ggrossetie pushed a commit to ggrossetie/asciidoctor that referenced this issue Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant