From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/110720 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Incorrect css reference in exported html file Date: Sun, 28 Feb 2021 00:31:37 -0500 (EST) Message-ID: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-83715735-1614490298=:409911" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9919"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Alpine 2.23 (LNX 453 2020-06-18) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Feb 28 06:32:19 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lGEgl-0002TJ-0D for gctc-ntg-context-518@m.gmane-mx.org; Sun, 28 Feb 2021 06:32:19 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id ED23028106E; Sun, 28 Feb 2021 06:31:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3BRG19DMNSxZ; Sun, 28 Feb 2021 06:31:43 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 7B3BC281067; Sun, 28 Feb 2021 06:31:43 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 3BFE0280BB4 for ; Sun, 28 Feb 2021 06:31:42 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EbZYzgNPiz1c for ; Sun, 28 Feb 2021 06:31:41 +0100 (CET) Received-SPF: Softfail (mailfrom) identity=mailfrom; client-ip=132.206.73.2; helo=orford.cim.mcgill.ca; envelope-from=adityam@umich.edu; receiver= Original-Received: from orford.cim.mcgill.ca (smtp.cim.mcgill.ca [132.206.73.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 29C3228028A for ; Sun, 28 Feb 2021 06:31:40 +0100 (CET) Original-Received: from adi-thinkpad (198-48-192-62.cpe.teksavvy.com [198.48.192.62]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adityam) by orford.cim.mcgill.ca (Postfix) with ESMTPSA id 1ECE611BD9C for ; Sun, 28 Feb 2021 00:31:38 -0500 (EST) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:110720 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-83715735-1614490298=:409911 Content-Type: text/plain; charset=US-ASCII Hi, This message is prompted by a bug report for t-vim (https://github.com/adityam/filter/issues/43), but the issue is more general. Whenever, `cssfile` in `\setupexport` points to a file now in $PWD, the reference to the file in the exported CSS is incorrect: Consider the following directory tree: test.tex styles/mystyle.css where test.tex is: ``` \setupbackend[export=yes] \setupexport[cssfile=styles/mystyle.css] \starttext \startparagraph This is a test \stopparagraph \stoptext ``` and styles/mystyle.tex is (the content doesn't matter, listing it for completeness): ``` paragraph, p, div.paragraph, div.p { color : red ; } ``` I am attaching a zip file for convenience. When I compile the above file, I get (selective lines from output) ``` backend > export > copying styles/mystyle.css ... backend > export > adding css reference 'styles/styles/mystyle.css' ``` Indeed, the styles/mystyle.css file is copied to `test-export/styles/mystyle.css` but the reference in `test-export/test-export-div.html` is: ``` ``` Note the repeated styles/styles. What is happening is that while copying the file, context is using (in back-exp.lua): local source = addsuffix(cssextra[i],"css") local target = joinfile(stylepath,basename(source)) while for reference, context is using: result[#result+1] = replacetemplate(csspreamble, { filename = cssfile }) extras[#extras+1] = replacetemplate(cssheadlink, { filename = cssfile }) Shouldn't the last part be filename=basename(source) to get the right name? Without that whenever the value of cssfile is a file in another directory, the css reference in the exported html file will be incorrect. In case anyone is interested, this manifests in t-vim as follows. The t-vim module includes a pre-generated css file which provides the color and style values for the default color schemes. The module provides a macro \vimcssfile, which is the complete path of the file (basically the value of `resolvers.resolve("full:vimtyping-default.css")`). The intended usage is: \usemodule[vim] \setupbackend[export=yes] \setupexport[cssfile=\vimtypingcssfile] ... In this case, the css file is correctly copied to the '\jobname-export/styles` directory. but the `\jobname-div.html` file contains a unusable reference: ``` ... ``` In principle, I can work around this in t-vim but I think that this will impact others as well. Thanks, Aditya --8323329-83715735-1614490298=:409911 Content-Type: application/zip; name=export-test.zip Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=export-test.zip UEsDBAoAAAAAAMYBXFIAAAAAAAAAAAAAAAAMABwAZXhwb3J0LXRlc3QvVVQJ AAOkJjtg1CU7YHV4CwABBOgDAAAE6AMAAFBLAwQUAAAACAB7AVxSJjH3GmQA AACLAAAAFAAcAGV4cG9ydC10ZXN0L3Rlc3QudGV4VVQJAAMZJjtgGSY7YHV4 CwABBOgDAAAE6AMAAEWLyw2AMAxD75miE8AEbMGt7SFA+Ihf1ASJbk8VkJB8 sJ/tIKQXd9ivdAyebj6TNpkkQrDmJb4XGZeNGtG8kdR7NlMVHKEsFZMq3fpZ xoRTQp7BuXZexBWhUxIbnPz3Fu0J8ABQSwMECgAAAAAAqAFcUgAAAAAAAAAA AAAAABMAHABleHBvcnQtdGVzdC9zdHlsZXMvVVQJAANsJjtg2yU7YHV4CwAB BOgDAAAE6AMAAFBLAwQUAAAACACoAVxSgNjQBi0AAAA3AAAAHgAcAGV4cG9y dC10ZXN0L3N0eWxlcy9teXN0eWxlLmNzc1VUCQADbCY7YGwmO2B1eAsAAQTo AwAABOgDAAArSCxKTC9KLMjQ4SrQ4UrJLNMrQIiAuQrVXAoKyfk5+UUKVgpF qSkK1ly1XABQSwECHgMKAAAAAADGAVxSAAAAAAAAAAAAAAAADAAYAAAAAAAA ABAA7UEAAAAAZXhwb3J0LXRlc3QvVVQFAAOkJjtgdXgLAAEE6AMAAAToAwAA UEsBAh4DFAAAAAgAewFcUiYx9xpkAAAAiwAAABQAGAAAAAAAAQAAAKSBRgAA AGV4cG9ydC10ZXN0L3Rlc3QudGV4VVQFAAMZJjtgdXgLAAEE6AMAAAToAwAA UEsBAh4DCgAAAAAAqAFcUgAAAAAAAAAAAAAAABMAGAAAAAAAAAAQAO1B+AAA AGV4cG9ydC10ZXN0L3N0eWxlcy9VVAUAA2wmO2B1eAsAAQToAwAABOgDAABQ SwECHgMUAAAACACoAVxSgNjQBi0AAAA3AAAAHgAYAAAAAAABAAAApIFFAQAA ZXhwb3J0LXRlc3Qvc3R5bGVzL215c3R5bGUuY3NzVVQFAANsJjtgdXgLAAEE 6AMAAAToAwAAUEsFBgAAAAAEAAQAaQEAAMoBAAAAAA== --8323329-83715735-1614490298=:409911 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --8323329-83715735-1614490298=:409911--