Width and height argtypes, kdesc --argtypes from ref/, txt @define/@left_right/@columns, kdiag --check value validation (from dev d6993110e9b3)
Also: the klammertext argtype (descriptions kept as source), txt table wrapping and :hpos/:offset, @c between ‹ ›, txt section headings, the ktext newline-only trim, capitalize(), and the argtype test suite. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b0d0d7897
commit
0ead40f272
39 files changed
+734
-158
No files matched your search
+1
-1
@@ -34,7 +34,7 @@
|
||||
@@image.k
|
||||
basename
|
||||
:id
|
||||
:width.length .5w
|
||||
:width.width .5w
|
||||
@caption_args@
|
||||
:vmargin.bool true
|
||||
@hpos_args@
|
||||
|
||||
+7
-3
@@ -76,12 +76,16 @@ class Image(klammer_base.Klammer_base):
|
||||
|
||||
# kutil.msg("rel: " + str(self.rel_fraction))
|
||||
|
||||
length, value, ltype = kutil.parse_length("html", self.width, self.rel_fraction)
|
||||
length, value, ltype = kutil.parse_width("html", self.width, self.rel_fraction)
|
||||
if ltype == "w":
|
||||
percent = float(value) * 100
|
||||
result.sty(f"width: {percent}%")
|
||||
else:
|
||||
elif ltype == "px":
|
||||
# The html width ATTRIBUTE takes pixels only; every other unit
|
||||
# is a style (an attribute of "2em" was silently ignored).
|
||||
result.attr("width", length)
|
||||
else:
|
||||
result.sty(f"width: {length}")
|
||||
|
||||
if self.border:
|
||||
result.cls("image_border")
|
||||
@@ -124,7 +128,7 @@ class Image(klammer_base.Klammer_base):
|
||||
#if self.caption or self.number:
|
||||
# width = "\\textwidth"
|
||||
#else:
|
||||
width = kutil.parse_length("tex", self.width, self.rel_fraction)[0]
|
||||
width = kutil.parse_width("tex", self.width, self.rel_fraction)[0]
|
||||
width = re.sub("px", "pt", width)
|
||||
#result = f'\\includegraphics[width={width}]{{{source}}}'
|
||||
if self.number or self.caption:
|
||||
|
||||
Reference in new issue
Block a user