Git Product home page Git Product logo

Comments (6)

ColonelThirtyTwo avatar ColonelThirtyTwo commented on June 30, 2024

As a workaround, you can use {{.ref exampleptc}}.

The current code strips non-ASCII-alphanumeric characters from the evidence name when generating it's ref, but the {{.ref}} tag does not do that, hence the mismatch. We could change it to strip the name similarly, but if I'm reading the docx spec right, we could also use the full name in double quotes and just escape " and \ characters. @chrismaddalena Would appreciate your thoughts.

from ghostwriter.

chrismaddalena avatar chrismaddalena commented on June 30, 2024

@ColonelThirtyTwo Yeah, let's try using quotes. If it works, that's the better solution. Escaping quotes is easy enough, and it should be unlikely that someone uses double quotes in a name anyway. This would also avoid a situation where someone could have evidence1 and evidence-1 and have their reference to the second one end up pointing to the first if we stripped the -.

from ghostwriter.

smcgu avatar smcgu commented on June 30, 2024

Speaking of duplicate evidence files, there does not appear to be any checks to block that. I'm able to create two evidence items with the same name. So, quoting the evidence names wouldn't help here.

I think this indicates that there are two issues:

  1. Special characters are treated differently for figure naming and cross-reference naming. One strips the special characters and the other does not, respectively.
  2. There are no checks to prevent evidence naming duplicates upstream in the Ghostwriter UI or when stripping them when generating the report. Currently, a user can create multiple evidence items with the same friendly name.

from ghostwriter.

smcgu avatar smcgu commented on June 30, 2024

Could we concatenate the evidence friendly name and the evidence ID when generating the DOCX? This should prevent naming collisions, even if multiple evidence items have the same friendly name.

For example:

  • "example-evidence", id 10 -> "example-evidence10"
  • "example-evidence", id 11 -> "example-evidence11"

from ghostwriter.

smcgu avatar smcgu commented on June 30, 2024

Name+ID could still theoretically experience collisions but I think a user would really have to go out of their way (or, be incredibly [un]lucky) to encounter it.

For example:

  • "example-evidence1", id: 10 -> "example-evidence110"
  • "example-evidence", id: 110 -> "example-evidence110"

from ghostwriter.

ColonelThirtyTwo avatar ColonelThirtyTwo commented on June 30, 2024

Keep in mind that captions made with {{.caption <name>}} can be referenced with {{.ref}} as well, so it's not as simple as looking up the evidence by the name passed to {{.ref}}. You could even reference a bookmark in the template with {{.ref}} if you knew the internal reference name.

But I can see name collisions being an issue moving forward, especially with extra fields attempting to generate an evidence figure multiple times.

from ghostwriter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.