by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 12:10
    john-cj edited #3696
  • 12:09
    john-cj edited #3696
  • 12:09
    john-cj edited #3696
  • 12:07
    john-cj opened #3696
  • 07:45
    mojavelinux labeled #3695
  • 01:54
    nyckmaia closed #3695
  • 01:41
    nyckmaia edited #3695
  • 01:29
    nyckmaia edited #3695
  • 01:28
    nyckmaia edited #3695
  • 01:28
    nyckmaia opened #3695
  • Jun 29 06:02
    mojavelinux labeled #3694
  • Jun 29 06:02
    mojavelinux milestoned #3694
  • Jun 29 06:02
    mojavelinux assigned #3694
  • Jun 29 06:02
    mojavelinux edited #3694
  • Jun 29 06:01
    mojavelinux edited #3694
  • Jun 29 05:59
    mojavelinux opened #3694
  • Jun 29 05:51
    mojavelinux closed #3690
  • Jun 29 05:51
    mojavelinux closed #3691
  • Jun 25 20:16
    lcawl opened #3693
  • Jun 25 19:49
    mojavelinux labeled #3692
Ewan Edwards
@eskwayrd
David Jencks
@djencks_gitlab
That's the legible answer!!
Behrang
@behrangsa
@mojavelinux Unfortunately for the time being, I am forced to use the Mustache engine which doesn't have {{#if}} and similar constructs...
David Jencks
@djencks_gitlab
I think the #middleName has the same effect. If mustache doesn't have that nice feature Ewan found I think you can just put the newline inside the conditional as I suggested.
Not knowing about ~ I've done that with handlebars :-)
Behrang
@behrangsa
@djencks_gitlab That should do the trick. Thanks!
David Jencks
@djencks_gitlab
even though I've never had a handlebar mustache I certainly find it easy to confuse handlebars and mustache!! I completely thought you were talking about handlebars :-)
Dan Allen
@mojavelinux
@behrangsa @djencks_gitlab :+1:
@djencks_gitlab same confusion here
Behrang
@behrangsa

Escaping Problem

I have a JSON document that looks like this

{
  "name" : "Price",
  "type" : "Currency",
  "pattern" : "/^((0)|([1-9]([0-9]){0,9}))((\\\\.(\\\\d\\\\d)))?$/"
}

Using a Mustache template, this is converted into this AsciiDoc document

= Test

== Table

[separator="@"]
|===
@ Name
@ Type
@ Pattern

@ Price
@ Currency
a@ `/^((0)|([1-9]([0-9]){0,9}))((\\.(\\d\\d)))?$/`
|===

The regex is legacy and not well written, but it is valid. However, when rendered, the generated HTML for the regex pattern doesn't look right:

<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><code>/^0)|([1-9]([0-9]){0,9}\\.(\\d\\d)?$/</code></p>
</div></div></td>
</tr>

Looks like all (( and )) occurrences are stripped out. Any ideas how can I render the regex in the output correctly?

David Jencks
@djencks_gitlab
Would inline passthrough help? +++complicated+++
perhaps
+++<code>/^((0)|([1-9]([0-9]){0,9}))((\\.(\\d\\d)))?$/</code>+++
David Jencks
@djencks_gitlab
or maybe
`+++/^((0)|([1-9]([0-9]){0,9}))((\\.(\\d\\d)))?$/+++`
Behrang
@behrangsa
Let me check...
I wonder what would happen if I have < in my regex though...
That seems to work. In order to properly escape <, though, I should use the single plus passthrough. Thanks!
Dan Allen
@mojavelinux
what you are looking for is a literal passthrough
which is the second thing @djencks_gitlab suggested, but you only need a single set of +
`+CONTENT HERE+`
that's closest to Markdown's backticks
you don't need an AsciiDoc table cell for inline formatting
that's only necessary if you are using block elements like a listing block
Dan Allen
@mojavelinux
in other words:
@ `+/^((0)|([1-9]([0-9]){0,9}))((\\.(\\d\\d)))?$/+`
if this is generated code, I would recommend using a less common table cell separator, like the broken vertical bar.
Behrang
@behrangsa
Thanks. I tried using a multi char separator but that didn't seem to work (e.g. @@@)
Dan Allen
@mojavelinux
the separater has to be a single character
but it's better to use a non-ASCII character because eventually you will have whatever character (or sequence) of ASCII you come up with
Matthew Setter
@settermjd
@mojavelinux, no, wondering if they can be used side by side in an anded way.
Behrang
@behrangsa
@mojavelinux + won't work if the regex itself contains +, for example: https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
Is there a way to use something other than + to demarcate literal passthroughs?
Behrang
@behrangsa

the separater has to be a single character

In the docs it is mentioned that:

Each data format has a default separator associated with it (csv = comma, tsv = tab, dsv = colon), but the separator can be changed to any character (or even a string of characters) by setting the separator attribute on the table.

Dan Allen
@mojavelinux
@settermjd no, they can't be used side-by-side, as in a compound condition. They can only be nested to accomplish that. You can find examples starting here: https://github.com/asciidoctor/asciidoctor/blob/master/test/reader_test.rb#L2136
@behrangsa true. AsciiDoc was primarily design for human shorthand, so you are going to run into edge cases when trying to generate it. you just have to implement the same escaping logic the human would do

@behrangsa is a shorthand for pass:c[] so:

`+text+`

is like:

`pass:c[text]`

this is explained here: https://asciidoctor.org/docs/user-manual/#literal-monospace

@behrangsa docs are wrong
Guillaume Grossetie
@Mogztter
@mojavelinux Any reason why we are not using https://tdg.docbook.org/tdg/4.5/videoobject.html to convert video nodes?
Dan Allen
@mojavelinux
No reason I can think of other than we just never did it.
bob roro
@bobroro_gitlab
Hello all, new here! Has anybody worked with asciidoctor-pdf, I'm trying to take an antora asciidoc page (with tables) and also convert it to pdf and I'm noticing tables in the pdf overflowing text to other rows, thoughts...
bob roro
@bobroro_gitlab
looks like it's my theme that's causing it. not sure where though
bob roro
@bobroro_gitlab
using version 1.5.0, not sure if that makes a difference
Guillaume Grossetie
@Mogztter
No reason I can think of other than we just never did it.
good, I will open an issue and submit a pull request then :smile:
Dan Allen
@mojavelinux
:+1:
@bobroro_gitlab in order to help you, we'd need to see an example
Dan Allen
@mojavelinux
I am VERY close to getting the new keep together logic working in Asciidoctor PDF. then I'm going to switch to adding the block border and shading after the content (instead of before). and finally, we will make keep together opt in.
the new logic tracks the start and end cursor instead of the block height, which means it draws the border and background around the content accurately
and it means we don't have to move a block to the next page if it has to be split anyway
David Jencks
@djencks_gitlab
Hmm, It seems to me that all the looping behavior in paged.js comes from their page break algorithm trying to keep things together. I have a hard time understanding their logic. Where is your algorithm for this?
Dan Allen
@mojavelinux
the algorithm in Asciidoctor PDF is very primitive. it was just woefully broken, which I'm fixing
the algorithm is to try to use a full page. if it fits on the previous page, move it back. if it doesn't fit on a full page, move it back and let it break normally.