-
Notifications
You must be signed in to change notification settings - Fork 102
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
Block consistency #2286
Block consistency #2286
Conversation
which are typically (vertical) blocks of block, para orsectional material (according to the level) for layout purposes. * block can contain Block.model allowed in Block.class * logical-block can contain Para.model allowed in Para.class * sectional-block can contain sectional material, allowed in sections Each has an inline- variant which is in Misc.class. NOTE: that inline-para has been renamed inline-logical-block! NOTE: that the content model of table cells (ltx:td) has been changed to Inline.model; if it needs to contain block level material, it needs to be contained in an appropriate inline-xxx element.
…porarily capturing block-like content at various levels to defer determining which level (block,logical,sectional) is needed
…with the new name allowing for automatic opening/closing of nodes
…ate proper inline-blocks
…ode avoiding unnecessary ltx:break; use these more consistently, obsoleting \inner@par, \lx@parboxnewline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a first introductory read through the PR - I really like the changes! The new naming scheme is very helpful to describe the variations on the block-like theme.
_CaptureBlock_
is really fascinating. I'm going to explore a bit how the tests change for my subfigure refactor branch.
lib/LaTeXML/Package/LaTeX.pool.ltxml
Outdated
return; }, | ||
properties => { isBreak => 1 }); | ||
|
||
Let('\lx@parboxnewline[]', '\lx@newline'); # Obsolete, but in case still used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably the []
arg should go away for the Let?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
@@ -4,8 +4,8 @@ | |||
<document xmlns="http://dlmf.nist.gov/LaTeXML"> | |||
<resource src="LaTeXML.css" type="text/css"/> | |||
<resource src="ltx-article.css" type="text/css"/> | |||
<para xml:id="p1"> | |||
<tabular vattach="bottom"> | |||
<para vattach="bottom" xml:id="p1"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... vattach
on para, which is the top content element of a document? Seems a little fishy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the test is fishy starting with a vbox.
@@ -116,7 +114,6 @@ and collectively as <ref labelref="LABEL:fig:D"/>.</p> | |||
<toccaption><tag close=" ">(b)</tag>This is another figure</toccaption> | |||
<caption><tag close=" "><text font="bold" fontsize="80%">(b)</text></tag><text font="italic" fontsize="80%">This is another figure</text></caption> | |||
</figure> | |||
<break class="ltx_centering"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to remember if the trailing break was helpful for the flexbox layout to have a clear end... Would need to look at tests, but dropping it is probably fine. The intermediate breaks are the important ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this PR, I've generally been trying to avoid introducing the breaks if I can, particularly in a block situation where things should be vertically stacked anyway.
…g:foreignObject in ltx:_CaptureBlock_
…ng inlne- blocks when needed)
@@ -1970,7 +1970,7 @@ sub renameNode { | |||
my $key = $attr->getName; | |||
my $value = $node->getAttribute($key); | |||
$id = $value if $key eq 'xml:id'; # Save to register after removal of old node. | |||
$new->setAttribute($key, $value); } | |||
$new->setAttribute($key, $value) if $model->canHaveAttribute($newname, $key); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we emit an Info message if an attribute gets dropped here? I wonder if it may aid some future debugging session.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, yeah maybe, but probably just a lot of noise?
@@ -111,7 +111,7 @@ grammar { | |||
common.attrs.aria.implicit.link = empty | |||
SVG.Core.extra.attrib &= parent svgForeign.attributes | |||
include "svg11.rnc" | |||
{ SVG.foreignObject.content = parent Flow.model | |||
{ SVG.foreignObject.content = parent Inline.model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking out loud: Right, so the idea for switching to Inline.model is to leverage ltx:inline-block
(or similar) auto-opening.
I think that would benefit from a schema comment - since the HTML+SVG spec and TeX would both permit pretty much any layout-oriented content in those nodes (e.g. a table, a citation, a math formula, but not a section or a bibliography). I think it would be helpful for the schema to document that, and mention the inline-block
mechanism as the intended carrier for the effect.
I guess the alternative was to start as block-level and auto-open nodes that can hold Inline content?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certain TeX does, which is the issue; HTML sorta does, but when you start getting p
in peculiar places, it has undesirable effects that can be papered over with CSS, but it gets complex & error-prone. So it's basically the same rationale for changing td
content model to Inline.
In this recent set of changes, I'm finding Flow
model kinda annoying for that reason. It probably contributes to the confusion dealing with figure & graphic layout since you're never quite sure what you're getting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No further comments, excited to merge and rebase my subfigure work over.
I just got a private email inquiring about some details of LaTeXML's schema and I realized I forgot to suggest a post-merge step: @brucemiller Could you please regenerate the schema docs at the online manual? The current schema page mentions it was last generated December, 2022. |
This PR improves the LaTeXML Schema for vertical blocks of material at various levels (block, logical (aka para), sectional) and improves the flexibility of processing. The revised
insertBlock
captures the material to be inserted in a special_CaptureBlock_
(temporary) element, and then determines an appropriate container element based on the content, context, and attributes to be added. Several other simplifications and cleanup were then enabled.To make this work, a more consistent set of blocks were needed: we now have
block
which containsBlock.model
and can appear inBlock.class
logical-block
which containsPara.model
and can appear inPara.class
sectional-block
which contains sectional material and can appear in sections.Along with an
inline-
variant for each, which appears inMisc.class
.NOTE the breaking change that
ltx:inline-para
has been renamedltx:inline-logical-block
.Additional changes include cleaning up
\normal@par
and\lx@newline
to behave more generally, and to no-longer need\inner@par
.Moreover, the content model of
ltx:td
was changed toInline.model
to be more consistent with HTML; when neededinline-
block can be used.Fixes #1705
Fixes #2038
Fixes #2005
Fixes #2037