Coder Social home page Coder Social logo

Comments (7)

snoyberg avatar snoyberg commented on June 24, 2024

This was a new feature request someone put in: flag all inappropriate commands as errors, to prevent typos like $for all. When I run your code, I get the more descriptive error message:

Received a command I did not understand. If you wanted a literal $, start the line with a backslash.
Code: Language.Haskell.TH.Quote.quoteExp
shamlet
"\r\n<script>\r\n $(function() {\r\n $(".accordion").accordion({\r\n collapsible: true,\r\n
autoHeight: false,\r\n active: false\r\n });\r\n });\r\n\r\n"

Having this feature also allows us to add new commands in the future without worries of breaking people's code.

from shakespeare.

gregwebs avatar gregwebs commented on June 24, 2024

The way that this is handled in HAML & Slim is to allow switching to other parsers within html. :javascript indicates js. We could instead pass through all <script> tag content (there would still be a question as to variable insertion)

from shakespeare.

snoyberg avatar snoyberg commented on June 24, 2024

Sounds like a can of worms to me, I'm not in favor of this. We should just make it easier to embed Julius and Lucius results into Hamlet. Which reminds me: we should switch over to blaze-builder instead of Data.Text.Lazy.Builder for the 1.0 release of shakespeare-(css|js).

from shakespeare.

gregwebs avatar gregwebs commented on June 24, 2024

I had a few use cases that are easy & obvious to satisfy by passing through script/style content, but it isn't as obvious how to satisfy with an alternative technique.

<head>
    # put older browsers back to the root
    <script type="text/javascript">
      \top.noSVG = false;
      \if (!('pushState' in top.history)) {
        \if( 0 == location.pathname.indexOf('/sources/sr23/') ) {
          \top.location.href = '@{SearchR}#-' + location.pathname;
        \}
      \}

\<!--[if lt IE 9]>
    <script src=http://html5shim.googlecode.com/svn/trunk/html5.js>
    <script src=@{StaticR js_sie_js}>
    <script>
      \top.noSVG = true;
    <style type="text/css">
      div#energy-canvas  { height: auto; }
\<![endif]-->

I think my usage could be moved out of the template. They are little snippets, and in this case there is a global variable reference that is nice to have in the same file - it would be annoying to dedicate a file to each snippet. I could instead try to put functions using the julius quasi-quoter in one file and export them all to be available for the template.

from shakespeare.

snoyberg avatar snoyberg commented on June 24, 2024

I don't know what the complication here is. If we have a "juliusToHamlet" or something along those lines, wouldn't it solve the problem?

from shakespeare.

gregwebs avatar gregwebs commented on June 24, 2024

yes, and I also want to be able to have multiple julius snippets in one file- I may try to set this up in the scaffolding.

from shakespeare.

snoyberg avatar snoyberg commented on June 24, 2024

I'm not sure what the status is of this issue currently. Can it be closed?

from shakespeare.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.