XaQQhcQtEhfdzDvpDdQb Posted October 1, 2013 Share Posted October 1, 2013 I was wondering if it's possible to comment out large chunks of JSON-T code. <!-- Comments like this appear in the HTML, which is not what I want. --> {# Comments like this work great for single lines of text, and don't show up in HTML} Are there any other methods of hiding JSON-T and HTML template code? Link to comment
tbartels Posted October 11, 2013 Share Posted October 11, 2013 It looks like the Sqs JSONT parser does not support multi-line comments. According to the project page they are implemented in the Python version of the parser, I have no idea which version Sqs is using, but when tested, it only spits out an error. {##BEGIN}multiline comment {##END} outputs: <!-- SQUARESPACE_JSONT_ERROR template: page default (line/character offsets reference the template source code) 1: SyntaxError EOF_IN_COMMENT at line 29 character 40: Reached EOF in the middle of a multi-line comment --> In theory you could just abuse the {.section} tag: {.section multilineComment} <p>Assuming there's no variable named 'multilineComment', this bit of code should never be rendered.</p> {.end} Link to comment
Sly Posted February 24, 2014 Share Posted February 24, 2014 Turn on Word Wrap in your text editor and a single-line comment is as good as a multi-line comment. Like so: {#Integer ege't urna. Praesent rhoncus, lorem nec facilisis ultrices, magna leo pellentesque neque, eu aliquam diam tellus aliquam pede. Vivamus gravida, risus in pellentesque ultricies, urna odio condimentum sem, ege't tempus augue felis non erat. Nam quis lorem semper pede accumsan vestibulum. Vivamus condimentum.} If you really need a multi-line comment, you simply build your own out of multiple single-line comments, just like you would in an Apache configuration file: {#Integer ege't urna. Praesent rhoncus, lorem nec facilisis ultrices,}{#magna leo pellentesque neque, eu aliquam diam tellus aliquam}{#pede. Vivamus gravida, risus in pellentesque ultricies, urna odio}{#condimentum sem, ege't tempus augue felis non erat. Nam quis}{#lorem semper pede accumsan vestibulum. Vivamus condimentum.} Some text editors have commands that do this automatically for you. Link to comment
XaQQhcQtEhfdzDvpDdQb Posted February 24, 2014 Author Share Posted February 24, 2014 Thanks, unfortunately this won't work for commenting out JSON-T. The trouble I ran into is commenting out a block of JSON, not necessary text. Link to comment
nhassan Posted June 20, 2015 Share Posted June 20, 2015 Try two # {## some multiline chunk of strings {"key":"value"} {.section field}{@}{.end} ##} should work Link to comment
brandon Posted April 26, 2016 Share Posted April 26, 2016 Hi all. This works for me: {## <p>This code won't appear.</p> <p>Neither will this.</p> {website.id} <!--This won't show either.--> Nothing in here will render. ##} EDIT: Squarespace has published the 'comment directive': {# This is a single line comment} {##BEGIN} This is a longer, mulitline comment {##END} But this also works for me, as does my initial example: {##} This is a longer, mulitline comment {##} -Brandon If this or any other answer helps you out, please give credit where credit is due and Accept and/or Up-Vote that answer. If it didn't help, feel free to inquire further or wait and see what others have to say. Code is provided without any warranty, expressed or implied. If a response helped you out, send a 'Like' 👍 (bottom-right) and/or 'Upvote' (top-left) Link to comment
susannelson Posted October 10, 2018 Share Posted October 10, 2018 Your post has many detail information. I read all your article and I really like it. Thank you for sharing this great post.2 player games Link to comment
iqrach Posted May 11, 2019 Share Posted May 11, 2019 you can get detail from here link Link to comment
MaryGarcia1570048659 Posted July 4, 2019 Share Posted July 4, 2019 Great! It's a very informative post forever. If you really need a multi-line comment, you simply build your own out of multiple single-line comments, just like you would in an Apache server. I have found a piece of new information you can read here to get helpful tips and manage work and other projects. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.